master
ブランチ master
VulkanExample / dep / include / glm / gtx / hash.hpp
4.1 KB、156行 生 Blame 履歴
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
13#pragma once
14
15#if defined(GLM_FORCE_MESSAGES) && !defined(GLM_EXT_INCLUDED)
16# ifndef GLM_ENABLE_EXPERIMENTAL
17# 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.")
18# else
19# pragma message("GLM: GLM_GTX_hash extension included")
20# endif
21#endif
22
23#include "../vec2.hpp"
24#include "../vec3.hpp"
25#include "../vec4.hpp"
26#include "../gtc/vec1.hpp"
27
28#include "../gtc/quaternion.hpp"
29#include "../gtx/dual_quaternion.hpp"
30
31#include "../mat2x2.hpp"
32#include "../mat2x3.hpp"
33#include "../mat2x4.hpp"
34
35#include "../mat3x2.hpp"
36#include "../mat3x3.hpp"
37#include "../mat3x4.hpp"
38
39#include "../mat4x2.hpp"
40#include "../mat4x3.hpp"
41#include "../mat4x4.hpp"
42
43#if defined(_MSC_VER)
44 // MSVC uses _MSVC_LANG instead of __cplusplus
45 #if _MSVC_LANG < 201103L
46 #pragma message("GLM_GTX_hash requires C++11 standard library support")
47 #endif
48#elif defined(__GNUC__) || defined(__clang__)
49 // GNU and Clang use __cplusplus
50 #if __cplusplus < 201103L
51 #pragma message("GLM_GTX_hash requires C++11 standard library support")
52 #endif
53#else
54 #error "Unknown compiler"
55#endif
56
57#if GLM_LANG & GLM_LANG_CXX11
58#define GLM_GTX_hash 1
59#include <functional>
60
61namespace std
62{
63 template<typename T, glm::qualifier Q>
64 struct hash<glm::vec<1, T, Q> >
65 {
66 GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const noexcept;
67 };
68
69 template<typename T, glm::qualifier Q>
70 struct hash<glm::vec<2, T, Q> >
71 {
72 GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const noexcept;
73 };
74
75 template<typename T, glm::qualifier Q>
76 struct hash<glm::vec<3, T, Q> >
77 {
78 GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const noexcept;
79 };
80
81 template<typename T, glm::qualifier Q>
82 struct hash<glm::vec<4, T, Q> >
83 {
84 GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const noexcept;
85 };
86
87 template<typename T, glm::qualifier Q>
88 struct hash<glm::qua<T, Q> >
89 {
90 GLM_FUNC_DECL size_t operator()(glm::qua<T, Q> const& q) const noexcept;
91 };
92
93 template<typename T, glm::qualifier Q>
94 struct hash<glm::tdualquat<T, Q> >
95 {
96 GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const noexcept;
97 };
98
99 template<typename T, glm::qualifier Q>
100 struct hash<glm::mat<2, 2, T, Q> >
101 {
102 GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const noexcept;
103 };
104
105 template<typename T, glm::qualifier Q>
106 struct hash<glm::mat<2, 3, T, Q> >
107 {
108 GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const noexcept;
109 };
110
111 template<typename T, glm::qualifier Q>
112 struct hash<glm::mat<2, 4, T, Q> >
113 {
114 GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const noexcept;
115 };
116
117 template<typename T, glm::qualifier Q>
118 struct hash<glm::mat<3, 2, T, Q> >
119 {
120 GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const noexcept;
121 };
122
123 template<typename T, glm::qualifier Q>
124 struct hash<glm::mat<3, 3, T, Q> >
125 {
126 GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const noexcept;
127 };
128
129 template<typename T, glm::qualifier Q>
130 struct hash<glm::mat<3, 4, T, Q> >
131 {
132 GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const noexcept;
133 };
134
135 template<typename T, glm::qualifier Q>
136 struct hash<glm::mat<4, 2, T, Q> >
137 {
138 GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const noexcept;
139 };
140
141 template<typename T, glm::qualifier Q>
142 struct hash<glm::mat<4, 3, T, Q> >
143 {
144 GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const noexcept;
145 };
146
147 template<typename T, glm::qualifier Q>
148 struct hash<glm::mat<4, 4, T, Q> >
149 {
150 GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const noexcept;
151 };
152} // namespace std
153
154#include "hash.inl"
155
156#endif //GLM_LANG & GLM_LANG_CXX11