From fb6bd8864411ee27db05ceadcb80f690f44e48dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 12 Jan 2022 12:49:36 +0100 Subject: Revert "BLI: Refactor vector types & functions to use templates" Includes unwanted changes This reverts commit 46e049d0ce2bce2f53ddc41a0dbbea2969d00a5d. --- .../blender/nodes/function/node_function_util.hh | 2 +- .../nodes/node_fn_align_euler_to_vector.cc | 8 ++++---- .../nodes/function/nodes/node_fn_compare.cc | 24 +++++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'source/blender/nodes/function') diff --git a/source/blender/nodes/function/node_function_util.hh b/source/blender/nodes/function/node_function_util.hh index 69c617b4f01..acde9c4b55b 100644 --- a/source/blender/nodes/function/node_function_util.hh +++ b/source/blender/nodes/function/node_function_util.hh @@ -18,7 +18,7 @@ #include -#include "BLI_math_vec_types.hh" +#include "BLI_float3.hh" #include "BLI_utildefines.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc b/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc index bcc035e6ede..f4ce8d2f35a 100644 --- a/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc +++ b/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc @@ -69,14 +69,14 @@ static void align_rotations_auto_pivot(IndexMask mask, float3 old_axis; mul_v3_m3v3(old_axis, old_rotation, local_main_axis); - const float3 new_axis = math::normalize(vector); - float3 rotation_axis = math::cross_high_precision(old_axis, new_axis); + const float3 new_axis = vector.normalized(); + float3 rotation_axis = float3::cross_high_precision(old_axis, new_axis); if (is_zero_v3(rotation_axis)) { /* The vectors are linearly dependent, so we fall back to another axis. */ - rotation_axis = math::cross_high_precision(old_axis, float3(1, 0, 0)); + rotation_axis = float3::cross_high_precision(old_axis, float3(1, 0, 0)); if (is_zero_v3(rotation_axis)) { /* This is now guaranteed to not be zero. */ - rotation_axis = math::cross_high_precision(old_axis, float3(0, 1, 0)); + rotation_axis = float3::cross_high_precision(old_axis, float3(0, 1, 0)); } } diff --git a/source/blender/nodes/function/nodes/node_fn_compare.cc b/source/blender/nodes/function/nodes/node_fn_compare.cc index 7c09bace756..3bb46511eeb 100644 --- a/source/blender/nodes/function/nodes/node_fn_compare.cc +++ b/source/blender/nodes/function/nodes/node_fn_compare.cc @@ -265,7 +265,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_DOT_PRODUCT: { static fn::CustomMF_SI_SI_SI_SO fn{ "Less Than - Dot Product", - [](float3 a, float3 b, float comp) { return math::dot(a, b) < comp; }}; + [](float3 a, float3 b, float comp) { return float3::dot(a, b) < comp; }}; return &fn; } case NODE_COMPARE_MODE_DIRECTION: { @@ -283,7 +283,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_LENGTH: { static fn::CustomMF_SI_SI_SO fn{ "Less Than - Length", - [](float3 a, float3 b) { return math::length(a) < math::length(b); }}; + [](float3 a, float3 b) { return a.length() < b.length(); }}; return &fn; } } @@ -299,7 +299,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_DOT_PRODUCT: { static fn::CustomMF_SI_SI_SI_SO fn{ "Less Equal - Dot Product", - [](float3 a, float3 b, float comp) { return math::dot(a, b) <= comp; }}; + [](float3 a, float3 b, float comp) { return float3::dot(a, b) <= comp; }}; return &fn; } case NODE_COMPARE_MODE_DIRECTION: { @@ -317,7 +317,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_LENGTH: { static fn::CustomMF_SI_SI_SO fn{ "Less Equal - Length", - [](float3 a, float3 b) { return math::length(a) <= math::length(b); }}; + [](float3 a, float3 b) { return a.length() <= b.length(); }}; return &fn; } } @@ -333,7 +333,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_DOT_PRODUCT: { static fn::CustomMF_SI_SI_SI_SO fn{ "Greater Than - Dot Product", - [](float3 a, float3 b, float comp) { return math::dot(a, b) > comp; }}; + [](float3 a, float3 b, float comp) { return float3::dot(a, b) > comp; }}; return &fn; } case NODE_COMPARE_MODE_DIRECTION: { @@ -351,7 +351,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_LENGTH: { static fn::CustomMF_SI_SI_SO fn{ "Greater Than - Length", - [](float3 a, float3 b) { return math::length(a) > math::length(b); }}; + [](float3 a, float3 b) { return a.length() > b.length(); }}; return &fn; } } @@ -367,7 +367,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_DOT_PRODUCT: { static fn::CustomMF_SI_SI_SI_SO fn{ "Greater Equal - Dot Product", - [](float3 a, float3 b, float comp) { return math::dot(a, b) >= comp; }}; + [](float3 a, float3 b, float comp) { return float3::dot(a, b) >= comp; }}; return &fn; } case NODE_COMPARE_MODE_DIRECTION: { @@ -385,7 +385,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_LENGTH: { static fn::CustomMF_SI_SI_SO fn{ "Greater Equal - Length", - [](float3 a, float3 b) { return math::length(a) >= math::length(b); }}; + [](float3 a, float3 b) { return a.length() >= b.length(); }}; return &fn; } } @@ -402,7 +402,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_DOT_PRODUCT: { static fn::CustomMF_SI_SI_SI_SI_SO fn{ "Equal - Dot Product", [](float3 a, float3 b, float comp, float epsilon) { - return abs(math::dot(a, b) - comp) <= epsilon; + return abs(float3::dot(a, b) - comp) <= epsilon; }}; return &fn; } @@ -424,7 +424,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_LENGTH: { static fn::CustomMF_SI_SI_SI_SO fn{ "Equal - Length", [](float3 a, float3 b, float epsilon) { - return abs(math::length(a) - math::length(b)) <= epsilon; + return abs(a.length() - b.length()) <= epsilon; }}; return &fn; } @@ -442,7 +442,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_DOT_PRODUCT: { static fn::CustomMF_SI_SI_SI_SI_SO fn{ "Not Equal - Dot Product", [](float3 a, float3 b, float comp, float epsilon) { - return abs(math::dot(a, b) - comp) >= epsilon; + return abs(float3::dot(a, b) - comp) >= epsilon; }}; return &fn; } @@ -464,7 +464,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node) case NODE_COMPARE_MODE_LENGTH: { static fn::CustomMF_SI_SI_SI_SO fn{ "Not Equal - Length", [](float3 a, float3 b, float epsilon) { - return abs(math::length(a) - math::length(b)) > epsilon; + return abs(a.length() - b.length()) > epsilon; }}; return &fn; } -- cgit v1.2.3