hash.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. /// Include <glm/gtx/hash.hpp> to use the features of this extension.
  10. ///
  11. /// Add std::hash support for glm types
  12. #pragma once
  13. #if defined(GLM_FORCE_MESSAGES) && !defined(GLM_EXT_INCLUDED)
  14. # ifndef GLM_ENABLE_EXPERIMENTAL
  15. # pragma message("GLM: GLM_GTX_hash is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.")
  16. # else
  17. # pragma message("GLM: GLM_GTX_hash extension included")
  18. # endif
  19. #endif
  20. #include "../vec2.hpp"
  21. #include "../vec3.hpp"
  22. #include "../vec4.hpp"
  23. #include "../gtc/vec1.hpp"
  24. #include "../gtc/quaternion.hpp"
  25. #include "../gtx/dual_quaternion.hpp"
  26. #include "../mat2x2.hpp"
  27. #include "../mat2x3.hpp"
  28. #include "../mat2x4.hpp"
  29. #include "../mat3x2.hpp"
  30. #include "../mat3x3.hpp"
  31. #include "../mat3x4.hpp"
  32. #include "../mat4x2.hpp"
  33. #include "../mat4x3.hpp"
  34. #include "../mat4x4.hpp"
  35. #if __cplusplus < 201103L
  36. #pragma message("GLM_GTX_hash requires C++11 standard library support")
  37. #endif
  38. #if GLM_LANG & GLM_LANG_CXX11
  39. #define GLM_GTX_hash 1
  40. #include <functional>
  41. namespace std
  42. {
  43. template<typename T, glm::qualifier Q>
  44. struct hash<glm::vec<1, T, Q> >
  45. {
  46. GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT;
  47. };
  48. template<typename T, glm::qualifier Q>
  49. struct hash<glm::vec<2, T, Q> >
  50. {
  51. GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT;
  52. };
  53. template<typename T, glm::qualifier Q>
  54. struct hash<glm::vec<3, T, Q> >
  55. {
  56. GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT;
  57. };
  58. template<typename T, glm::qualifier Q>
  59. struct hash<glm::vec<4, T, Q> >
  60. {
  61. GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT;
  62. };
  63. template<typename T, glm::qualifier Q>
  64. struct hash<glm::qua<T, Q> >
  65. {
  66. GLM_FUNC_DECL size_t operator()(glm::qua<T, Q> const& q) const GLM_NOEXCEPT;
  67. };
  68. template<typename T, glm::qualifier Q>
  69. struct hash<glm::tdualquat<T, Q> >
  70. {
  71. GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const GLM_NOEXCEPT;
  72. };
  73. template<typename T, glm::qualifier Q>
  74. struct hash<glm::mat<2, 2, T, Q> >
  75. {
  76. GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const GLM_NOEXCEPT;
  77. };
  78. template<typename T, glm::qualifier Q>
  79. struct hash<glm::mat<2, 3, T, Q> >
  80. {
  81. GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const GLM_NOEXCEPT;
  82. };
  83. template<typename T, glm::qualifier Q>
  84. struct hash<glm::mat<2, 4, T, Q> >
  85. {
  86. GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const GLM_NOEXCEPT;
  87. };
  88. template<typename T, glm::qualifier Q>
  89. struct hash<glm::mat<3, 2, T, Q> >
  90. {
  91. GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const GLM_NOEXCEPT;
  92. };
  93. template<typename T, glm::qualifier Q>
  94. struct hash<glm::mat<3, 3, T, Q> >
  95. {
  96. GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const GLM_NOEXCEPT;
  97. };
  98. template<typename T, glm::qualifier Q>
  99. struct hash<glm::mat<3, 4, T, Q> >
  100. {
  101. GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const GLM_NOEXCEPT;
  102. };
  103. template<typename T, glm::qualifier Q>
  104. struct hash<glm::mat<4, 2, T, Q> >
  105. {
  106. GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT;
  107. };
  108. template<typename T, glm::qualifier Q>
  109. struct hash<glm::mat<4, 3, T, Q> >
  110. {
  111. GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT;
  112. };
  113. template<typename T, glm::qualifier Q>
  114. struct hash<glm::mat<4, 4, T, Q> >
  115. {
  116. GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const GLM_NOEXCEPT;
  117. };
  118. } // namespace std
  119. #include "hash.inl"
  120. #endif //GLM_LANG & GLM_LANG_CXX11