1 /// @ref gtx_hash 2 /// @file glm/gtx/hash.hpp 3 /// 4 /// @see core (dependence) 5 /// 6 /// @defgroup gtx_hash GLM_GTX_hash 7 /// @ingroup gtx 8 /// 9 /// @brief Add std::hash support for glm types 10 /// 11 /// <glm/gtx/hash.hpp> need to be included to use these functionalities. 12 13 #pragma once 14 15 #include <functional> 16 17 #include "../vec2.hpp" 18 #include "../vec3.hpp" 19 #include "../vec4.hpp" 20 #include "../gtc/vec1.hpp" 21 22 #include "../gtc/quaternion.hpp" 23 #include "../gtx/dual_quaternion.hpp" 24 25 #include "../mat2x2.hpp" 26 #include "../mat2x3.hpp" 27 #include "../mat2x4.hpp" 28 29 #include "../mat3x2.hpp" 30 #include "../mat3x3.hpp" 31 #include "../mat3x4.hpp" 32 33 #include "../mat4x2.hpp" 34 #include "../mat4x3.hpp" 35 #include "../mat4x4.hpp" 36 37 #if !GLM_HAS_CXX11_STL 38 # error "GLM_GTX_hash requires C++11 standard library support" 39 #endif 40 41 namespace std 42 { 43 template <typename T, glm::precision P> 44 struct hash<glm::tvec1<T,P> > 45 { 46 GLM_FUNC_DECL size_t operator()(glm::tvec1<T, P> const & v) const; 47 }; 48 49 template <typename T, glm::precision P> 50 struct hash<glm::tvec2<T,P> > 51 { 52 GLM_FUNC_DECL size_t operator()(glm::tvec2<T, P> const & v) const; 53 }; 54 55 template <typename T, glm::precision P> 56 struct hash<glm::tvec3<T,P> > 57 { 58 GLM_FUNC_DECL size_t operator()(glm::tvec3<T, P> const & v) const; 59 }; 60 61 template <typename T, glm::precision P> 62 struct hash<glm::tvec4<T,P> > 63 { 64 GLM_FUNC_DECL size_t operator()(glm::tvec4<T, P> const & v) const; 65 }; 66 67 template <typename T, glm::precision P> 68 struct hash<glm::tquat<T,P>> 69 { 70 GLM_FUNC_DECL size_t operator()(glm::tquat<T, P> const & q) const; 71 }; 72 73 template <typename T, glm::precision P> 74 struct hash<glm::tdualquat<T,P> > 75 { 76 GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,P> const & q) const; 77 }; 78 79 template <typename T, glm::precision P> 80 struct hash<glm::tmat2x2<T,P> > 81 { 82 GLM_FUNC_DECL size_t operator()(glm::tmat2x2<T,P> const & m) const; 83 }; 84 85 template <typename T, glm::precision P> 86 struct hash<glm::tmat2x3<T,P> > 87 { 88 GLM_FUNC_DECL size_t operator()(glm::tmat2x3<T,P> const & m) const; 89 }; 90 91 template <typename T, glm::precision P> 92 struct hash<glm::tmat2x4<T,P> > 93 { 94 GLM_FUNC_DECL size_t operator()(glm::tmat2x4<T,P> const & m) const; 95 }; 96 97 template <typename T, glm::precision P> 98 struct hash<glm::tmat3x2<T,P> > 99 { 100 GLM_FUNC_DECL size_t operator()(glm::tmat3x2<T,P> const & m) const; 101 }; 102 103 template <typename T, glm::precision P> 104 struct hash<glm::tmat3x3<T,P> > 105 { 106 GLM_FUNC_DECL size_t operator()(glm::tmat3x3<T,P> const & m) const; 107 }; 108 109 template <typename T, glm::precision P> 110 struct hash<glm::tmat3x4<T,P> > 111 { 112 GLM_FUNC_DECL size_t operator()(glm::tmat3x4<T,P> const & m) const; 113 }; 114 115 template <typename T, glm::precision P> 116 struct hash<glm::tmat4x2<T,P> > 117 { 118 GLM_FUNC_DECL size_t operator()(glm::tmat4x2<T,P> const & m) const; 119 }; 120 121 template <typename T, glm::precision P> 122 struct hash<glm::tmat4x3<T,P> > 123 { 124 GLM_FUNC_DECL size_t operator()(glm::tmat4x3<T,P> const & m) const; 125 }; 126 127 template <typename T, glm::precision P> 128 struct hash<glm::tmat4x4<T,P> > 129 { 130 GLM_FUNC_DECL size_t operator()(glm::tmat4x4<T,P> const & m) const; 131 }; 132 } // namespace std 133 134 #include "hash.inl" 135