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 <mistajolly@gmail.com>2018-07-13 00:40:18 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-13 12:00:10 +0300
commit30bffb5a3afa2fde165d4fb63a115310d5ddc3e3 (patch)
tree543109969a99e176340071dfdf85a87594f0db07 /intern/cycles/kernel/svm
parentf4213c1408619d1071004247ed099e2ba98a3e9a (diff)
Nodes: add sqrt, ceil, floor and fract to math nodes.
This works for Cycles, Eevee, texture nodes and compositing. It helps to reduce the number of math nodes required in various node setups. Differential Revision: https://developer.blender.org/D3537
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r--intern/cycles/kernel/svm/svm_math_util.h8
-rw-r--r--intern/cycles/kernel/svm/svm_types.h4
2 files changed, 12 insertions, 0 deletions
diff --git a/intern/cycles/kernel/svm/svm_math_util.h b/intern/cycles/kernel/svm/svm_math_util.h
index 04864bd610a..d3490ab284f 100644
--- a/intern/cycles/kernel/svm/svm_math_util.h
+++ b/intern/cycles/kernel/svm/svm_math_util.h
@@ -94,6 +94,14 @@ ccl_device float svm_math(NodeMath type, float Fac1, float Fac2)
Fac = fabsf(Fac1);
else if(type == NODE_MATH_ARCTAN2)
Fac = atan2f(Fac1, Fac2);
+ else if (type == NODE_MATH_FLOOR)
+ Fac = floorf(Fac1);
+ else if (type == NODE_MATH_CEIL)
+ Fac = ceilf(Fac1);
+ else if (type == NODE_MATH_FRACT)
+ Fac = Fac1 - floorf(Fac1);
+ else if (type == NODE_MATH_SQRT)
+ Fac = safe_sqrtf(Fac1);
else if(type == NODE_MATH_CLAMP)
Fac = saturate(Fac1);
else
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index b94a83b6712..0fde5126434 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -261,6 +261,10 @@ typedef enum NodeMath {
NODE_MATH_MODULO,
NODE_MATH_ABSOLUTE,
NODE_MATH_ARCTAN2,
+ NODE_MATH_FLOOR,
+ NODE_MATH_CEIL,
+ NODE_MATH_FRACT,
+ NODE_MATH_SQRT,
NODE_MATH_CLAMP /* used for the clamp UI option */
} NodeMath;