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:
authorCharlie Jolly <charlie>2019-12-06 02:02:05 +0300
committerCharlie Jolly <mistajolly@gmail.com>2019-12-07 15:33:07 +0300
commit0406eb110332a863811d7fb6228f9a7ca514e022 (patch)
tree9809062966699e31c785ae0dc97ccb6e9f6c60f7 /source/blender/compositor/operations/COM_MathBaseOperation.h
parent6a78ace569ec7c0e076e5af34d9496ce3363b81e (diff)
Maths Node: Additional functions
When creating shaders and using maths functions it is expected that Blender should match functions in other DCC applications, game engines and shading languages such as GLSL and OSL. This patch adds missing functions to the Blender maths node. Ideally, it would be nice to have these functions available to vectors too but that is not part of this patch. This patch adds the following functions trunc, snap, wrap, compare, pingpong, sign, radians, degrees, cosh, sinh, tanh, exp, smoothmin and inversesqrt. Sign function is based on GLSL and OSL functions and returns zero when x == 0. Differential Revision: https://developer.blender.org/D5957
Diffstat (limited to 'source/blender/compositor/operations/COM_MathBaseOperation.h')
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h
index 7c11ea8f45b..199b59d8649 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.h
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.h
@@ -31,6 +31,7 @@ class MathBaseOperation : public NodeOperation {
*/
SocketReader *m_inputValue1Operation;
SocketReader *m_inputValue2Operation;
+ SocketReader *m_inputValue3Operation;
bool m_useClamp;
@@ -119,6 +120,28 @@ class MathTangentOperation : public MathBaseOperation {
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
};
+class MathHyperbolicSineOperation : public MathBaseOperation {
+ public:
+ MathHyperbolicSineOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+class MathHyperbolicCosineOperation : public MathBaseOperation {
+ public:
+ MathHyperbolicCosineOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+class MathHyperbolicTangentOperation : public MathBaseOperation {
+ public:
+ MathHyperbolicTangentOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
class MathArcSineOperation : public MathBaseOperation {
public:
MathArcSineOperation() : MathBaseOperation()
@@ -206,6 +229,22 @@ class MathAbsoluteOperation : public MathBaseOperation {
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
};
+class MathRadiansOperation : public MathBaseOperation {
+ public:
+ MathRadiansOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathDegreesOperation : public MathBaseOperation {
+ public:
+ MathDegreesOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
class MathArcTan2Operation : public MathBaseOperation {
public:
MathArcTan2Operation() : MathBaseOperation()
@@ -246,4 +285,91 @@ class MathSqrtOperation : public MathBaseOperation {
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
};
+class MathInverseSqrtOperation : public MathBaseOperation {
+ public:
+ MathInverseSqrtOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathSignOperation : public MathBaseOperation {
+ public:
+ MathSignOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathExponentOperation : public MathBaseOperation {
+ public:
+ MathExponentOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathTruncOperation : public MathBaseOperation {
+ public:
+ MathTruncOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathSnapOperation : public MathBaseOperation {
+ public:
+ MathSnapOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathWrapOperation : public MathBaseOperation {
+ public:
+ MathWrapOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathPingpongOperation : public MathBaseOperation {
+ public:
+ MathPingpongOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathCompareOperation : public MathBaseOperation {
+ public:
+ MathCompareOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathMultiplyAddOperation : public MathBaseOperation {
+ public:
+ MathMultiplyAddOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathSmoothMinOperation : public MathBaseOperation {
+ public:
+ MathSmoothMinOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
+
+class MathSmoothMaxOperation : public MathBaseOperation {
+ public:
+ MathSmoothMaxOperation() : MathBaseOperation()
+ {
+ }
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+};
#endif