Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-07-13 13:22:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-13 13:22:21 +0300
commitc7c7bfae75e82ee2121be133b3cc4b297146a026 (patch)
tree2c4c230bbd333fbeb174e9247fc2bb42ae796a36 /source/blender/compositor
parent399cbd3b6bb9e23333ecc37231c8149056affda1 (diff)
parent30bffb5a3afa2fde165d4fb63a115310d5ddc3e3 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/nodes/COM_MathNode.cpp12
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp47
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.h24
3 files changed, 83 insertions, 0 deletions
diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp
index d16300ebff4..25c617a3487 100644
--- a/source/blender/compositor/nodes/COM_MathNode.cpp
+++ b/source/blender/compositor/nodes/COM_MathNode.cpp
@@ -89,6 +89,18 @@ void MathNode::convertToOperations(NodeConverter &converter, const CompositorCon
case NODE_MATH_ATAN2:
operation = new MathArcTan2Operation();
break;
+ case NODE_MATH_FLOOR:
+ operation = new MathFloorOperation();
+ break;
+ case NODE_MATH_CEIL:
+ operation = new MathCeilOperation();
+ break;
+ case NODE_MATH_FRACT:
+ operation = new MathFractOperation();
+ break;
+ case NODE_MATH_SQRT:
+ operation = new MathSqrtOperation();
+ break;
}
if (operation) {
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index 0a515da1877..99385a5073a 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -356,3 +356,50 @@ void MathArcTan2Operation::executePixelSampled(float output[4], float x, float y
clampIfNeeded(output);
}
+
+void MathFloorOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
+{
+ float inputValue1[4];
+
+ this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
+
+ output[0] = floor(inputValue1[0]);
+
+ clampIfNeeded(output);
+}
+
+void MathCeilOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
+{
+ float inputValue1[4];
+
+ this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
+
+ output[0] = ceil(inputValue1[0]);
+
+ clampIfNeeded(output);
+}
+
+void MathFractOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
+{
+ float inputValue1[4];
+
+ this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
+
+ output[0] = inputValue1[0] - floor(inputValue1[0]);
+
+ clampIfNeeded(output);
+}
+
+void MathSqrtOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
+{
+ float inputValue1[4];
+
+ this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
+
+ if (inputValue1[0] > 0)
+ output[0] = sqrt(inputValue1[0]);
+ else
+ output[0] = 0.0f;
+
+ clampIfNeeded(output);
+}
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h
index c636117451f..5435cc82ba7 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.h
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.h
@@ -175,4 +175,28 @@ public:
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
};
+class MathFloorOperation : public MathBaseOperation {
+public:
+ MathFloorOperation() : MathBaseOperation() {}
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathCeilOperation : public MathBaseOperation {
+public:
+ MathCeilOperation() : MathBaseOperation() {}
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathFractOperation : public MathBaseOperation {
+public:
+ MathFractOperation() : MathBaseOperation() {}
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathSqrtOperation : public MathBaseOperation {
+public:
+ MathSqrtOperation() : MathBaseOperation() {}
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
#endif