diff options
author | Matt Heimlich <matt.heimlich@gmail.com> | 2014-05-07 18:20:17 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-05-07 18:43:59 +0400 |
commit | 3fbc984b069fed441cccdd3416ec71e064235e36 (patch) | |
tree | 1c95f9d57457069eb3918deb727fc62b4c83dee5 /source/blender/compositor/operations | |
parent | 8b8d5a441f5815e83f83bacf8023e2cc3fbb2a04 (diff) |
Nodes: add absolute value operation to all math nodes
Reviewed By: dingto, brecht
Differential Revision: https://developer.blender.org/D507
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r-- | source/blender/compositor/operations/COM_MathBaseOperation.cpp | 11 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_MathBaseOperation.h | 6 |
2 files changed, 17 insertions, 0 deletions
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 |