17 return x *
x *
x * (
x * (
x * 6.0f - 15.0f) + 10.0f);
32 if (from_max != from_min) {
34 switch (
node.range_type) {
37 factor = (value - from_min) / (from_max - from_min);
40 factor = (value - from_min) / (from_max - from_min);
41 factor = (steps > 0.0f) ?
floorf(factor * (steps + 1.0f)) / steps : 0.0f;
45 factor = (from_min > from_max) ? 1.0f -
smoothstep(from_max, from_min, factor) :
50 factor = (from_min > from_max) ? 1.0f -
smootherstep(from_max, from_min, factor) :
55 result = to_min + factor * (to_max - to_min);
80 switch (
node.range_type) {
83 factor =
safe_divide((value - from_min), (from_max - from_min));
86 factor =
safe_divide((value - from_min), (from_max - from_min));
88 (steps.
y > 0.0f) ?
floorf(factor.
y * (steps.
y + 1.0f)) / steps.
y : 0.0f,
89 (steps.
z > 0.0f) ?
floorf(factor.
z * (steps.
z + 1.0f)) / steps.
z :
94 factor =
safe_divide((value - from_min), (from_max - from_min));
96 factor = (
make_float3(3.0f, 3.0f, 3.0f) - 2.0f * factor) * (factor * factor);
100 factor =
safe_divide((value - from_min), (from_max - from_min));
102 factor = factor * factor * factor * (factor * (factor * 6.0f - 15.0f) + 10.0f);
106 result = to_min + factor * (to_max - to_min);
108 result.x = (to_min.
x > to_max.
x) ?
clamp(result.x, to_max.
x, to_min.
x) :
109 clamp(result.x, to_min.
x, to_max.
x);
110 result.y = (to_min.
y > to_max.
y) ?
clamp(result.y, to_max.
y, to_min.
y) :
111 clamp(result.y, to_min.
y, to_max.
y);
112 result.z = (to_min.
z > to_max.
z) ?
clamp(result.z, to_max.
z, to_min.
z) :
113 clamp(result.z, to_min.
z, to_max.
z);
ccl_device_inline void stack_store_float(ccl_private float *stack, const uint a, const float f)
ccl_device_inline void stack_store_float3(ccl_private float *stack, const uint a, const float3 f)
ccl_device_inline T stack_load(const ccl_private float *stack, const uint a)
#define ccl_device_inline
#define ccl_device_noinline
#define CCL_NAMESPACE_END
T smoothstep(T, T, T) RET
constexpr T clamp(T, U, U) RET
float smootherstep(float edge0, float edge1, float x)
float safe_divide(float a, float b)
@ NODE_MAP_RANGE_SMOOTHERSTEP
@ NODE_MAP_RANGE_SMOOTHSTEP
ccl_device_noinline void svm_node_map_range(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeMapRange &ccl_restrict node)
ccl_device_noinline void svm_node_vector_map_range(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeVectorMapRange &ccl_restrict node)
ccl_device_inline float3 one_float3()
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()