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/nodes
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/nodes')
-rw-r--r--source/blender/compositor/nodes/COM_MathNode.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp
index d13b34bb6b5..5497d4a4755 100644
--- a/source/blender/compositor/nodes/COM_MathNode.cpp
+++ b/source/blender/compositor/nodes/COM_MathNode.cpp
@@ -56,6 +56,15 @@ void MathNode::convertToOperations(NodeConverter &converter,
case NODE_MATH_ARCTANGENT:
operation = new MathArcTangentOperation();
break;
+ case NODE_MATH_SINH:
+ operation = new MathHyperbolicSineOperation();
+ break;
+ case NODE_MATH_COSH:
+ operation = new MathHyperbolicCosineOperation();
+ break;
+ case NODE_MATH_TANH:
+ operation = new MathHyperbolicTangentOperation();
+ break;
case NODE_MATH_POWER:
operation = new MathPowerOperation();
break;
@@ -83,6 +92,12 @@ void MathNode::convertToOperations(NodeConverter &converter,
case NODE_MATH_ABSOLUTE:
operation = new MathAbsoluteOperation();
break;
+ case NODE_MATH_RADIANS:
+ operation = new MathRadiansOperation();
+ break;
+ case NODE_MATH_DEGREES:
+ operation = new MathDegreesOperation();
+ break;
case NODE_MATH_ARCTAN2:
operation = new MathArcTan2Operation();
break;
@@ -98,6 +113,39 @@ void MathNode::convertToOperations(NodeConverter &converter,
case NODE_MATH_SQRT:
operation = new MathSqrtOperation();
break;
+ case NODE_MATH_INV_SQRT:
+ operation = new MathInverseSqrtOperation();
+ break;
+ case NODE_MATH_SIGN:
+ operation = new MathSignOperation();
+ break;
+ case NODE_MATH_EXPONENT:
+ operation = new MathExponentOperation();
+ break;
+ case NODE_MATH_TRUNC:
+ operation = new MathTruncOperation();
+ break;
+ case NODE_MATH_SNAP:
+ operation = new MathSnapOperation();
+ break;
+ case NODE_MATH_WRAP:
+ operation = new MathWrapOperation();
+ break;
+ case NODE_MATH_PINGPONG:
+ operation = new MathPingpongOperation();
+ break;
+ case NODE_MATH_COMPARE:
+ operation = new MathCompareOperation();
+ break;
+ case NODE_MATH_MULTIPLY_ADD:
+ operation = new MathMultiplyAddOperation();
+ break;
+ case NODE_MATH_SMOOTH_MIN:
+ operation = new MathSmoothMinOperation();
+ break;
+ case NODE_MATH_SMOOTH_MAX:
+ operation = new MathSmoothMaxOperation();
+ break;
}
if (operation) {
@@ -107,6 +155,7 @@ void MathNode::convertToOperations(NodeConverter &converter,
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
+ converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2));
converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket());
}
}