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:
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/nodes/COM_MathNode.cpp3
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp11
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.h6
3 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp
index 42a8cb032ce..ac1c2b3c159 100644
--- a/source/blender/compositor/nodes/COM_MathNode.cpp
+++ b/source/blender/compositor/nodes/COM_MathNode.cpp
@@ -83,6 +83,9 @@ void MathNode::convertToOperations(NodeConverter &converter, const CompositorCon
case 17: /* Modulo */
operation = new MathModuloOperation();
break;
+ case 18: /* Absolute Value */
+ operation = new MathAbsoluteOperation();
+ break;
}
if (operation) {
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index 9da55df476d..cbc60b5091d 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -333,3 +333,14 @@ void MathModuloOperation::executePixelSampled(float output[4], float x, float y,
clampIfNeeded(output);
}
+void MathAbsoluteOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
+{
+ float inputValue1[4];
+
+ this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
+
+ output[0] = fabs(inputValue1[0]);
+
+ clampIfNeeded(output);
+}
+
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h
index 4ea7c43a67d..05d2bb054d3 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.h
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.h
@@ -163,4 +163,10 @@ public:
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
};
+class MathAbsoluteOperation : public MathBaseOperation {
+public:
+ MathAbsoluteOperation() : MathBaseOperation() {}
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
#endif