32
32
#define HASHFUNCS_H
33
33
34
34
#include " core/math/aabb.h"
35
+ #include " core/math/color.h"
35
36
#include " core/math/math_defs.h"
36
37
#include " core/math/math_funcs.h"
38
+ #include " core/math/quaternion.h"
37
39
#include " core/math/rect2.h"
38
40
#include " core/math/rect2i.h"
39
41
#include " core/math/vector2.h"
@@ -413,6 +415,13 @@ struct HashMapComparatorDefault<double> {
413
415
}
414
416
};
415
417
418
+ template <>
419
+ struct HashMapComparatorDefault <Color> {
420
+ static bool compare (const Color &p_lhs, const Color &p_rhs) {
421
+ return ((p_lhs.r == p_rhs.r ) || (Math::is_nan (p_lhs.r ) && Math::is_nan (p_rhs.r ))) && ((p_lhs.g == p_rhs.g ) || (Math::is_nan (p_lhs.g ) && Math::is_nan (p_rhs.g ))) && ((p_lhs.b == p_rhs.b ) || (Math::is_nan (p_lhs.b ) && Math::is_nan (p_rhs.b ))) && ((p_lhs.a == p_rhs.a ) || (Math::is_nan (p_lhs.a ) && Math::is_nan (p_rhs.a )));
422
+ }
423
+ };
424
+
416
425
template <>
417
426
struct HashMapComparatorDefault <Vector2> {
418
427
static bool compare (const Vector2 &p_lhs, const Vector2 &p_rhs) {
@@ -427,6 +436,20 @@ struct HashMapComparatorDefault<Vector3> {
427
436
}
428
437
};
429
438
439
+ template <>
440
+ struct HashMapComparatorDefault <Vector4> {
441
+ static bool compare (const Vector4 &p_lhs, const Vector4 &p_rhs) {
442
+ return ((p_lhs.x == p_rhs.x ) || (Math::is_nan (p_lhs.x ) && Math::is_nan (p_rhs.x ))) && ((p_lhs.y == p_rhs.y ) || (Math::is_nan (p_lhs.y ) && Math::is_nan (p_rhs.y ))) && ((p_lhs.z == p_rhs.z ) || (Math::is_nan (p_lhs.z ) && Math::is_nan (p_rhs.z ))) && ((p_lhs.w == p_rhs.w ) || (Math::is_nan (p_lhs.w ) && Math::is_nan (p_rhs.w )));
443
+ }
444
+ };
445
+
446
+ template <>
447
+ struct HashMapComparatorDefault <Quaternion> {
448
+ static bool compare (const Quaternion &p_lhs, const Quaternion &p_rhs) {
449
+ return ((p_lhs.x == p_rhs.x ) || (Math::is_nan (p_lhs.x ) && Math::is_nan (p_rhs.x ))) && ((p_lhs.y == p_rhs.y ) || (Math::is_nan (p_lhs.y ) && Math::is_nan (p_rhs.y ))) && ((p_lhs.z == p_rhs.z ) || (Math::is_nan (p_lhs.z ) && Math::is_nan (p_rhs.z ))) && ((p_lhs.w == p_rhs.w ) || (Math::is_nan (p_lhs.w ) && Math::is_nan (p_rhs.w )));
450
+ }
451
+ };
452
+
430
453
constexpr uint32_t HASH_TABLE_SIZE_MAX = 29 ;
431
454
432
455
inline constexpr uint32_t hash_table_size_primes[HASH_TABLE_SIZE_MAX] = {
0 commit comments