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:
authorThomas Dinges <blender@dingto.org>2013-05-20 18:38:47 +0400
committerThomas Dinges <blender@dingto.org>2013-05-20 18:38:47 +0400
commit38dc85f296a27a5641d296c8f41834db41dac18b (patch)
treeb47567b3c6fd455a6a92b359fc92509ff33e85fb /source/blender/compositor/operations
parent0fb5c9117fdb9ad24184a2dad2ad1c8c66565aaa (diff)
Math Node:
* Added a Modulo operation to the math node, available in Compositor, Shader and Texture Nodes.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp15
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.h6
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index 7039689aa5f..3749bcf42d8 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -317,4 +317,19 @@ void MathGreaterThanOperation::executePixel(float output[4], float x, float y, P
clampIfNeeded(output);
}
+void MathModuloOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
+{
+ float inputValue1[4];
+ float inputValue2[4];
+
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
+
+ if (inputValue2[0] == 0)
+ output[0] = 0.0;
+ else
+ output[0] = fmod(inputValue1[0], inputValue2[0]);
+
+ clampIfNeeded(output);
+}
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h
index febfa9662c6..649a9688037 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.h
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.h
@@ -157,4 +157,10 @@ public:
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
+class MathModuloOperation : public MathBaseOperation {
+public:
+ MathModuloOperation() : MathBaseOperation() {}
+ void executePixel(float output[4], float x, float y, PixelSampler sampler);
+};
+
#endif