17 const int mode =
node.custom1;
27 const mf::MultiFunction &fn_;
37 fn_.call(
mask, params, context);
42 MutableSpan<float> results = params.uninitialized_single_output<
float>(output_param_index);
44 mask.foreach_index_optimized<
int>([&](
const int i) {
45 float &value = results[i];
46 CLAMP(value, 0.0f, 1.0f);
52 static constexpr int8_t id = 0;
54 fn_.hash_unique(
hash);
62 const bool clamp_output = builder.
node().
custom2 != 0;
73#define RETURN_OPERATION_INFO(title_case_name, shader_name, multi_function_name) \
75 static const FloatMathOperationInfo info{title_case_name, shader_name, multi_function_name}; \
119 "Floored Modulo",
"math_floored_modulo",
"floor_mod(float, float)"_ustr);
162 "Smooth Min",
"math_smoothmin",
"smooth_min(float, float, float)"_ustr);
165 "Smooth Max",
"math_smoothmax",
"smooth_max(float, float, float)"_ustr);
168#undef RETURN_OPERATION_INFO
176#define RETURN_OPERATION_INFO(title_case_name, shader_name) \
178 static const FloatMathOperationInfo info{title_case_name, shader_name}; \
198#undef RETURN_OPERATION_INFO
206#define RETURN_OPERATION_INFO(title_case_name, shader_name, multi_function_name) \
208 static const FloatMathOperationInfo info{title_case_name, shader_name, multi_function_name}; \
224 "Cross Product",
"vector_math_cross",
"cross_product(float3, float3)"_ustr);
267 "Refract",
"vector_math_refract",
"refract(float3, float3, float)"_ustr);
270 "Faceforward",
"vector_math_faceforward",
"faceforward(float3, float3, float3)"_ustr);
273 "Multiply Add",
"vector_math_multiply_add",
"float3 * float3 + float3"_ustr);
280#undef RETURN_OPERATION_INFO
void set_signature(const Signature *signature)
void call(const IndexMask &mask, mf::Params params, mf::Context context) const override
ClampWrapperFunction(const mf::MultiFunction &fn)
void hash_unique(UniqueHashBytes &hash) const override
void set_matching_fn(const mf::MultiFunction *fn)
void construct_and_set_matching_fn(Args &&...args)
#define RETURN_OPERATION_INFO(title_case_name, shader_name, multi_function_name)
const MultiFunction & lookup(UString id)
void node_math_build_multi_function(NodeMultiFunctionBuilder &builder)
const FloatMathOperationInfo * get_float3_math_operation_info(const int operation)
static const mf::MultiFunction * get_base_multi_function(const bNode &node)
const FloatMathOperationInfo * get_float_compare_operation_info(const int operation)
const FloatMathOperationInfo * get_float_math_operation_info(const int operation)
@ NODE_MATH_FLOORED_MODULO
@ NODE_COMPARE_LESS_EQUAL
@ NODE_COMPARE_GREATER_EQUAL
@ NODE_COMPARE_GREATER_THAN
@ NODE_VECTOR_MATH_COSINE
@ NODE_VECTOR_MATH_MAXIMUM
@ NODE_VECTOR_MATH_MINIMUM
@ NODE_VECTOR_MATH_MULTIPLY_ADD
@ NODE_VECTOR_MATH_REFLECT
@ NODE_VECTOR_MATH_TANGENT
@ NODE_VECTOR_MATH_PROJECT
@ NODE_VECTOR_MATH_CROSS_PRODUCT
@ NODE_VECTOR_MATH_DIVIDE
@ NODE_VECTOR_MATH_NORMALIZE
@ NODE_VECTOR_MATH_SUBTRACT
@ NODE_VECTOR_MATH_DOT_PRODUCT
@ NODE_VECTOR_MATH_DISTANCE
@ NODE_VECTOR_MATH_LENGTH
@ NODE_VECTOR_MATH_MODULO
@ NODE_VECTOR_MATH_FRACTION
@ NODE_VECTOR_MATH_FACEFORWARD
@ NODE_VECTOR_MATH_REFRACT
@ NODE_VECTOR_MATH_MULTIPLY
@ NODE_VECTOR_MATH_ABSOLUTE
UString multi_function_name