hash.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. #ifndef GLM_ENABLE_EXPERIMENTAL
  14. # error "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."
  15. #endif
  16. #include <functional>
  17. #include "../vec2.hpp"
  18. #include "../vec3.hpp"
  19. #include "../vec4.hpp"
  20. #include "../gtc/vec1.hpp"
  21. #include "../gtc/quaternion.hpp"
  22. #include "../gtx/dual_quaternion.hpp"
  23. #include "../mat2x2.hpp"
  24. #include "../mat2x3.hpp"
  25. #include "../mat2x4.hpp"
  26. #include "../mat3x2.hpp"
  27. #include "../mat3x3.hpp"
  28. #include "../mat3x4.hpp"
  29. #include "../mat4x2.hpp"
  30. #include "../mat4x3.hpp"
  31. #include "../mat4x4.hpp"
  32. #if !GLM_HAS_CXX11_STL
  33. # error "GLM_GTX_hash requires C++11 standard library support"
  34. #endif
  35. namespace std
  36. {
  37. template<typename T, glm::qualifier Q>
  38. struct hash<glm::vec<1, T,Q> >
  39. {
  40. GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const;
  41. };
  42. template<typename T, glm::qualifier Q>
  43. struct hash<glm::vec<2, T,Q> >
  44. {
  45. GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const;
  46. };
  47. template<typename T, glm::qualifier Q>
  48. struct hash<glm::vec<3, T,Q> >
  49. {
  50. GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const;
  51. };
  52. template<typename T, glm::qualifier Q>
  53. struct hash<glm::vec<4, T,Q> >
  54. {
  55. GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const;
  56. };
  57. template<typename T, glm::qualifier Q>
  58. struct hash<glm::tquat<T,Q>>
  59. {
  60. GLM_FUNC_DECL size_t operator()(glm::tquat<T, Q> const& q) const;
  61. };
  62. template<typename T, glm::qualifier Q>
  63. struct hash<glm::tdualquat<T,Q> >
  64. {
  65. GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const;
  66. };
  67. template<typename T, glm::qualifier Q>
  68. struct hash<glm::mat<2, 2, T,Q> >
  69. {
  70. GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const;
  71. };
  72. template<typename T, glm::qualifier Q>
  73. struct hash<glm::mat<2, 3, T,Q> >
  74. {
  75. GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const;
  76. };
  77. template<typename T, glm::qualifier Q>
  78. struct hash<glm::mat<2, 4, T,Q> >
  79. {
  80. GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const;
  81. };
  82. template<typename T, glm::qualifier Q>
  83. struct hash<glm::mat<3, 2, T,Q> >
  84. {
  85. GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const;
  86. };
  87. template<typename T, glm::qualifier Q>
  88. struct hash<glm::mat<3, 3, T,Q> >
  89. {
  90. GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const;
  91. };
  92. template<typename T, glm::qualifier Q>
  93. struct hash<glm::mat<3, 4, T,Q> >
  94. {
  95. GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const;
  96. };
  97. template<typename T, glm::qualifier Q>
  98. struct hash<glm::mat<4, 2, T,Q> >
  99. {
  100. GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const;
  101. };
  102. template<typename T, glm::qualifier Q>
  103. struct hash<glm::mat<4, 3, T,Q> >
  104. {
  105. GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const;
  106. };
  107. template<typename T, glm::qualifier Q>
  108. struct hash<glm::mat<4, 4, T,Q> >
  109. {
  110. GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const;
  111. };
  112. } // namespace std
  113. #include "hash.inl"