diff --git a/include/omath/linear_algebra/mat.hpp b/include/omath/linear_algebra/mat.hpp index b926edd8..a2721188 100644 --- a/include/omath/linear_algebra/mat.hpp +++ b/include/omath/linear_algebra/mat.hpp @@ -666,8 +666,7 @@ namespace omath } template [[nodiscard]] - Mat<4, 4, Type, St> mat_ortho_left_handed(const Type left, const Type right, - const Type bottom, const Type top, + Mat<4, 4, Type, St> mat_ortho_left_handed(const Type left, const Type right, const Type bottom, const Type top, const Type near, const Type far) noexcept { return @@ -680,9 +679,8 @@ namespace omath } template [[nodiscard]] - Mat<4, 4, Type, St> mat_ortho_right_handed(const Type left, const Type right, - const Type bottom, const Type top, - const Type near, const Type far) noexcept + Mat<4, 4, Type, St> mat_ortho_right_handed(const Type left, const Type right, const Type bottom, const Type top, + const Type near, const Type far) noexcept { return { diff --git a/include/omath/linear_algebra/vector2.hpp b/include/omath/linear_algebra/vector2.hpp index 4dc96c77..2994144a 100644 --- a/include/omath/linear_algebra/vector2.hpp +++ b/include/omath/linear_algebra/vector2.hpp @@ -234,6 +234,21 @@ namespace omath }; } // namespace omath +template<> struct std::hash> +{ + [[nodiscard]] + std::size_t operator()(const omath::Vector2& vec) const noexcept + { + std::size_t hash = 0; + constexpr std::hash hasher; + + hash ^= hasher(vec.x) + 0x9e3779b9 + (hash << 6) + (hash >> 2); + hash ^= hasher(vec.y) + 0x9e3779b9 + (hash << 6) + (hash >> 2); + + return hash; + } +}; + template struct std::formatter> // NOLINT(*-dcl58-cpp) { diff --git a/include/omath/linear_algebra/vector3.hpp b/include/omath/linear_algebra/vector3.hpp index 7e5838f3..77d60cfb 100644 --- a/include/omath/linear_algebra/vector3.hpp +++ b/include/omath/linear_algebra/vector3.hpp @@ -273,6 +273,7 @@ namespace omath template<> struct std::hash> { + [[nodiscard]] std::size_t operator()(const omath::Vector3& vec) const noexcept { std::size_t hash = 0; diff --git a/include/omath/linear_algebra/vector4.hpp b/include/omath/linear_algebra/vector4.hpp index d1e13772..25d6a6de 100644 --- a/include/omath/linear_algebra/vector4.hpp +++ b/include/omath/linear_algebra/vector4.hpp @@ -202,6 +202,22 @@ namespace omath }; } // namespace omath +template<> struct std::hash> +{ + [[nodiscard]] + std::size_t operator()(const omath::Vector4& vec) const noexcept + { + std::size_t hash = 0; + constexpr std::hash hasher; + + hash ^= hasher(vec.x) + 0x9e3779b9 + (hash << 6) + (hash >> 2); + hash ^= hasher(vec.y) + 0x9e3779b9 + (hash << 6) + (hash >> 2); + hash ^= hasher(vec.z) + 0x9e3779b9 + (hash << 6) + (hash >> 2); + hash ^= hasher(vec.w) + 0x9e3779b9 + (hash << 6) + (hash >> 2); + return hash; + } +}; + template struct std::formatter> // NOLINT(*-dcl58-cpp) {