diff options
author | Johnny Matthews <johnny.matthews@gmail.com> | 2021-12-01 18:36:25 +0300 |
---|---|---|
committer | Johnny Matthews <johnny.matthews@gmail.com> | 2021-12-01 18:36:25 +0300 |
commit | 17578408434fafd2463ed253eebb5cb1412a6c67 (patch) | |
tree | 7052f46de29ed0d7180c00d2a8b64c03c4941995 /source/blender/nodes/NOD_math_functions.hh | |
parent | f8dd03d3dd1b2d7f0ade7c209092212098c75cb4 (diff) |
Geometry Nodes: Generalized Compare Node
Replace compare floats node with a generalized compare node. The node
allows for the comparison of float, int, string, color, and vector.
The datatypes support the following operators:
Float, Int: <, >, <=, >=, ==, !=
String: ==, !=
Color: ==, !=, lighter, darker
(using rgb_to_grayscale value as the brightness value)
Vector Supports 5 comparison modes for: ==, !=, <, >, <=, >=
Average: The average of the components of the vectors are compared.
Dot Product: The dot product of the vectors are compared.
Direction: The angle between the vectors is compared to an angle
Element-wise: The individual components of the vectors are compared.
Length: The lengths of the vectors are compared.
Differential Revision: https://developer.blender.org/D13228
Diffstat (limited to 'source/blender/nodes/NOD_math_functions.hh')
-rw-r--r-- | source/blender/nodes/NOD_math_functions.hh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/nodes/NOD_math_functions.hh b/source/blender/nodes/NOD_math_functions.hh index 86ff8cab3e9..54abc754346 100644 --- a/source/blender/nodes/NOD_math_functions.hh +++ b/source/blender/nodes/NOD_math_functions.hh @@ -204,7 +204,7 @@ inline bool try_dispatch_float_math_fl_fl_fl_to_fl(const int operation, Callback * This is similar to try_dispatch_float_math_fl_to_fl, just with a different callback signature. */ template<typename Callback> -inline bool try_dispatch_float_math_fl_fl_to_bool(const FloatCompareOperation operation, +inline bool try_dispatch_float_math_fl_fl_to_bool(const NodeCompareOperation operation, Callback &&callback) { const FloatMathOperationInfo *info = get_float_compare_operation_info(operation); @@ -219,13 +219,13 @@ inline bool try_dispatch_float_math_fl_fl_to_bool(const FloatCompareOperation op }; switch (operation) { - case NODE_FLOAT_COMPARE_LESS_THAN: + case NODE_COMPARE_LESS_THAN: return dispatch([](float a, float b) { return a < b; }); - case NODE_FLOAT_COMPARE_LESS_EQUAL: + case NODE_COMPARE_LESS_EQUAL: return dispatch([](float a, float b) { return a <= b; }); - case NODE_FLOAT_COMPARE_GREATER_THAN: + case NODE_COMPARE_GREATER_THAN: return dispatch([](float a, float b) { return a > b; }); - case NODE_FLOAT_COMPARE_GREATER_EQUAL: + case NODE_COMPARE_GREATER_EQUAL: return dispatch([](float a, float b) { return a >= b; }); default: return false; |