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:
-rw-r--r--source/blender/blenlib/BLI_float2.hh7
-rw-r--r--source/blender/functions/intern/cpp_types.cc1
2 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh
index 1290eb6c65c..d41c4d262d3 100644
--- a/source/blender/blenlib/BLI_float2.hh
+++ b/source/blender/blenlib/BLI_float2.hh
@@ -80,6 +80,13 @@ struct float2 {
return *this;
}
+ uint64_t hash() const
+ {
+ uint64_t x1 = *reinterpret_cast<const uint32_t *>(&x);
+ uint64_t x2 = *reinterpret_cast<const uint32_t *>(&y);
+ return (x1 * 812519) ^ (x2 * 707951);
+ }
+
friend float2 operator+(const float2 &a, const float2 &b)
{
return {a.x + b.x, a.y + b.y};
diff --git a/source/blender/functions/intern/cpp_types.cc b/source/blender/functions/intern/cpp_types.cc
index 3bf4683d815..35d93f997cb 100644
--- a/source/blender/functions/intern/cpp_types.cc
+++ b/source/blender/functions/intern/cpp_types.cc
@@ -26,6 +26,7 @@ namespace blender::fn {
MAKE_CPP_TYPE(bool, bool)
MAKE_CPP_TYPE(float, float)
+MAKE_CPP_TYPE(float2, blender::float2)
MAKE_CPP_TYPE(float3, blender::float3)
MAKE_CPP_TYPE(float4x4, blender::float4x4)