58 template<
typename Callback>
62 if (info ==
nullptr) {
67 auto dispatch = [&](
auto math_function) ->
bool {
74 return dispatch([](
float a) {
return expf(
a); });
80 return dispatch([](
float a) {
return fabs(
a); });
82 return dispatch([](
float a) {
return (
float)
DEG2RAD(
a); });
84 return dispatch([](
float a) {
return (
float)
RAD2DEG(
a); });
88 return dispatch([](
float a) {
return floorf(
a + 0.5f); });
90 return dispatch([](
float a) {
return floorf(
a); });
92 return dispatch([](
float a) {
return ceilf(
a); });
94 return dispatch([](
float a) {
return a -
floorf(
a); });
96 return dispatch([](
float a) {
return a >= 0.0f ?
floorf(
a) :
ceilf(
a); });
98 return dispatch([](
float a) {
return sinf(
a); });
100 return dispatch([](
float a) {
return cosf(
a); });
102 return dispatch([](
float a) {
return tanf(
a); });
104 return dispatch([](
float a) {
return sinhf(
a); });
106 return dispatch([](
float a) {
return coshf(
a); });
108 return dispatch([](
float a) {
return tanhf(
a); });
114 return dispatch([](
float a) {
return atanf(
a); });
122 template<
typename Callback>
126 if (info ==
nullptr) {
131 auto dispatch = [&](
auto math_function) ->
bool {
138 return dispatch([](
float a,
float b) {
return a + b; });
140 return dispatch([](
float a,
float b) {
return a - b; });
142 return dispatch([](
float a,
float b) {
return a * b; });
144 return dispatch([](
float a,
float b) {
return safe_divide(
a, b); });
146 return dispatch([](
float a,
float b) {
return safe_powf(
a, b); });
148 return dispatch([](
float a,
float b) {
return safe_logf(
a, b); });
150 return dispatch([](
float a,
float b) {
return std::min(
a, b); });
152 return dispatch([](
float a,
float b) {
return std::max(
a, b); });
154 return dispatch([](
float a,
float b) {
return (
float)(
a < b); });
156 return dispatch([](
float a,
float b) {
return (
float)(
a > b); });
158 return dispatch([](
float a,
float b) {
return safe_modf(
a, b); });
162 return dispatch([](
float a,
float b) {
return atan2f(
a, b); });
164 return dispatch([](
float a,
float b) {
return pingpongf(
a, b); });
172 template<
typename Callback>
176 if (info ==
nullptr) {
181 auto dispatch = [&](
auto math_function) ->
bool {
188 return dispatch([](
float a,
float b,
float c) {
return a * b +
c; });
190 return dispatch([](
float a,
float b,
float c) ->
float {
191 return ((
a == b) || (
fabsf(
a - b) <=
fmaxf(
c, FLT_EPSILON))) ? 1.0f : 0.0f;
194 return dispatch([](
float a,
float b,
float c) {
return smoothminf(
a, b,
c); });
196 return dispatch([](
float a,
float b,
float c) {
return -
smoothminf(-
a, -b, -
c); });
198 return dispatch([](
float a,
float b,
float c) {
return wrapf(
a, b,
c); });
206 template<
typename Callback>
211 if (info ==
nullptr) {
216 auto dispatch = [&](
auto math_function) ->
bool {
223 return dispatch([](
float a,
float b) {
return a < b; });
225 return dispatch([](
float a,
float b) {
return a <= b; });
227 return dispatch([](
float a,
float b) {
return a > b; });
229 return dispatch([](
float a,
float b) {
return a >= b; });
239 template<
typename Callback>
244 if (info ==
nullptr) {
249 auto dispatch = [&](
auto math_function) ->
bool {
270 return (length_squared != 0.0) ? (
float3::dot(
a, b) / length_squared) * b :
float3(0.0f);
275 return a.reflected(b);
305 template<
typename Callback>
310 if (info ==
nullptr) {
315 auto dispatch = [&](
auto math_function) ->
bool {
334 template<
typename Callback>
339 if (info ==
nullptr) {
344 auto dispatch = [&](
auto math_function) ->
bool {
365 template<
typename Callback>
370 if (info ==
nullptr) {
375 auto dispatch = [&](
auto math_function) ->
bool {
393 template<
typename Callback>
398 if (info ==
nullptr) {
403 auto dispatch = [&](
auto math_function) ->
bool {
420 template<
typename Callback>
425 if (info ==
nullptr) {
430 auto dispatch = [&](
auto math_function) ->
bool {
437 return dispatch([](
float3 a,
float b) {
return a * b; });
447 template<
typename Callback>
452 if (info ==
nullptr) {
457 auto dispatch = [&](
auto math_function) ->
bool {
464 return dispatch([](
float3 in) {
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
MINLINE float safe_sqrtf(float a)
MINLINE float safe_logf(float a, float base)
MINLINE float safe_acosf(float a)
MINLINE float safe_modf(float a, float b)
MINLINE float safe_powf(float base, float exponent)
MINLINE float safe_divide(float a, float b)
MINLINE float safe_asinf(float a)
MINLINE float safe_inverse_sqrtf(float a)
@ NODE_VECTOR_MATH_NORMALIZE
@ NODE_VECTOR_MATH_LENGTH
@ NODE_VECTOR_MATH_CROSS_PRODUCT
@ NODE_VECTOR_MATH_MODULO
@ NODE_VECTOR_MATH_COSINE
@ NODE_VECTOR_MATH_REFLECT
@ NODE_VECTOR_MATH_REFRACT
@ NODE_VECTOR_MATH_DOT_PRODUCT
@ NODE_VECTOR_MATH_ABSOLUTE
@ NODE_VECTOR_MATH_DIVIDE
@ NODE_VECTOR_MATH_TANGENT
@ NODE_VECTOR_MATH_DISTANCE
@ NODE_VECTOR_MATH_FRACTION
@ NODE_VECTOR_MATH_PROJECT
@ NODE_VECTOR_MATH_MULTIPLY
@ NODE_VECTOR_MATH_MAXIMUM
@ NODE_VECTOR_MATH_FACEFORWARD
@ NODE_VECTOR_MATH_SUBTRACT
@ NODE_VECTOR_MATH_MINIMUM
@ NODE_FLOAT_COMPARE_GREATER_THAN
@ NODE_FLOAT_COMPARE_GREATER_EQUAL
@ NODE_FLOAT_COMPARE_LESS_EQUAL
@ NODE_FLOAT_COMPARE_LESS_THAN
DEGForeachIDComponentCallback callback
MINLINE float smoothminf(float a, float b, float c)
MINLINE float pingpongf(float value, float scale)
MINLINE float compatible_signf(float f)
MINLINE float wrapf(float value, float max, float min)
bool try_dispatch_float_math_fl_fl_to_bool(const FloatCompareOperation operation, Callback &&callback)
bool try_dispatch_float_math_fl_fl_to_fl(const int operation, Callback &&callback)
bool try_dispatch_float_math_fl3_fl3_to_fl3(const NodeVectorMathOperation operation, Callback &&callback)
bool try_dispatch_float_math_fl3_to_fl(const NodeVectorMathOperation operation, Callback &&callback)
const FloatMathOperationInfo * get_float3_math_operation_info(const int operation)
bool try_dispatch_float_math_fl3_fl3_to_fl(const NodeVectorMathOperation operation, Callback &&callback)
bool try_dispatch_float_math_fl_to_fl(const int operation, Callback &&callback)
const FloatMathOperationInfo * get_float_compare_operation_info(const int operation)
const FloatMathOperationInfo * get_float_math_operation_info(const int operation)
bool try_dispatch_float_math_fl3_fl_to_fl3(const NodeVectorMathOperation operation, Callback &&callback)
bool try_dispatch_float_math_fl3_fl3_fl_to_fl3(const NodeVectorMathOperation operation, Callback &&callback)
bool try_dispatch_float_math_fl3_to_fl3(const NodeVectorMathOperation operation, Callback &&callback)
bool try_dispatch_float_math_fl_fl_fl_to_fl(const int operation, Callback &&callback)
bool try_dispatch_float_math_fl3_fl3_fl3_to_fl3(const NodeVectorMathOperation operation, Callback &&callback)
static float3 cross_high_precision(const float3 &a, const float3 &b)
float3 normalized() const
static float3 abs(const float3 &a)
static float dot(const float3 &a, const float3 &b)
static float3 faceforward(const float3 &vector, const float3 &incident, const float3 &reference)
static float distance(const float3 &a, const float3 &b)
static float3 refract(const float3 &incident, const float3 &normal, const float eta)
StringRefNull shader_name
StringRefNull title_case_name
FloatMathOperationInfo()=delete
FloatMathOperationInfo(StringRefNull title_case_name, StringRefNull shader_name)
ccl_device_inline float2 floor(const float2 &a)
ccl_device_inline float2 fabs(const float2 &a)
ccl_device_inline float3 ceil(const float3 &a)