Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-02-15 19:27:03 +0300
committerHans Goudey <h.goudey@me.com>2022-02-15 19:27:03 +0300
commita9f023e226389461b1140f80e62f650d009a06a5 (patch)
tree2d3b860bf5d5996e77b102673bd0cbaef4d15f26 /source/blender/blenlib/BLI_math_vector.hh
parent3ed3ee253b12fe4d481357386650a13de244caf9 (diff)
BLI: Change dependencies in vector math files
This patch reverses the dependency between `BLI_math_vec_types.hh` and `BLI_math_vector.hh`. Now the higher level `blender::math` functions depend on the header that defines the types they work with, rather than the other way around. The initial goal was to allow defining an `enable_if` in the types header and using it in the math header. But I also think this operations to types dependency is more natural anyway. This required changing the includes some files used from the type header to the math implementation header. I took that change a bit further removing the C vector math header from the C++ header; I think that helps to make the transition between the two systems clearer. Differential Revision: https://developer.blender.org/D14112
Diffstat (limited to 'source/blender/blenlib/BLI_math_vector.hh')
-rw-r--r--source/blender/blenlib/BLI_math_vector.hh30
1 files changed, 1 insertions, 29 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.hh b/source/blender/blenlib/BLI_math_vector.hh
index 930f3b62fa5..d2ef2a1c5c8 100644
--- a/source/blender/blenlib/BLI_math_vector.hh
+++ b/source/blender/blenlib/BLI_math_vector.hh
@@ -11,7 +11,7 @@
#include <type_traits>
#include "BLI_math_base_safe.h"
-#include "BLI_math_vector.h"
+#include "BLI_math_vec_types.hh"
#include "BLI_span.hh"
#include "BLI_utildefines.h"
@@ -55,16 +55,6 @@ template<typename T> inline bool is_zero(const T &a)
return true;
}
-template<typename T> inline bool is_any_zero(const T &a)
-{
- for (int i = 0; i < T::type_length; i++) {
- if (a[i] == bT(0)) {
- return true;
- }
- }
- return false;
-}
-
template<typename T> inline T abs(const T &a)
{
T result;
@@ -241,24 +231,6 @@ template<typename T, BLI_ENABLE_IF_FLT_VEC(T)> inline bT distance(const T &a, co
return length(a - b);
}
-template<typename T> uint64_t vector_hash(const T &vec)
-{
- BLI_STATIC_ASSERT(T::type_length <= 4, "Longer types need to implement vector_hash themself.");
- const typename T::uint_type &uvec = *reinterpret_cast<const typename T::uint_type *>(&vec);
- uint64_t result;
- result = uvec[0] * uint64_t(435109);
- if constexpr (T::type_length > 1) {
- result ^= uvec[1] * uint64_t(380867);
- }
- if constexpr (T::type_length > 2) {
- result ^= uvec[2] * uint64_t(1059217);
- }
- if constexpr (T::type_length > 3) {
- result ^= uvec[3] * uint64_t(2002613);
- }
- return result;
-}
-
template<typename T, BLI_ENABLE_IF_FLT_VEC(T)> inline T reflect(const T &incident, const T &normal)
{
BLI_ASSERT_UNIT(normal);