From 30bffb5a3afa2fde165d4fb63a115310d5ddc3e3 Mon Sep 17 00:00:00 2001 From: Charlie Jolly Date: Thu, 12 Jul 2018 23:40:18 +0200 Subject: 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 --- intern/cycles/kernel/svm/svm_math_util.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'intern/cycles/kernel/svm/svm_math_util.h') 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 -- cgit v1.2.3