1 | #ifndef GLM_SETUP_INCLUDED |
2 | |
3 | #include <cassert> |
4 | #include <cstddef> |
5 | |
6 | #define GLM_VERSION_MAJOR 0 |
7 | #define GLM_VERSION_MINOR 9 |
8 | #define GLM_VERSION_PATCH 9 |
9 | #define GLM_VERSION_REVISION 9 |
10 | #define GLM_VERSION 999 |
11 | #define GLM_VERSION_MESSAGE "GLM: version 0.9.9.9" |
12 | |
13 | #define GLM_SETUP_INCLUDED GLM_VERSION |
14 | |
15 | /////////////////////////////////////////////////////////////////////////////////// |
16 | // Active states |
17 | |
18 | #define GLM_DISABLE 0 |
19 | #define GLM_ENABLE 1 |
20 | |
21 | /////////////////////////////////////////////////////////////////////////////////// |
22 | // Messages |
23 | |
24 | #if defined(GLM_FORCE_MESSAGES) |
25 | # define GLM_MESSAGES GLM_ENABLE |
26 | #else |
27 | # define GLM_MESSAGES GLM_DISABLE |
28 | #endif |
29 | |
30 | /////////////////////////////////////////////////////////////////////////////////// |
31 | // Detect the platform |
32 | |
33 | #include "../simd/platform.h" |
34 | |
35 | /////////////////////////////////////////////////////////////////////////////////// |
36 | // Build model |
37 | |
38 | #if defined(_M_ARM64) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__) |
39 | # define GLM_MODEL GLM_MODEL_64 |
40 | #elif defined(__i386__) || defined(__ppc__) || defined(__ILP32__) || defined(_M_ARM) |
41 | # define GLM_MODEL GLM_MODEL_32 |
42 | #else |
43 | # define GLM_MODEL GLM_MODEL_32 |
44 | #endif// |
45 | |
46 | #if !defined(GLM_MODEL) && GLM_COMPILER != 0 |
47 | # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message." |
48 | #endif//GLM_MODEL |
49 | |
50 | /////////////////////////////////////////////////////////////////////////////////// |
51 | // C++ Version |
52 | |
53 | // User defines: GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_FORCE_CXX11, GLM_FORCE_CXX14, GLM_FORCE_CXX17, GLM_FORCE_CXX2A |
54 | |
55 | #define GLM_LANG_CXX98_FLAG (1 << 1) |
56 | #define GLM_LANG_CXX03_FLAG (1 << 2) |
57 | #define GLM_LANG_CXX0X_FLAG (1 << 3) |
58 | #define GLM_LANG_CXX11_FLAG (1 << 4) |
59 | #define GLM_LANG_CXX14_FLAG (1 << 5) |
60 | #define GLM_LANG_CXX17_FLAG (1 << 6) |
61 | #define GLM_LANG_CXX2A_FLAG (1 << 7) |
62 | #define GLM_LANG_CXXMS_FLAG (1 << 8) |
63 | #define GLM_LANG_CXXGNU_FLAG (1 << 9) |
64 | |
65 | #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG |
66 | #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG) |
67 | #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG) |
68 | #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG) |
69 | #define GLM_LANG_CXX14 (GLM_LANG_CXX11 | GLM_LANG_CXX14_FLAG) |
70 | #define GLM_LANG_CXX17 (GLM_LANG_CXX14 | GLM_LANG_CXX17_FLAG) |
71 | #define GLM_LANG_CXX2A (GLM_LANG_CXX17 | GLM_LANG_CXX2A_FLAG) |
72 | #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG |
73 | #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG |
74 | |
75 | #if (defined(_MSC_EXTENSIONS)) |
76 | # define GLM_LANG_EXT GLM_LANG_CXXMS_FLAG |
77 | #elif ((GLM_COMPILER & (GLM_COMPILER_CLANG | GLM_COMPILER_GCC)) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)) |
78 | # define GLM_LANG_EXT GLM_LANG_CXXMS_FLAG |
79 | #else |
80 | # define GLM_LANG_EXT 0 |
81 | #endif |
82 | |
83 | #if (defined(GLM_FORCE_CXX_UNKNOWN)) |
84 | # define GLM_LANG 0 |
85 | #elif defined(GLM_FORCE_CXX2A) |
86 | # define GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT) |
87 | # define GLM_LANG_STL11_FORCED |
88 | #elif defined(GLM_FORCE_CXX17) |
89 | # define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT) |
90 | # define GLM_LANG_STL11_FORCED |
91 | #elif defined(GLM_FORCE_CXX14) |
92 | # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_EXT) |
93 | # define GLM_LANG_STL11_FORCED |
94 | #elif defined(GLM_FORCE_CXX11) |
95 | # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_EXT) |
96 | # define GLM_LANG_STL11_FORCED |
97 | #elif defined(GLM_FORCE_CXX03) |
98 | # define GLM_LANG (GLM_LANG_CXX03 | GLM_LANG_EXT) |
99 | #elif defined(GLM_FORCE_CXX98) |
100 | # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_EXT) |
101 | #else |
102 | # if GLM_COMPILER & GLM_COMPILER_VC && defined(_MSVC_LANG) |
103 | # if GLM_COMPILER >= GLM_COMPILER_VC15_7 |
104 | # define GLM_LANG_PLATFORM _MSVC_LANG |
105 | # elif GLM_COMPILER >= GLM_COMPILER_VC15 |
106 | # if _MSVC_LANG > 201402L |
107 | # define GLM_LANG_PLATFORM 201402L |
108 | # else |
109 | # define GLM_LANG_PLATFORM _MSVC_LANG |
110 | # endif |
111 | # else |
112 | # define GLM_LANG_PLATFORM 0 |
113 | # endif |
114 | # else |
115 | # define GLM_LANG_PLATFORM 0 |
116 | # endif |
117 | |
118 | # if __cplusplus > 201703L || GLM_LANG_PLATFORM > 201703L |
119 | # define GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT) |
120 | # elif __cplusplus == 201703L || GLM_LANG_PLATFORM == 201703L |
121 | # define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT) |
122 | # elif __cplusplus == 201402L || __cplusplus == 201406L || __cplusplus == 201500L || GLM_LANG_PLATFORM == 201402L |
123 | # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_EXT) |
124 | # elif __cplusplus == 201103L || GLM_LANG_PLATFORM == 201103L |
125 | # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_EXT) |
126 | # elif defined(__INTEL_CXX11_MODE__) || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__) |
127 | # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_EXT) |
128 | # elif __cplusplus == 199711L |
129 | # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_EXT) |
130 | # else |
131 | # define GLM_LANG (0 | GLM_LANG_EXT) |
132 | # endif |
133 | #endif |
134 | |
135 | /////////////////////////////////////////////////////////////////////////////////// |
136 | // Has of C++ features |
137 | |
138 | // http://clang.llvm.org/cxx_status.html |
139 | // http://gcc.gnu.org/projects/cxx0x.html |
140 | // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx |
141 | |
142 | // Android has multiple STLs but C++11 STL detection doesn't always work #284 #564 |
143 | #if GLM_PLATFORM == GLM_PLATFORM_ANDROID && !defined(GLM_LANG_STL11_FORCED) |
144 | # define GLM_HAS_CXX11_STL 0 |
145 | #elif (GLM_COMPILER & GLM_COMPILER_CUDA_RTC) == GLM_COMPILER_CUDA_RTC |
146 | # define GLM_HAS_CXX11_STL 0 |
147 | #elif GLM_COMPILER & GLM_COMPILER_CLANG |
148 | # if (defined(_LIBCPP_VERSION) || (GLM_LANG & GLM_LANG_CXX11_FLAG) || defined(GLM_LANG_STL11_FORCED)) |
149 | # define GLM_HAS_CXX11_STL 1 |
150 | # else |
151 | # define GLM_HAS_CXX11_STL 0 |
152 | # endif |
153 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
154 | # define GLM_HAS_CXX11_STL 1 |
155 | #else |
156 | # define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
157 | ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \ |
158 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ |
159 | ((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)))) |
160 | #endif |
161 | |
162 | // N1720 |
163 | #if GLM_COMPILER & GLM_COMPILER_CLANG |
164 | # define GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert) |
165 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
166 | # define GLM_HAS_STATIC_ASSERT 1 |
167 | #else |
168 | # define GLM_HAS_STATIC_ASSERT ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
169 | ((GLM_COMPILER & GLM_COMPILER_CUDA)) || \ |
170 | ((GLM_COMPILER & GLM_COMPILER_VC)))) |
171 | #endif |
172 | |
173 | // N1988 |
174 | #if GLM_LANG & GLM_LANG_CXX11_FLAG |
175 | # define GLM_HAS_EXTENDED_INTEGER_TYPE 1 |
176 | #else |
177 | # define GLM_HAS_EXTENDED_INTEGER_TYPE (\ |
178 | ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC)) || \ |
179 | ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \ |
180 | ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG))) |
181 | #endif |
182 | |
183 | // N2672 Initializer lists http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm |
184 | #if GLM_COMPILER & GLM_COMPILER_CLANG |
185 | # define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers) |
186 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
187 | # define GLM_HAS_INITIALIZER_LISTS 1 |
188 | #else |
189 | # define GLM_HAS_INITIALIZER_LISTS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
190 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \ |
191 | ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \ |
192 | ((GLM_COMPILER & GLM_COMPILER_CUDA)))) |
193 | #endif |
194 | |
195 | // N2544 Unrestricted unions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf |
196 | #if GLM_COMPILER & GLM_COMPILER_CLANG |
197 | # define GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions) |
198 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
199 | # define GLM_HAS_UNRESTRICTED_UNIONS 1 |
200 | #else |
201 | # define GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
202 | (GLM_COMPILER & GLM_COMPILER_VC) || \ |
203 | ((GLM_COMPILER & GLM_COMPILER_CUDA))) |
204 | #endif |
205 | |
206 | // N2346 |
207 | #if GLM_COMPILER & GLM_COMPILER_CLANG |
208 | # define GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions) |
209 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
210 | # define GLM_HAS_DEFAULTED_FUNCTIONS 1 |
211 | #else |
212 | # define GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
213 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ |
214 | ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \ |
215 | (GLM_COMPILER & GLM_COMPILER_CUDA))) |
216 | #endif |
217 | |
218 | // N2118 |
219 | #if GLM_COMPILER & GLM_COMPILER_CLANG |
220 | # define GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references) |
221 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
222 | # define GLM_HAS_RVALUE_REFERENCES 1 |
223 | #else |
224 | # define GLM_HAS_RVALUE_REFERENCES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
225 | ((GLM_COMPILER & GLM_COMPILER_VC)) || \ |
226 | ((GLM_COMPILER & GLM_COMPILER_CUDA)))) |
227 | #endif |
228 | |
229 | // N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf |
230 | #if GLM_COMPILER & GLM_COMPILER_CLANG |
231 | # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions) |
232 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
233 | # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1 |
234 | #else |
235 | # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
236 | ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \ |
237 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ |
238 | ((GLM_COMPILER & GLM_COMPILER_CUDA)))) |
239 | #endif |
240 | |
241 | // N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf |
242 | #if GLM_COMPILER & GLM_COMPILER_CLANG |
243 | # define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates) |
244 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
245 | # define GLM_HAS_TEMPLATE_ALIASES 1 |
246 | #else |
247 | # define GLM_HAS_TEMPLATE_ALIASES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
248 | ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \ |
249 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ |
250 | ((GLM_COMPILER & GLM_COMPILER_CUDA)))) |
251 | #endif |
252 | |
253 | // N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html |
254 | #if GLM_COMPILER & GLM_COMPILER_CLANG |
255 | # define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for) |
256 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
257 | # define GLM_HAS_RANGE_FOR 1 |
258 | #else |
259 | # define GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
260 | ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \ |
261 | ((GLM_COMPILER & GLM_COMPILER_VC)) || \ |
262 | ((GLM_COMPILER & GLM_COMPILER_CUDA)))) |
263 | #endif |
264 | |
265 | // N2341 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf |
266 | #if GLM_COMPILER & GLM_COMPILER_CLANG |
267 | # define GLM_HAS_ALIGNOF __has_feature(cxx_alignas) |
268 | #elif GLM_LANG & GLM_LANG_CXX11_FLAG |
269 | # define GLM_HAS_ALIGNOF 1 |
270 | #else |
271 | # define GLM_HAS_ALIGNOF ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
272 | ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)) || \ |
273 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)) || \ |
274 | ((GLM_COMPILER & GLM_COMPILER_CUDA)))) |
275 | #endif |
276 | |
277 | // N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf |
278 | // N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html |
279 | #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) // Compiler SIMD intrinsics don't support constexpr... |
280 | # define GLM_HAS_CONSTEXPR 0 |
281 | #elif (GLM_COMPILER & GLM_COMPILER_CLANG) |
282 | # define GLM_HAS_CONSTEXPR __has_feature(cxx_relaxed_constexpr) |
283 | #elif (GLM_LANG & GLM_LANG_CXX14_FLAG) |
284 | # define GLM_HAS_CONSTEXPR 1 |
285 | #else |
286 | # define GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && GLM_HAS_INITIALIZER_LISTS && (\ |
287 | ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL17)) || \ |
288 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)))) |
289 | #endif |
290 | |
291 | #if GLM_HAS_CONSTEXPR |
292 | # define GLM_CONSTEXPR constexpr |
293 | #else |
294 | # define GLM_CONSTEXPR |
295 | #endif |
296 | |
297 | // |
298 | #if GLM_HAS_CONSTEXPR |
299 | # if (GLM_COMPILER & GLM_COMPILER_CLANG) |
300 | # if __has_feature(cxx_if_constexpr) |
301 | # define GLM_HAS_IF_CONSTEXPR 1 |
302 | # else |
303 | # define GLM_HAS_IF_CONSTEXPR 0 |
304 | # endif |
305 | # elif (GLM_LANG & GLM_LANG_CXX17_FLAG) |
306 | # define GLM_HAS_IF_CONSTEXPR 1 |
307 | # else |
308 | # define GLM_HAS_IF_CONSTEXPR 0 |
309 | # endif |
310 | #else |
311 | # define GLM_HAS_IF_CONSTEXPR 0 |
312 | #endif |
313 | |
314 | #if GLM_HAS_IF_CONSTEXPR |
315 | # define GLM_IF_CONSTEXPR if constexpr |
316 | #else |
317 | # define GLM_IF_CONSTEXPR if |
318 | #endif |
319 | |
320 | // |
321 | #if GLM_LANG & GLM_LANG_CXX11_FLAG |
322 | # define GLM_HAS_ASSIGNABLE 1 |
323 | #else |
324 | # define GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
325 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \ |
326 | ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))) |
327 | #endif |
328 | |
329 | // |
330 | #define GLM_HAS_TRIVIAL_QUERIES 0 |
331 | |
332 | // |
333 | #if GLM_LANG & GLM_LANG_CXX11_FLAG |
334 | # define GLM_HAS_MAKE_SIGNED 1 |
335 | #else |
336 | # define GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ |
337 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ |
338 | ((GLM_COMPILER & GLM_COMPILER_CUDA)))) |
339 | #endif |
340 | |
341 | // |
342 | #if defined(GLM_FORCE_INTRINSICS) |
343 | # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\ |
344 | ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \ |
345 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT)))) |
346 | #else |
347 | # define GLM_HAS_BITSCAN_WINDOWS 0 |
348 | #endif |
349 | |
350 | /////////////////////////////////////////////////////////////////////////////////// |
351 | // OpenMP |
352 | #ifdef _OPENMP |
353 | # if GLM_COMPILER & GLM_COMPILER_GCC |
354 | # if GLM_COMPILER >= GLM_COMPILER_GCC61 |
355 | # define GLM_HAS_OPENMP 45 |
356 | # elif GLM_COMPILER >= GLM_COMPILER_GCC49 |
357 | # define GLM_HAS_OPENMP 40 |
358 | # elif GLM_COMPILER >= GLM_COMPILER_GCC47 |
359 | # define GLM_HAS_OPENMP 31 |
360 | # else |
361 | # define GLM_HAS_OPENMP 0 |
362 | # endif |
363 | # elif GLM_COMPILER & GLM_COMPILER_CLANG |
364 | # if GLM_COMPILER >= GLM_COMPILER_CLANG38 |
365 | # define GLM_HAS_OPENMP 31 |
366 | # else |
367 | # define GLM_HAS_OPENMP 0 |
368 | # endif |
369 | # elif GLM_COMPILER & GLM_COMPILER_VC |
370 | # define GLM_HAS_OPENMP 20 |
371 | # elif GLM_COMPILER & GLM_COMPILER_INTEL |
372 | # if GLM_COMPILER >= GLM_COMPILER_INTEL16 |
373 | # define GLM_HAS_OPENMP 40 |
374 | # else |
375 | # define GLM_HAS_OPENMP 0 |
376 | # endif |
377 | # else |
378 | # define GLM_HAS_OPENMP 0 |
379 | # endif |
380 | #else |
381 | # define GLM_HAS_OPENMP 0 |
382 | #endif |
383 | |
384 | /////////////////////////////////////////////////////////////////////////////////// |
385 | // nullptr |
386 | |
387 | #if GLM_LANG & GLM_LANG_CXX0X_FLAG |
388 | # define GLM_CONFIG_NULLPTR GLM_ENABLE |
389 | #else |
390 | # define GLM_CONFIG_NULLPTR GLM_DISABLE |
391 | #endif |
392 | |
393 | #if GLM_CONFIG_NULLPTR == GLM_ENABLE |
394 | # define GLM_NULLPTR nullptr |
395 | #else |
396 | # define GLM_NULLPTR 0 |
397 | #endif |
398 | |
399 | /////////////////////////////////////////////////////////////////////////////////// |
400 | // Static assert |
401 | |
402 | #if GLM_HAS_STATIC_ASSERT |
403 | # define GLM_STATIC_ASSERT(x, message) static_assert(x, message) |
404 | #elif GLM_COMPILER & GLM_COMPILER_VC |
405 | # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1] |
406 | #else |
407 | # define GLM_STATIC_ASSERT(x, message) assert(x) |
408 | #endif//GLM_LANG |
409 | |
410 | /////////////////////////////////////////////////////////////////////////////////// |
411 | // Qualifiers |
412 | |
413 | #if GLM_COMPILER & GLM_COMPILER_CUDA |
414 | # define GLM_CUDA_FUNC_DEF __device__ __host__ |
415 | # define GLM_CUDA_FUNC_DECL __device__ __host__ |
416 | #else |
417 | # define GLM_CUDA_FUNC_DEF |
418 | # define GLM_CUDA_FUNC_DECL |
419 | #endif |
420 | |
421 | #if defined(GLM_FORCE_INLINE) |
422 | # if GLM_COMPILER & GLM_COMPILER_VC |
423 | # define GLM_INLINE __forceinline |
424 | # define GLM_NEVER_INLINE __declspec((noinline)) |
425 | # elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG) |
426 | # define GLM_INLINE inline __attribute__((__always_inline__)) |
427 | # define GLM_NEVER_INLINE __attribute__((__noinline__)) |
428 | # elif GLM_COMPILER & GLM_COMPILER_CUDA |
429 | # define GLM_INLINE __forceinline__ |
430 | # define GLM_NEVER_INLINE __noinline__ |
431 | # else |
432 | # define GLM_INLINE inline |
433 | # define GLM_NEVER_INLINE |
434 | # endif//GLM_COMPILER |
435 | #else |
436 | # define GLM_INLINE inline |
437 | # define GLM_NEVER_INLINE |
438 | #endif//defined(GLM_FORCE_INLINE) |
439 | |
440 | #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL |
441 | #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE |
442 | |
443 | /////////////////////////////////////////////////////////////////////////////////// |
444 | // Swizzle operators |
445 | |
446 | // User defines: GLM_FORCE_SWIZZLE |
447 | |
448 | #define GLM_SWIZZLE_DISABLED 0 |
449 | #define GLM_SWIZZLE_OPERATOR 1 |
450 | #define GLM_SWIZZLE_FUNCTION 2 |
451 | |
452 | #if defined(GLM_SWIZZLE) |
453 | # pragma message("GLM: GLM_SWIZZLE is deprecated, use GLM_FORCE_SWIZZLE instead.") |
454 | # define GLM_FORCE_SWIZZLE |
455 | #endif |
456 | |
457 | #if defined(GLM_FORCE_SWIZZLE) && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && !defined(GLM_FORCE_XYZW_ONLY) |
458 | # define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_OPERATOR |
459 | #elif defined(GLM_FORCE_SWIZZLE) |
460 | # define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_FUNCTION |
461 | #else |
462 | # define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_DISABLED |
463 | #endif |
464 | |
465 | /////////////////////////////////////////////////////////////////////////////////// |
466 | // Allows using not basic types as genType |
467 | |
468 | // #define GLM_FORCE_UNRESTRICTED_GENTYPE |
469 | |
470 | #ifdef GLM_FORCE_UNRESTRICTED_GENTYPE |
471 | # define GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_ENABLE |
472 | #else |
473 | # define GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_DISABLE |
474 | #endif |
475 | |
476 | /////////////////////////////////////////////////////////////////////////////////// |
477 | // Clip control, define GLM_FORCE_DEPTH_ZERO_TO_ONE before including GLM |
478 | // to use a clip space between 0 to 1. |
479 | // Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM |
480 | // to use left handed coordinate system by default. |
481 | |
482 | #define GLM_CLIP_CONTROL_ZO_BIT (1 << 0) // ZERO_TO_ONE |
483 | #define GLM_CLIP_CONTROL_NO_BIT (1 << 1) // NEGATIVE_ONE_TO_ONE |
484 | #define GLM_CLIP_CONTROL_LH_BIT (1 << 2) // LEFT_HANDED, For DirectX, Metal, Vulkan |
485 | #define GLM_CLIP_CONTROL_RH_BIT (1 << 3) // RIGHT_HANDED, For OpenGL, default in GLM |
486 | |
487 | #define GLM_CLIP_CONTROL_LH_ZO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_ZO_BIT) |
488 | #define GLM_CLIP_CONTROL_LH_NO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_NO_BIT) |
489 | #define GLM_CLIP_CONTROL_RH_ZO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_ZO_BIT) |
490 | #define GLM_CLIP_CONTROL_RH_NO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_NO_BIT) |
491 | |
492 | #ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE |
493 | # ifdef GLM_FORCE_LEFT_HANDED |
494 | # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_ZO |
495 | # else |
496 | # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_ZO |
497 | # endif |
498 | #else |
499 | # ifdef GLM_FORCE_LEFT_HANDED |
500 | # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_NO |
501 | # else |
502 | # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_NO |
503 | # endif |
504 | #endif |
505 | |
506 | /////////////////////////////////////////////////////////////////////////////////// |
507 | // Qualifiers |
508 | |
509 | #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)) |
510 | # define GLM_DEPRECATED __declspec(deprecated) |
511 | # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name |
512 | #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL) |
513 | # define GLM_DEPRECATED __attribute__((__deprecated__)) |
514 | # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment))) |
515 | #elif GLM_COMPILER & GLM_COMPILER_CUDA |
516 | # define GLM_DEPRECATED |
517 | # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x) |
518 | #else |
519 | # define GLM_DEPRECATED |
520 | # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name |
521 | #endif |
522 | |
523 | /////////////////////////////////////////////////////////////////////////////////// |
524 | |
525 | #ifdef GLM_FORCE_EXPLICIT_CTOR |
526 | # define GLM_EXPLICIT explicit |
527 | #else |
528 | # define GLM_EXPLICIT |
529 | #endif |
530 | |
531 | /////////////////////////////////////////////////////////////////////////////////// |
532 | // SYCL |
533 | |
534 | #if GLM_COMPILER==GLM_COMPILER_SYCL |
535 | |
536 | #include <CL/sycl.hpp> |
537 | #include <limits> |
538 | |
539 | namespace glm { |
540 | namespace std { |
541 | // Import SYCL's functions into the namespace glm::std to force their usages. |
542 | // It's important to use the math built-in function (sin, exp, ...) |
543 | // of SYCL instead the std ones. |
544 | using namespace cl::sycl; |
545 | |
546 | /////////////////////////////////////////////////////////////////////////////// |
547 | // Import some "harmless" std's stuffs used by glm into |
548 | // the new glm::std namespace. |
549 | template<typename T> |
550 | using numeric_limits = ::std::numeric_limits<T>; |
551 | |
552 | using ::std::size_t; |
553 | |
554 | using ::std::uint8_t; |
555 | using ::std::uint16_t; |
556 | using ::std::uint32_t; |
557 | using ::std::uint64_t; |
558 | |
559 | using ::std::int8_t; |
560 | using ::std::int16_t; |
561 | using ::std::int32_t; |
562 | using ::std::int64_t; |
563 | |
564 | using ::std::make_unsigned; |
565 | /////////////////////////////////////////////////////////////////////////////// |
566 | } //namespace std |
567 | } //namespace glm |
568 | |
569 | #endif |
570 | |
571 | /////////////////////////////////////////////////////////////////////////////////// |
572 | |
573 | /////////////////////////////////////////////////////////////////////////////////// |
574 | // Length type: all length functions returns a length_t type. |
575 | // When GLM_FORCE_SIZE_T_LENGTH is defined, length_t is a typedef of size_t otherwise |
576 | // length_t is a typedef of int like GLSL defines it. |
577 | |
578 | #define GLM_LENGTH_INT 1 |
579 | #define GLM_LENGTH_SIZE_T 2 |
580 | |
581 | #ifdef GLM_FORCE_SIZE_T_LENGTH |
582 | # define GLM_CONFIG_LENGTH_TYPE GLM_LENGTH_SIZE_T |
583 | #else |
584 | # define GLM_CONFIG_LENGTH_TYPE GLM_LENGTH_INT |
585 | #endif |
586 | |
587 | namespace glm |
588 | { |
589 | using std::size_t; |
590 | # if GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T |
591 | typedef size_t length_t; |
592 | # else |
593 | typedef int length_t; |
594 | # endif |
595 | }//namespace glm |
596 | |
597 | /////////////////////////////////////////////////////////////////////////////////// |
598 | // constexpr |
599 | |
600 | #if GLM_HAS_CONSTEXPR |
601 | # define GLM_CONFIG_CONSTEXP GLM_ENABLE |
602 | |
603 | namespace glm |
604 | { |
605 | template<typename T, std::size_t N> |
606 | constexpr std::size_t countof(T const (&)[N]) |
607 | { |
608 | return N; |
609 | } |
610 | }//namespace glm |
611 | # define GLM_COUNTOF(arr) glm::countof(arr) |
612 | #elif defined(_MSC_VER) |
613 | # define GLM_CONFIG_CONSTEXP GLM_DISABLE |
614 | |
615 | # define GLM_COUNTOF(arr) _countof(arr) |
616 | #else |
617 | # define GLM_CONFIG_CONSTEXP GLM_DISABLE |
618 | |
619 | # define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0]) |
620 | #endif |
621 | |
622 | /////////////////////////////////////////////////////////////////////////////////// |
623 | // uint |
624 | |
625 | namespace glm{ |
626 | namespace detail |
627 | { |
628 | template<typename T> |
629 | struct is_int |
630 | { |
631 | enum test {value = 0}; |
632 | }; |
633 | |
634 | template<> |
635 | struct is_int<unsigned int> |
636 | { |
637 | enum test {value = ~0}; |
638 | }; |
639 | |
640 | template<> |
641 | struct is_int<signed int> |
642 | { |
643 | enum test {value = ~0}; |
644 | }; |
645 | }//namespace detail |
646 | |
647 | typedef unsigned int uint; |
648 | }//namespace glm |
649 | |
650 | /////////////////////////////////////////////////////////////////////////////////// |
651 | // 64-bit int |
652 | |
653 | #if GLM_HAS_EXTENDED_INTEGER_TYPE |
654 | # include <cstdint> |
655 | #endif |
656 | |
657 | namespace glm{ |
658 | namespace detail |
659 | { |
660 | # if GLM_HAS_EXTENDED_INTEGER_TYPE |
661 | typedef std::uint64_t uint64; |
662 | typedef std::int64_t int64; |
663 | # elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available |
664 | typedef uint64_t uint64; |
665 | typedef int64_t int64; |
666 | # elif GLM_COMPILER & GLM_COMPILER_VC |
667 | typedef unsigned __int64 uint64; |
668 | typedef signed __int64 int64; |
669 | # elif GLM_COMPILER & GLM_COMPILER_GCC |
670 | # pragma GCC diagnostic ignored "-Wlong-long" |
671 | __extension__ typedef unsigned long long uint64; |
672 | __extension__ typedef signed long long int64; |
673 | # elif (GLM_COMPILER & GLM_COMPILER_CLANG) |
674 | # pragma clang diagnostic ignored "-Wc++11-long-long" |
675 | typedef unsigned long long uint64; |
676 | typedef signed long long int64; |
677 | # else//unknown compiler |
678 | typedef unsigned long long uint64; |
679 | typedef signed long long int64; |
680 | # endif |
681 | }//namespace detail |
682 | }//namespace glm |
683 | |
684 | /////////////////////////////////////////////////////////////////////////////////// |
685 | // make_unsigned |
686 | |
687 | #if GLM_HAS_MAKE_SIGNED |
688 | # include <type_traits> |
689 | |
690 | namespace glm{ |
691 | namespace detail |
692 | { |
693 | using std::make_unsigned; |
694 | }//namespace detail |
695 | }//namespace glm |
696 | |
697 | #else |
698 | |
699 | namespace glm{ |
700 | namespace detail |
701 | { |
702 | template<typename genType> |
703 | struct make_unsigned |
704 | {}; |
705 | |
706 | template<> |
707 | struct make_unsigned<char> |
708 | { |
709 | typedef unsigned char type; |
710 | }; |
711 | |
712 | template<> |
713 | struct make_unsigned<signed char> |
714 | { |
715 | typedef unsigned char type; |
716 | }; |
717 | |
718 | template<> |
719 | struct make_unsigned<short> |
720 | { |
721 | typedef unsigned short type; |
722 | }; |
723 | |
724 | template<> |
725 | struct make_unsigned<int> |
726 | { |
727 | typedef unsigned int type; |
728 | }; |
729 | |
730 | template<> |
731 | struct make_unsigned<long> |
732 | { |
733 | typedef unsigned long type; |
734 | }; |
735 | |
736 | template<> |
737 | struct make_unsigned<int64> |
738 | { |
739 | typedef uint64 type; |
740 | }; |
741 | |
742 | template<> |
743 | struct make_unsigned<unsigned char> |
744 | { |
745 | typedef unsigned char type; |
746 | }; |
747 | |
748 | template<> |
749 | struct make_unsigned<unsigned short> |
750 | { |
751 | typedef unsigned short type; |
752 | }; |
753 | |
754 | template<> |
755 | struct make_unsigned<unsigned int> |
756 | { |
757 | typedef unsigned int type; |
758 | }; |
759 | |
760 | template<> |
761 | struct make_unsigned<unsigned long> |
762 | { |
763 | typedef unsigned long type; |
764 | }; |
765 | |
766 | template<> |
767 | struct make_unsigned<uint64> |
768 | { |
769 | typedef uint64 type; |
770 | }; |
771 | }//namespace detail |
772 | }//namespace glm |
773 | #endif |
774 | |
775 | /////////////////////////////////////////////////////////////////////////////////// |
776 | // Only use x, y, z, w as vector type components |
777 | |
778 | #ifdef GLM_FORCE_XYZW_ONLY |
779 | # define GLM_CONFIG_XYZW_ONLY GLM_ENABLE |
780 | #else |
781 | # define GLM_CONFIG_XYZW_ONLY GLM_DISABLE |
782 | #endif |
783 | |
784 | /////////////////////////////////////////////////////////////////////////////////// |
785 | // Configure the use of defaulted initialized types |
786 | |
787 | #define GLM_CTOR_INIT_DISABLE 0 |
788 | #define GLM_CTOR_INITIALIZER_LIST 1 |
789 | #define GLM_CTOR_INITIALISATION 2 |
790 | |
791 | #if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS |
792 | # define GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALIZER_LIST |
793 | #elif defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS |
794 | # define GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALISATION |
795 | #else |
796 | # define GLM_CONFIG_CTOR_INIT GLM_CTOR_INIT_DISABLE |
797 | #endif |
798 | |
799 | /////////////////////////////////////////////////////////////////////////////////// |
800 | // Use SIMD instruction sets |
801 | |
802 | #if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT) |
803 | # define GLM_CONFIG_SIMD GLM_ENABLE |
804 | #else |
805 | # define GLM_CONFIG_SIMD GLM_DISABLE |
806 | #endif |
807 | |
808 | /////////////////////////////////////////////////////////////////////////////////// |
809 | // Configure the use of defaulted function |
810 | |
811 | #if GLM_HAS_DEFAULTED_FUNCTIONS |
812 | # define GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_ENABLE |
813 | # define GLM_DEFAULT = default |
814 | #else |
815 | # define GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_DISABLE |
816 | # define GLM_DEFAULT |
817 | #endif |
818 | |
819 | #if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INIT_DISABLE && GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE |
820 | # define GLM_CONFIG_DEFAULTED_DEFAULT_CTOR GLM_ENABLE |
821 | # define GLM_DEFAULT_CTOR GLM_DEFAULT |
822 | #else |
823 | # define GLM_CONFIG_DEFAULTED_DEFAULT_CTOR GLM_DISABLE |
824 | # define GLM_DEFAULT_CTOR |
825 | #endif |
826 | |
827 | /////////////////////////////////////////////////////////////////////////////////// |
828 | // Configure the use of aligned gentypes |
829 | |
830 | #ifdef GLM_FORCE_ALIGNED // Legacy define |
831 | # define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES |
832 | #endif |
833 | |
834 | #ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES |
835 | # define GLM_FORCE_ALIGNED_GENTYPES |
836 | #endif |
837 | |
838 | #if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (defined(GLM_FORCE_ALIGNED_GENTYPES) || (GLM_CONFIG_SIMD == GLM_ENABLE)) |
839 | # define GLM_CONFIG_ALIGNED_GENTYPES GLM_ENABLE |
840 | #else |
841 | # define GLM_CONFIG_ALIGNED_GENTYPES GLM_DISABLE |
842 | #endif |
843 | |
844 | /////////////////////////////////////////////////////////////////////////////////// |
845 | // Configure the use of anonymous structure as implementation detail |
846 | |
847 | #if ((GLM_CONFIG_SIMD == GLM_ENABLE) || (GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR) || (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE)) |
848 | # define GLM_CONFIG_ANONYMOUS_STRUCT GLM_ENABLE |
849 | #else |
850 | # define GLM_CONFIG_ANONYMOUS_STRUCT GLM_DISABLE |
851 | #endif |
852 | |
853 | /////////////////////////////////////////////////////////////////////////////////// |
854 | // Silent warnings |
855 | |
856 | #ifdef GLM_FORCE_SILENT_WARNINGS |
857 | # define GLM_SILENT_WARNINGS GLM_ENABLE |
858 | #else |
859 | # define GLM_SILENT_WARNINGS GLM_DISABLE |
860 | #endif |
861 | |
862 | /////////////////////////////////////////////////////////////////////////////////// |
863 | // Precision |
864 | |
865 | #define GLM_HIGHP 1 |
866 | #define GLM_MEDIUMP 2 |
867 | #define GLM_LOWP 3 |
868 | |
869 | #if defined(GLM_FORCE_PRECISION_HIGHP_BOOL) || defined(GLM_PRECISION_HIGHP_BOOL) |
870 | # define GLM_CONFIG_PRECISION_BOOL GLM_HIGHP |
871 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_BOOL) || defined(GLM_PRECISION_MEDIUMP_BOOL) |
872 | # define GLM_CONFIG_PRECISION_BOOL GLM_MEDIUMP |
873 | #elif defined(GLM_FORCE_PRECISION_LOWP_BOOL) || defined(GLM_PRECISION_LOWP_BOOL) |
874 | # define GLM_CONFIG_PRECISION_BOOL GLM_LOWP |
875 | #else |
876 | # define GLM_CONFIG_PRECISION_BOOL GLM_HIGHP |
877 | #endif |
878 | |
879 | #if defined(GLM_FORCE_PRECISION_HIGHP_INT) || defined(GLM_PRECISION_HIGHP_INT) |
880 | # define GLM_CONFIG_PRECISION_INT GLM_HIGHP |
881 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_INT) || defined(GLM_PRECISION_MEDIUMP_INT) |
882 | # define GLM_CONFIG_PRECISION_INT GLM_MEDIUMP |
883 | #elif defined(GLM_FORCE_PRECISION_LOWP_INT) || defined(GLM_PRECISION_LOWP_INT) |
884 | # define GLM_CONFIG_PRECISION_INT GLM_LOWP |
885 | #else |
886 | # define GLM_CONFIG_PRECISION_INT GLM_HIGHP |
887 | #endif |
888 | |
889 | #if defined(GLM_FORCE_PRECISION_HIGHP_UINT) || defined(GLM_PRECISION_HIGHP_UINT) |
890 | # define GLM_CONFIG_PRECISION_UINT GLM_HIGHP |
891 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_UINT) || defined(GLM_PRECISION_MEDIUMP_UINT) |
892 | # define GLM_CONFIG_PRECISION_UINT GLM_MEDIUMP |
893 | #elif defined(GLM_FORCE_PRECISION_LOWP_UINT) || defined(GLM_PRECISION_LOWP_UINT) |
894 | # define GLM_CONFIG_PRECISION_UINT GLM_LOWP |
895 | #else |
896 | # define GLM_CONFIG_PRECISION_UINT GLM_HIGHP |
897 | #endif |
898 | |
899 | #if defined(GLM_FORCE_PRECISION_HIGHP_FLOAT) || defined(GLM_PRECISION_HIGHP_FLOAT) |
900 | # define GLM_CONFIG_PRECISION_FLOAT GLM_HIGHP |
901 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_FLOAT) || defined(GLM_PRECISION_MEDIUMP_FLOAT) |
902 | # define GLM_CONFIG_PRECISION_FLOAT GLM_MEDIUMP |
903 | #elif defined(GLM_FORCE_PRECISION_LOWP_FLOAT) || defined(GLM_PRECISION_LOWP_FLOAT) |
904 | # define GLM_CONFIG_PRECISION_FLOAT GLM_LOWP |
905 | #else |
906 | # define GLM_CONFIG_PRECISION_FLOAT GLM_HIGHP |
907 | #endif |
908 | |
909 | #if defined(GLM_FORCE_PRECISION_HIGHP_DOUBLE) || defined(GLM_PRECISION_HIGHP_DOUBLE) |
910 | # define GLM_CONFIG_PRECISION_DOUBLE GLM_HIGHP |
911 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_DOUBLE) || defined(GLM_PRECISION_MEDIUMP_DOUBLE) |
912 | # define GLM_CONFIG_PRECISION_DOUBLE GLM_MEDIUMP |
913 | #elif defined(GLM_FORCE_PRECISION_LOWP_DOUBLE) || defined(GLM_PRECISION_LOWP_DOUBLE) |
914 | # define GLM_CONFIG_PRECISION_DOUBLE GLM_LOWP |
915 | #else |
916 | # define GLM_CONFIG_PRECISION_DOUBLE GLM_HIGHP |
917 | #endif |
918 | |
919 | /////////////////////////////////////////////////////////////////////////////////// |
920 | // Check inclusions of different versions of GLM |
921 | |
922 | #elif ((GLM_SETUP_INCLUDED != GLM_VERSION) && !defined(GLM_FORCE_IGNORE_VERSION)) |
923 | # error "GLM error: A different version of GLM is already included. Define GLM_FORCE_IGNORE_VERSION before including GLM headers to ignore this error." |
924 | #elif GLM_SETUP_INCLUDED == GLM_VERSION |
925 | |
926 | /////////////////////////////////////////////////////////////////////////////////// |
927 | // Messages |
928 | |
929 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_DISPLAYED) |
930 | # define GLM_MESSAGE_DISPLAYED |
931 | # define GLM_STR_HELPER(x) #x |
932 | # define GLM_STR(x) GLM_STR_HELPER(x) |
933 | |
934 | // Report GLM version |
935 | # pragma message (GLM_STR(GLM_VERSION_MESSAGE)) |
936 | |
937 | // Report C++ language |
938 | # if (GLM_LANG & GLM_LANG_CXX2A_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
939 | # pragma message("GLM: C++ 2A with extensions") |
940 | # elif (GLM_LANG & GLM_LANG_CXX2A_FLAG) |
941 | # pragma message("GLM: C++ 2A") |
942 | # elif (GLM_LANG & GLM_LANG_CXX17_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
943 | # pragma message("GLM: C++ 17 with extensions") |
944 | # elif (GLM_LANG & GLM_LANG_CXX17_FLAG) |
945 | # pragma message("GLM: C++ 17") |
946 | # elif (GLM_LANG & GLM_LANG_CXX14_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
947 | # pragma message("GLM: C++ 14 with extensions") |
948 | # elif (GLM_LANG & GLM_LANG_CXX14_FLAG) |
949 | # pragma message("GLM: C++ 14") |
950 | # elif (GLM_LANG & GLM_LANG_CXX11_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
951 | # pragma message("GLM: C++ 11 with extensions") |
952 | # elif (GLM_LANG & GLM_LANG_CXX11_FLAG) |
953 | # pragma message("GLM: C++ 11") |
954 | # elif (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
955 | # pragma message("GLM: C++ 0x with extensions") |
956 | # elif (GLM_LANG & GLM_LANG_CXX0X_FLAG) |
957 | # pragma message("GLM: C++ 0x") |
958 | # elif (GLM_LANG & GLM_LANG_CXX03_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
959 | # pragma message("GLM: C++ 03 with extensions") |
960 | # elif (GLM_LANG & GLM_LANG_CXX03_FLAG) |
961 | # pragma message("GLM: C++ 03") |
962 | # elif (GLM_LANG & GLM_LANG_CXX98_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
963 | # pragma message("GLM: C++ 98 with extensions") |
964 | # elif (GLM_LANG & GLM_LANG_CXX98_FLAG) |
965 | # pragma message("GLM: C++ 98") |
966 | # else |
967 | # pragma message("GLM: C++ language undetected") |
968 | # endif//GLM_LANG |
969 | |
970 | // Report compiler detection |
971 | # if GLM_COMPILER & GLM_COMPILER_CUDA |
972 | # pragma message("GLM: CUDA compiler detected") |
973 | # elif GLM_COMPILER & GLM_COMPILER_VC |
974 | # pragma message("GLM: Visual C++ compiler detected") |
975 | # elif GLM_COMPILER & GLM_COMPILER_CLANG |
976 | # pragma message("GLM: Clang compiler detected") |
977 | # elif GLM_COMPILER & GLM_COMPILER_INTEL |
978 | # pragma message("GLM: Intel Compiler detected") |
979 | # elif GLM_COMPILER & GLM_COMPILER_GCC |
980 | # pragma message("GLM: GCC compiler detected") |
981 | # else |
982 | # pragma message("GLM: Compiler not detected") |
983 | # endif |
984 | |
985 | // Report build target |
986 | # if (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_64) |
987 | # pragma message("GLM: x86 64 bits with AVX2 instruction set build target") |
988 | # elif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_32) |
989 | # pragma message("GLM: x86 32 bits with AVX2 instruction set build target") |
990 | |
991 | # elif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_64) |
992 | # pragma message("GLM: x86 64 bits with AVX instruction set build target") |
993 | # elif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_32) |
994 | # pragma message("GLM: x86 32 bits with AVX instruction set build target") |
995 | |
996 | # elif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_64) |
997 | # pragma message("GLM: x86 64 bits with SSE4.2 instruction set build target") |
998 | # elif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_32) |
999 | # pragma message("GLM: x86 32 bits with SSE4.2 instruction set build target") |
1000 | |
1001 | # elif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_64) |
1002 | # pragma message("GLM: x86 64 bits with SSE4.1 instruction set build target") |
1003 | # elif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_32) |
1004 | # pragma message("GLM: x86 32 bits with SSE4.1 instruction set build target") |
1005 | |
1006 | # elif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_64) |
1007 | # pragma message("GLM: x86 64 bits with SSSE3 instruction set build target") |
1008 | # elif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_32) |
1009 | # pragma message("GLM: x86 32 bits with SSSE3 instruction set build target") |
1010 | |
1011 | # elif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_64) |
1012 | # pragma message("GLM: x86 64 bits with SSE3 instruction set build target") |
1013 | # elif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_32) |
1014 | # pragma message("GLM: x86 32 bits with SSE3 instruction set build target") |
1015 | |
1016 | # elif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_64) |
1017 | # pragma message("GLM: x86 64 bits with SSE2 instruction set build target") |
1018 | # elif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_32) |
1019 | # pragma message("GLM: x86 32 bits with SSE2 instruction set build target") |
1020 | |
1021 | # elif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_64) |
1022 | # pragma message("GLM: x86 64 bits build target") |
1023 | # elif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_32) |
1024 | # pragma message("GLM: x86 32 bits build target") |
1025 | |
1026 | # elif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_64) |
1027 | # pragma message("GLM: ARM 64 bits with Neon instruction set build target") |
1028 | # elif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_32) |
1029 | # pragma message("GLM: ARM 32 bits with Neon instruction set build target") |
1030 | |
1031 | # elif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_64) |
1032 | # pragma message("GLM: ARM 64 bits build target") |
1033 | # elif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_32) |
1034 | # pragma message("GLM: ARM 32 bits build target") |
1035 | |
1036 | # elif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_64) |
1037 | # pragma message("GLM: MIPS 64 bits build target") |
1038 | # elif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_32) |
1039 | # pragma message("GLM: MIPS 32 bits build target") |
1040 | |
1041 | # elif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_64) |
1042 | # pragma message("GLM: PowerPC 64 bits build target") |
1043 | # elif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_32) |
1044 | # pragma message("GLM: PowerPC 32 bits build target") |
1045 | # else |
1046 | # pragma message("GLM: Unknown build target") |
1047 | # endif//GLM_ARCH |
1048 | |
1049 | // Report platform name |
1050 | # if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO) |
1051 | # pragma message("GLM: QNX platform detected") |
1052 | //# elif(GLM_PLATFORM & GLM_PLATFORM_IOS) |
1053 | //# pragma message("GLM: iOS platform detected") |
1054 | # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE) |
1055 | # pragma message("GLM: Apple platform detected") |
1056 | # elif(GLM_PLATFORM & GLM_PLATFORM_WINCE) |
1057 | # pragma message("GLM: WinCE platform detected") |
1058 | # elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) |
1059 | # pragma message("GLM: Windows platform detected") |
1060 | # elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL) |
1061 | # pragma message("GLM: Native Client detected") |
1062 | # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) |
1063 | # pragma message("GLM: Android platform detected") |
1064 | # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX) |
1065 | # pragma message("GLM: Linux platform detected") |
1066 | # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX) |
1067 | # pragma message("GLM: UNIX platform detected") |
1068 | # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN) |
1069 | # pragma message("GLM: platform unknown") |
1070 | # else |
1071 | # pragma message("GLM: platform not detected") |
1072 | # endif |
1073 | |
1074 | // Report whether only xyzw component are used |
1075 | # if defined GLM_FORCE_XYZW_ONLY |
1076 | # pragma message("GLM: GLM_FORCE_XYZW_ONLY is defined. Only x, y, z and w component are available in vector type. This define disables swizzle operators and SIMD instruction sets.") |
1077 | # endif |
1078 | |
1079 | // Report swizzle operator support |
1080 | # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR |
1081 | # pragma message("GLM: GLM_FORCE_SWIZZLE is defined, swizzling operators enabled.") |
1082 | # elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION |
1083 | # pragma message("GLM: GLM_FORCE_SWIZZLE is defined, swizzling functions enabled. Enable compiler C++ language extensions to enable swizzle operators.") |
1084 | # else |
1085 | # pragma message("GLM: GLM_FORCE_SWIZZLE is undefined. swizzling functions or operators are disabled.") |
1086 | # endif |
1087 | |
1088 | // Report .length() type |
1089 | # if GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T |
1090 | # pragma message("GLM: GLM_FORCE_SIZE_T_LENGTH is defined. .length() returns a glm::length_t, a typedef of std::size_t.") |
1091 | # else |
1092 | # pragma message("GLM: GLM_FORCE_SIZE_T_LENGTH is undefined. .length() returns a glm::length_t, a typedef of int following GLSL.") |
1093 | # endif |
1094 | |
1095 | # if GLM_CONFIG_UNRESTRICTED_GENTYPE == GLM_ENABLE |
1096 | # pragma message("GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is defined. Removes GLSL restrictions on valid function genTypes.") |
1097 | # else |
1098 | # pragma message("GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is undefined. Follows strictly GLSL on valid function genTypes.") |
1099 | # endif |
1100 | |
1101 | # if GLM_SILENT_WARNINGS == GLM_ENABLE |
1102 | # pragma message("GLM: GLM_FORCE_SILENT_WARNINGS is defined. Ignores C++ warnings from using C++ language extensions.") |
1103 | # else |
1104 | # pragma message("GLM: GLM_FORCE_SILENT_WARNINGS is undefined. Shows C++ warnings from using C++ language extensions.") |
1105 | # endif |
1106 | |
1107 | # ifdef GLM_FORCE_SINGLE_ONLY |
1108 | # pragma message("GLM: GLM_FORCE_SINGLE_ONLY is defined. Using only single precision floating-point types.") |
1109 | # endif |
1110 | |
1111 | # if defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE) |
1112 | # undef GLM_FORCE_ALIGNED_GENTYPES |
1113 | # pragma message("GLM: GLM_FORCE_ALIGNED_GENTYPES is defined, allowing aligned types. This prevents the use of C++ constexpr.") |
1114 | # elif defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE) |
1115 | # undef GLM_FORCE_ALIGNED_GENTYPES |
1116 | # pragma message("GLM: GLM_FORCE_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.") |
1117 | # endif |
1118 | |
1119 | # if defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES) |
1120 | # if GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE |
1121 | # undef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES |
1122 | # pragma message("GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.") |
1123 | # elif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE |
1124 | # pragma message("GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined. All gentypes (e.g. vec3) will be aligned and padded by default.") |
1125 | # endif |
1126 | # endif |
1127 | |
1128 | # if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT |
1129 | # pragma message("GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is defined. Using zero to one depth clip space.") |
1130 | # else |
1131 | # pragma message("GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is undefined. Using negative one to one depth clip space.") |
1132 | # endif |
1133 | |
1134 | # if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT |
1135 | # pragma message("GLM: GLM_FORCE_LEFT_HANDED is defined. Using left handed coordinate system.") |
1136 | # else |
1137 | # pragma message("GLM: GLM_FORCE_LEFT_HANDED is undefined. Using right handed coordinate system.") |
1138 | # endif |
1139 | #endif//GLM_MESSAGES |
1140 | |
1141 | #endif//GLM_SETUP_INCLUDED |
1142 | |