41 #define GLM_VERSION 96
42 #define GLM_VERSION_MAJOR 0
43 #define GLM_VERSION_MINOR 9
44 #define GLM_VERSION_PATCH 6
45 #define GLM_VERSION_REVISION 0
50 #define GLM_PLATFORM_UNKNOWN 0x00000000
51 #define GLM_PLATFORM_WINDOWS 0x00010000
52 #define GLM_PLATFORM_LINUX 0x00020000
53 #define GLM_PLATFORM_APPLE 0x00040000
55 #define GLM_PLATFORM_ANDROID 0x00100000
56 #define GLM_PLATFORM_CHROME_NACL 0x00200000
57 #define GLM_PLATFORM_UNIX 0x00400000
58 #define GLM_PLATFORM_QNXNTO 0x00800000
59 #define GLM_PLATFORM_WINCE 0x01000000
61 #ifdef GLM_FORCE_PLATFORM_UNKNOWN
62 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
63 #elif defined(__QNXNTO__)
64 # define GLM_PLATFORM GLM_PLATFORM_QNXNTO
65 #elif defined(__APPLE__)
66 # define GLM_PLATFORM GLM_PLATFORM_APPLE
68 # define GLM_PLATFORM GLM_PLATFORM_WINCE
70 # define GLM_PLATFORM GLM_PLATFORM_WINDOWS
71 #elif defined(__native_client__)
72 # define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL
73 #elif defined(__ANDROID__)
74 # define GLM_PLATFORM GLM_PLATFORM_ANDROID
75 #elif defined(__linux)
76 # define GLM_PLATFORM GLM_PLATFORM_LINUX
78 # define GLM_PLATFORM GLM_PLATFORM_UNIX
80 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
84 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
85 # define GLM_MESSAGE_PLATFORM_DISPLAYED
86 # if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
87 # pragma message("GLM: QNX platform detected")
90 # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
91 # pragma message("GLM: Apple platform detected")
92 # elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
93 # pragma message("GLM: WinCE platform detected")
94 # elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
95 # pragma message("GLM: Windows platform detected")
96 # elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
97 # pragma message("GLM: Native Client detected")
98 # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
99 # pragma message("GLM: Android platform detected")
100 # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
101 # pragma message("GLM: Linux platform detected")
102 # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
103 # pragma message("GLM: UNIX platform detected")
104 # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
105 # pragma message("GLM: platform unknown")
107 # pragma message("GLM: platform not detected")
117 #define GLM_COMPILER_UNKNOWN 0x00000000
120 #define GLM_COMPILER_INTEL 0x00100000
121 #define GLM_COMPILER_INTEL12 0x00100010
122 #define GLM_COMPILER_INTEL12_1 0x00100020
123 #define GLM_COMPILER_INTEL13 0x00100030
124 #define GLM_COMPILER_INTEL14 0x00100040
125 #define GLM_COMPILER_INTEL15 0x00100050
128 #define GLM_COMPILER_VC 0x01000000
129 #define GLM_COMPILER_VC2010 0x01000090
130 #define GLM_COMPILER_VC2012 0x010000A0
131 #define GLM_COMPILER_VC2013 0x010000B0
132 #define GLM_COMPILER_VC2015 0x010000C0
135 #define GLM_COMPILER_GCC 0x02000000
136 #define GLM_COMPILER_GCC44 0x020000B0
137 #define GLM_COMPILER_GCC45 0x020000C0
138 #define GLM_COMPILER_GCC46 0x020000D0
139 #define GLM_COMPILER_GCC47 0x020000E0
140 #define GLM_COMPILER_GCC48 0x020000F0
141 #define GLM_COMPILER_GCC49 0x02000100
142 #define GLM_COMPILER_GCC50 0x02000200
145 #define GLM_COMPILER_CUDA 0x10000000
146 #define GLM_COMPILER_CUDA40 0x10000040
147 #define GLM_COMPILER_CUDA41 0x10000050
148 #define GLM_COMPILER_CUDA42 0x10000060
149 #define GLM_COMPILER_CUDA50 0x10000070
150 #define GLM_COMPILER_CUDA60 0x10000080
151 #define GLM_COMPILER_CUDA65 0x10000090
154 #define GLM_COMPILER_LLVM 0x20000000
155 #define GLM_COMPILER_LLVM32 0x20000030
156 #define GLM_COMPILER_LLVM33 0x20000040
157 #define GLM_COMPILER_LLVM34 0x20000050
158 #define GLM_COMPILER_LLVM35 0x20000060
161 #define GLM_COMPILER_APPLE_CLANG 0x40000000
162 #define GLM_COMPILER_APPLE_CLANG40 0x40000010
163 #define GLM_COMPILER_APPLE_CLANG41 0x40000020
164 #define GLM_COMPILER_APPLE_CLANG42 0x40000030
165 #define GLM_COMPILER_APPLE_CLANG50 0x40000040
166 #define GLM_COMPILER_APPLE_CLANG51 0x40000050
167 #define GLM_COMPILER_APPLE_CLANG60 0x40000060
170 #define GLM_MODEL_32 0x00000010
171 #define GLM_MODEL_64 0x00000020
174 #ifdef GLM_FORCE_COMPILER_UNKNOWN
175 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
177 #elif defined(__INTEL_COMPILER)
178 # if __INTEL_COMPILER == 1200
179 # define GLM_COMPILER GLM_COMPILER_INTEL12
180 # elif __INTEL_COMPILER == 1210
181 # define GLM_COMPILER GLM_COMPILER_INTEL12_1
182 # elif __INTEL_COMPILER == 1300
183 # define GLM_COMPILER GLM_COMPILER_INTEL13
184 # elif __INTEL_COMPILER == 1400
185 # define GLM_COMPILER GLM_COMPILER_INTEL14
186 # elif __INTEL_COMPILER >= 1500
187 # define GLM_COMPILER GLM_COMPILER_INTEL15
189 # define GLM_COMPILER GLM_COMPILER_INTEL
193 #elif defined(__CUDACC__)
194 # if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
197 # if CUDA_VERSION < 3000
198 # error "GLM requires CUDA 3.0 or higher"
200 # define GLM_COMPILER GLM_COMPILER_CUDA
204 #elif defined(_MSC_VER)
206 # error "GLM requires Visual C++ 2010 or higher"
207 # elif _MSC_VER == 1600
208 # define GLM_COMPILER GLM_COMPILER_VC2010
209 # elif _MSC_VER == 1700
210 # define GLM_COMPILER GLM_COMPILER_VC2012
211 # elif _MSC_VER == 1800
212 # define GLM_COMPILER GLM_COMPILER_VC2013
213 # elif _MSC_VER >= 1900
214 # define GLM_COMPILER GLM_COMPILER_VC2015
216 # define GLM_COMPILER GLM_COMPILER_VC
220 #elif defined(__clang__)
221 # if GLM_PLATFORM & GLM_PLATFORM_APPLE
222 # if __clang_major__ == 4 && __clang_minor__ == 0
223 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG40
224 # elif __clang_major__ == 4 && __clang_minor__ == 1
225 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG41
226 # elif __clang_major__ == 4 && __clang_minor__ == 2
227 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG42
228 # elif __clang_major__ == 5 && __clang_minor__ == 0
229 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG50
230 # elif __clang_major__ == 5 && __clang_minor__ == 1
231 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG51
232 # elif __clang_major__ >= 6
233 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG60
236 # if __clang_major__ == 3 && __clang_minor__ == 0
237 # define GLM_COMPILER GLM_COMPILER_LLVM30
238 # elif __clang_major__ == 3 && __clang_minor__ == 1
239 # define GLM_COMPILER GLM_COMPILER_LLVM31
240 # elif __clang_major__ == 3 && __clang_minor__ == 2
241 # define GLM_COMPILER GLM_COMPILER_LLVM32
242 # elif __clang_major__ == 3 && __clang_minor__ == 3
243 # define GLM_COMPILER GLM_COMPILER_LLVM33
244 # elif __clang_major__ == 3 && __clang_minor__ == 4
245 # define GLM_COMPILER GLM_COMPILER_LLVM34
246 # elif __clang_major__ == 3 && __clang_minor__ == 5
247 # define GLM_COMPILER GLM_COMPILER_LLVM35
249 # define GLM_COMPILER GLM_COMPILER_LLVM35
254 #elif defined(__GNUC__) || defined(__MINGW32__)
255 # if (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
256 # define GLM_COMPILER (GLM_COMPILER_GCC42)
257 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
258 # define GLM_COMPILER (GLM_COMPILER_GCC43)
259 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
260 # define GLM_COMPILER (GLM_COMPILER_GCC44)
261 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
262 # define GLM_COMPILER (GLM_COMPILER_GCC45)
263 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
264 # define GLM_COMPILER (GLM_COMPILER_GCC46)
265 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
266 # define GLM_COMPILER (GLM_COMPILER_GCC47)
267 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
268 # define GLM_COMPILER (GLM_COMPILER_GCC48)
269 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
270 # define GLM_COMPILER (GLM_COMPILER_GCC49)
271 # elif (__GNUC__ > 4 )
272 # define GLM_COMPILER (GLM_COMPILER_GCC50)
274 # define GLM_COMPILER (GLM_COMPILER_GCC)
278 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
282 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
286 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED)
287 # define GLM_MESSAGE_COMPILER_DISPLAYED
288 # if GLM_COMPILER & GLM_COMPILER_CUDA
289 # pragma message("GLM: CUDA compiler detected")
290 # elif GLM_COMPILER & GLM_COMPILER_VC
291 # pragma message("GLM: Visual C++ compiler detected")
292 # elif GLM_COMPILER & GLM_COMPILER_APPLE_CLANG
293 # pragma message("GLM: Clang compiler detected")
294 # elif GLM_COMPILER & GLM_COMPILER_LLVM
295 # pragma message("GLM: LLVM compiler detected")
296 # elif GLM_COMPILER & GLM_COMPILER_INTEL
297 # pragma message("GLM: Intel Compiler detected")
298 # elif GLM_COMPILER & GLM_COMPILER_GCC
299 # pragma message("GLM: GCC compiler detected")
301 # pragma message("GLM: Compiler not detected")
308 #if defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__)
309 # define GLM_MODEL GLM_MODEL_64
310 #elif defined(__i386__) || defined(__ppc__)
311 # define GLM_MODEL GLM_MODEL_32
313 # define GLM_MODEL GLM_MODEL_32
316 #if !defined(GLM_MODEL) && GLM_COMPILER != 0
317 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
320 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED)
321 # define GLM_MESSAGE_MODEL_DISPLAYED
322 # if(GLM_MODEL == GLM_MODEL_64)
323 # pragma message("GLM: 64 bits model")
324 # elif(GLM_MODEL == GLM_MODEL_32)
325 # pragma message("GLM: 32 bits model")
334 #define GLM_LANG_CXX98_FLAG (1 << 1)
335 #define GLM_LANG_CXX03_FLAG (1 << 2)
336 #define GLM_LANG_CXX0X_FLAG (1 << 3)
337 #define GLM_LANG_CXX11_FLAG (1 << 4)
338 #define GLM_LANG_CXX1Y_FLAG (1 << 5)
339 #define GLM_LANG_CXXMS_FLAG (1 << 6)
340 #define GLM_LANG_CXXGNU_FLAG (1 << 7)
342 #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG
343 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
344 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
345 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
346 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
347 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
348 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
350 #if defined(GLM_FORCE_CXX1Y)
351 # define GLM_LANG GLM_LANG_CXX1Y
352 #elif defined(GLM_FORCE_CXX11)
353 # define GLM_LANG GLM_LANG_CXX11
354 #elif defined(GLM_FORCE_CXX03)
355 # define GLM_LANG GLM_LANG_CXX03
356 #elif defined(GLM_FORCE_CXX98)
357 # define GLM_LANG GLM_LANG_CXX98
359 # if __cplusplus >= 201103L
360 # define GLM_LANG GLM_LANG_CXX11
361 # elif GLM_COMPILER & GLM_COMPILER_CLANG
362 # if(GLM_PLATFORM == GLM_PLATFORM_APPLE)
363 # define GLM_DETAIL_MAJOR 1
365 # define GLM_DETAIL_MAJOR 0
367 # if __clang_major__ < (2 + GLM_DETAIL_MAJOR)
368 # define GLM_LANG GLM_LANG_CXX
369 # elif __has_feature(cxx_auto_type)
370 # define GLM_LANG GLM_LANG_CXX0X
372 # define GLM_LANG GLM_LANG_CXX98
374 # elif GLM_COMPILER & GLM_COMPILER_GCC
375 # ifdef __GXX_EXPERIMENTAL_CXX0X__
376 # define GLM_LANG GLM_LANG_CXX0X
378 # define GLM_LANG GLM_LANG_CXX98
380 # elif GLM_COMPILER & GLM_COMPILER_VC
381 # ifdef _MSC_EXTENSIONS
382 # if GLM_COMPILER >= GLM_COMPILER_VC2010
383 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
385 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
388 # if GLM_COMPILER >= GLM_COMPILER_VC2010
389 # define GLM_LANG GLM_LANG_CXX0X
391 # define GLM_LANG GLM_LANG_CXX98
394 # elif GLM_COMPILER & GLM_COMPILER_INTEL
395 # ifdef _MSC_EXTENSIONS
396 # if GLM_COMPILER >= GLM_COMPILER_INTEL13
397 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
399 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
402 # if GLM_COMPILER >= GLM_COMPILER_INTEL13
403 # define GLM_LANG (GLM_LANG_CXX0X)
405 # define GLM_LANG (GLM_LANG_CXX98)
409 # if __cplusplus >= 199711L
410 # define GLM_LANG GLM_LANG_CXX98
412 # ifndef GLM_FORCE_CXX98
413 # define GLM_FORCE_CXX98
415 # ifndef GLM_FORCE_PURE
416 # define GLM_FORCE_PURE
421 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED)
422 # define GLM_MESSAGE_LANG_DISPLAYED
423 # if(GLM_LANG & GLM_LANG_CXXGNU_FLAG)
424 # pragma message("GLM: C++ with language extensions")
425 # elif(GLM_LANG & GLM_LANG_CXXMS_FLAG)
426 # pragma message("GLM: C++ with language extensions")
427 # elif(GLM_LANG & GLM_LANG_CXX11_FLAG)
428 # pragma message("GLM: C++11")
429 # elif(GLM_LANG & GLM_LANG_CXX0X_FLAG)
430 # pragma message("GLM: C++0x")
431 # elif(GLM_LANG & GLM_LANG_CXX03_FLAG)
432 # pragma message("GLM: C++03")
433 # elif(GLM_LANG & GLM_LANG_CXX98_FLAG)
434 # pragma message("GLM: C++98")
436 # pragma message("GLM: C++ language undetected")
438 # pragma message("GLM: #define GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_LANG_CXX11 or GLM_FORCE_CXX1Y to force using a specific version of the C++ language")
444 #ifndef __has_feature
445 # define __has_feature(x) 0 // Compatibility with non-clang compilers.
447 #ifndef __has_extension
448 # define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
456 #define GLM_HAS_CXX11_STL ( \
457 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
458 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015)))
461 #define GLM_HAS_STATIC_ASSERT ( \
462 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
463 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)) || \
464 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
465 __has_feature(cxx_static_assert))
468 #define GLM_HAS_EXTENDED_INTEGER_TYPE ( \
469 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
470 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
471 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
472 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_LLVM) && (GLM_COMPILER >= GLM_COMPILER_LLVM30)) || \
473 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_APPLE_CLANG) && (GLM_COMPILER >= GLM_COMPILER_APPLE_CLANG40)))
476 #define GLM_HAS_CONSTEXPR ( \
477 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
478 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
479 __has_feature(cxx_constexpr))
482 #define GLM_HAS_INITIALIZER_LISTS ( \
483 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
484 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
485 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
486 __has_feature(cxx_generalized_initializers))
489 #define GLM_HAS_UNRESTRICTED_UNIONS ( \
490 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
491 (GLM_LANG & GLM_LANG_CXXMS_FLAG) || \
492 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
493 __has_feature(cxx_unrestricted_unions))
496 #define GLM_HAS_DEFAULTED_FUNCTIONS ( \
497 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
498 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
499 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
500 __has_feature(cxx_defaulted_functions))
503 #define GLM_HAS_RVALUE_REFERENCES ( \
504 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
505 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))) || \
506 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
507 __has_feature(cxx_rvalue_references))
509 #define GLM_HAS_STL_ARRAY ( \
510 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
511 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010))) || \
512 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)))
514 #define GLM_HAS_TEMPLATE_ALIASES ( \
515 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
516 __has_feature(cxx_alias_templates))
518 #define GLM_HAS_RANGE_FOR ( \
519 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
520 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))) || \
521 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
522 __has_feature(cxx_range_for))
524 #define GLM_HAS_ASSIGNABLE ( \
525 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
526 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
528 #define GLM_HAS_TRIVIAL_QUERIES ( \
529 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
531 #define GLM_HAS_MAKE_SIGNED ( \
532 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
533 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
535 #define GLM_HAS_BITSCAN_WINDOWS ( \
536 (GLM_ARCH != GLM_ARCH_PURE) && \
537 (GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && \
538 (GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL)))
542 # if GLM_COMPILER & GLM_COMPILER_GCC
543 # if GLM_COMPILER >= GLM_COMPILER_GCC47
544 # define GLM_HAS_OPENMP 31
545 # elif GLM_COMPILER >= GLM_COMPILER_GCC44
546 # define GLM_HAS_OPENMP 30
547 # elif GLM_COMPILER >= GLM_COMPILER_GCC42
548 # define GLM_HAS_OPENMP 25
550 # endif// GLM_COMPILER & GLM_COMPILER_GCC
552 # if GLM_COMPILER & GLM_COMPILER_VC
553 # if GLM_COMPILER >= GLM_COMPILER_VC2010
554 # define GLM_HAS_OPENMP 20
556 # endif// GLM_COMPILER & GLM_COMPILER_VC
560 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
567 #define GLM_ARCH_PURE 0x0000
568 #define GLM_ARCH_X86 0x0001
569 #define GLM_ARCH_SSE2 0x0002
570 #define GLM_ARCH_SSE3 0x0004
571 #define GLM_ARCH_SSE4 0x0008
572 #define GLM_ARCH_AVX 0x0010
573 #define GLM_ARCH_AVX2 0x0020
575 #if defined(GLM_FORCE_PURE)
576 # define GLM_ARCH GLM_ARCH_PURE
577 #elif defined(GLM_FORCE_AVX2)
578 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
579 #elif defined(GLM_FORCE_AVX)
580 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
581 #elif defined(GLM_FORCE_SSE4)
582 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
583 #elif defined(GLM_FORCE_SSE3)
584 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
585 #elif defined(GLM_FORCE_SSE2)
586 # define GLM_ARCH (GLM_ARCH_SSE2)
587 #elif (GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_LINUX))
589 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
591 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
593 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
595 # define GLM_ARCH (GLM_ARCH_SSE2)
597 # define GLM_ARCH GLM_ARCH_PURE
599 #elif (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
600 # if defined(__AVX2__)
601 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
602 # elif defined(__AVX__)
603 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
604 # elif _M_IX86_FP == 2
605 # define GLM_ARCH (GLM_ARCH_SSE2)
607 # define GLM_ARCH (GLM_ARCH_PURE)
609 #elif (GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))
610 # if defined(__AVX2__)
611 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
612 # elif defined(__AVX__)
613 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
614 # elif defined(__SSE4_1__ )
615 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
616 # elif defined(__SSE3__)
617 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
618 # elif defined(__SSE2__)
619 # define GLM_ARCH (GLM_ARCH_SSE2)
621 # define GLM_ARCH (GLM_ARCH_PURE)
624 # define GLM_ARCH GLM_ARCH_PURE
630 #if defined(__MINGW32__) && (GLM_ARCH != GLM_ARCH_PURE)
634 #if GLM_ARCH & GLM_ARCH_AVX2
635 # include <immintrin.h>
637 #if GLM_ARCH & GLM_ARCH_AVX
638 # include <immintrin.h>
640 #if GLM_ARCH & GLM_ARCH_SSE4
641 # include <smmintrin.h>
643 #if GLM_ARCH & GLM_ARCH_SSE3
644 # include <pmmintrin.h>
646 #if GLM_ARCH & GLM_ARCH_SSE2
647 # include <emmintrin.h>
648 # if(GLM_COMPILER == GLM_COMPILER_VC2005) // VC2005 is missing some intrinsics, workaround
649 inline float _mm_cvtss_f32(__m128 A) {
return A.m128_f32[0]; }
650 inline __m128 _mm_castpd_ps(__m128d PD) {
union { __m128 ps; __m128d pd; } c; c.pd = PD;
return c.ps; }
651 inline __m128d _mm_castps_pd(__m128 PS) {
union { __m128 ps; __m128d pd; } c; c.ps = PS;
return c.pd; }
652 inline __m128i _mm_castps_si128(__m128 PS) {
union { __m128 ps; __m128i
pi; } c; c.ps = PS;
return c.pi; }
653 inline __m128 _mm_castsi128_ps(__m128i PI) {
union { __m128 ps; __m128i
pi; } c; c.pi = PI;
return c.ps; }
657 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
658 # define GLM_MESSAGE_ARCH_DISPLAYED
659 # if(GLM_ARCH == GLM_ARCH_PURE)
660 # pragma message("GLM: Platform independent code")
661 # elif(GLM_ARCH & GLM_ARCH_AVX2)
662 # pragma message("GLM: AVX2 instruction set")
663 # elif(GLM_ARCH & GLM_ARCH_AVX)
664 # pragma message("GLM: AVX instruction set")
665 # elif(GLM_ARCH & GLM_ARCH_SSE3)
666 # pragma message("GLM: SSE3 instruction set")
667 # elif(GLM_ARCH & GLM_ARCH_SSE2)
668 # pragma message("GLM: SSE2 instruction set")
670 # pragma message("GLM: #define GLM_FORCE_PURE to avoid using platform specific instruction sets")
676 #if GLM_HAS_STATIC_ASSERT
677 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
678 #elif defined(BOOST_STATIC_ASSERT)
679 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
680 #elif GLM_COMPILER & GLM_COMPILER_VC
681 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
683 # define GLM_STATIC_ASSERT(x, message)
684 # define GLM_STATIC_ASSERT_NULL
690 #if GLM_COMPILER & GLM_COMPILER_CUDA
691 # define GLM_CUDA_FUNC_DEF __device__ __host__
692 # define GLM_CUDA_FUNC_DECL __device__ __host__
694 # define GLM_CUDA_FUNC_DEF
695 # define GLM_CUDA_FUNC_DECL
698 #if GLM_COMPILER & GLM_COMPILER_GCC
699 # define GLM_VAR_USED __attribute__ ((unused))
701 # define GLM_VAR_USED
704 #if defined(GLM_FORCE_INLINE)
705 # if GLM_COMPILER & GLM_COMPILER_VC
706 # define GLM_INLINE __forceinline
707 # define GLM_NEVER_INLINE __declspec((noinline))
708 # elif GLM_COMPILER & GLM_COMPILER_GCC
709 # define GLM_INLINE inline __attribute__((__always_inline__))
710 # define GLM_NEVER_INLINE __attribute__((__noinline__))
711 # elif GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)
712 # define GLM_INLINE __attribute__((__always_inline__))
713 # define GLM_NEVER_INLINE __attribute__((__noinline__))
715 # define GLM_INLINE inline
716 # define GLM_NEVER_INLINE
717 # endif//GLM_COMPILER
719 # define GLM_INLINE inline
720 # define GLM_NEVER_INLINE
721 #endif//defined(GLM_FORCE_INLINE)
723 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
724 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
731 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)
732 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
733 # if defined(GLM_SWIZZLE)
734 # pragma message("GLM: Swizzling operators enabled")
736 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
743 #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
744 # define GLM_DEPRECATED __declspec(deprecated)
745 # define GLM_ALIGN(x) __declspec(align(x))
746 # define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x))
747 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name
748 # define GLM_RESTRICT __declspec(restrict)
749 # define GLM_RESTRICT_VAR __restrict
750 #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_CUDA | GLM_COMPILER_INTEL)
751 # define GLM_DEPRECATED __attribute__((__deprecated__))
752 # define GLM_ALIGN(x) __attribute__((aligned(x)))
753 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
754 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment)))
755 # define GLM_RESTRICT __restrict__
756 # define GLM_RESTRICT_VAR __restrict__
758 # define GLM_DEPRECATED
760 # define GLM_ALIGNED_STRUCT(x) struct
761 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name
762 # define GLM_RESTRICT
763 # define GLM_RESTRICT_VAR
766 #if GLM_HAS_CONSTEXPR
767 # define GLM_CONSTEXPR constexpr
769 # define GLM_CONSTEXPR
780 #if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC)
781 typedef size_t length_t;
783 typedef int length_t;
788 # ifdef GLM_FORCE_SIZE_FUNC
789 typedef size_t component_count_t;
791 typedef length_t component_count_t;
794 template <
typename genType>
795 GLM_FUNC_QUALIFIER GLM_CONSTEXPR component_count_t component_count(genType
const & m)
797 # ifdef GLM_FORCE_SIZE_FUNC
806 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH)
807 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
808 # if defined(GLM_FORCE_SIZE_T_LENGTH)
809 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
811 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
812 # pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a size_t")
821 enum ctor{uninitialize};
GLM_FUNC_DECL genType pi()
Return the pi constant.