37 #define GLM_VERSION 96
38 #define GLM_VERSION_MAJOR 0
39 #define GLM_VERSION_MINOR 9
40 #define GLM_VERSION_PATCH 6
41 #define GLM_VERSION_REVISION 0
46 #define GLM_PLATFORM_UNKNOWN 0x00000000
47 #define GLM_PLATFORM_WINDOWS 0x00010000
48 #define GLM_PLATFORM_LINUX 0x00020000
49 #define GLM_PLATFORM_APPLE 0x00040000
51 #define GLM_PLATFORM_ANDROID 0x00100000
52 #define GLM_PLATFORM_CHROME_NACL 0x00200000
53 #define GLM_PLATFORM_UNIX 0x00400000
54 #define GLM_PLATFORM_QNXNTO 0x00800000
55 #define GLM_PLATFORM_WINCE 0x01000000
57 #ifdef GLM_FORCE_PLATFORM_UNKNOWN
58 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
59 #elif defined(__QNXNTO__)
60 # define GLM_PLATFORM GLM_PLATFORM_QNXNTO
61 #elif defined(__APPLE__)
62 # define GLM_PLATFORM GLM_PLATFORM_APPLE
64 # define GLM_PLATFORM GLM_PLATFORM_WINCE
66 # define GLM_PLATFORM GLM_PLATFORM_WINDOWS
67 #elif defined(__native_client__)
68 # define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL
69 #elif defined(__ANDROID__)
70 # define GLM_PLATFORM GLM_PLATFORM_ANDROID
71 #elif defined(__linux)
72 # define GLM_PLATFORM GLM_PLATFORM_LINUX
74 # define GLM_PLATFORM GLM_PLATFORM_UNIX
76 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
80 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
81 # define GLM_MESSAGE_PLATFORM_DISPLAYED
82 # if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
83 # pragma message("GLM: QNX platform detected")
86 # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
87 # pragma message("GLM: Apple platform detected")
88 # elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
89 # pragma message("GLM: WinCE platform detected")
90 # elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
91 # pragma message("GLM: Windows platform detected")
92 # elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
93 # pragma message("GLM: Native Client detected")
94 # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
95 # pragma message("GLM: Android platform detected")
96 # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
97 # pragma message("GLM: Linux platform detected")
98 # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
99 # pragma message("GLM: UNIX platform detected")
100 # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
101 # pragma message("GLM: platform unknown")
103 # pragma message("GLM: platform not detected")
113 #define GLM_COMPILER_UNKNOWN 0x00000000
116 #define GLM_COMPILER_INTEL 0x00100000
117 #define GLM_COMPILER_INTEL12 0x00100010
118 #define GLM_COMPILER_INTEL12_1 0x00100020
119 #define GLM_COMPILER_INTEL13 0x00100030
120 #define GLM_COMPILER_INTEL14 0x00100040
121 #define GLM_COMPILER_INTEL15 0x00100050
124 #define GLM_COMPILER_VC 0x01000000
125 #define GLM_COMPILER_VC2010 0x01000090
126 #define GLM_COMPILER_VC2012 0x010000A0
127 #define GLM_COMPILER_VC2013 0x010000B0
128 #define GLM_COMPILER_VC2015 0x010000C0
131 #define GLM_COMPILER_GCC 0x02000000
132 #define GLM_COMPILER_GCC42 0x02000090
133 #define GLM_COMPILER_GCC43 0x020000A0
134 #define GLM_COMPILER_GCC44 0x020000B0
135 #define GLM_COMPILER_GCC45 0x020000C0
136 #define GLM_COMPILER_GCC46 0x020000D0
137 #define GLM_COMPILER_GCC47 0x020000E0
138 #define GLM_COMPILER_GCC48 0x020000F0
139 #define GLM_COMPILER_GCC49 0x02000100
140 #define GLM_COMPILER_GCC50 0x02000200
143 #define GLM_COMPILER_CUDA 0x10000000
144 #define GLM_COMPILER_CUDA30 0x10000010
145 #define GLM_COMPILER_CUDA31 0x10000020
146 #define GLM_COMPILER_CUDA32 0x10000030
147 #define GLM_COMPILER_CUDA40 0x10000040
148 #define GLM_COMPILER_CUDA41 0x10000050
149 #define GLM_COMPILER_CUDA42 0x10000060
150 #define GLM_COMPILER_CUDA50 0x10000070
151 #define GLM_COMPILER_CUDA60 0x10000080
152 #define GLM_COMPILER_CUDA65 0x10000090
155 #define GLM_COMPILER_LLVM 0x20000000
156 #define GLM_COMPILER_LLVM30 0x20000010
157 #define GLM_COMPILER_LLVM31 0x20000020
158 #define GLM_COMPILER_LLVM32 0x20000030
159 #define GLM_COMPILER_LLVM33 0x20000040
160 #define GLM_COMPILER_LLVM34 0x20000050
161 #define GLM_COMPILER_LLVM35 0x20000060
164 #define GLM_COMPILER_APPLE_CLANG 0x40000000
165 #define GLM_COMPILER_APPLE_CLANG40 0x40000010
166 #define GLM_COMPILER_APPLE_CLANG41 0x40000020
167 #define GLM_COMPILER_APPLE_CLANG42 0x40000030
168 #define GLM_COMPILER_APPLE_CLANG50 0x40000040
169 #define GLM_COMPILER_APPLE_CLANG51 0x40000050
170 #define GLM_COMPILER_APPLE_CLANG60 0x40000060
173 #define GLM_MODEL_32 0x00000010
174 #define GLM_MODEL_64 0x00000020
177 #ifdef GLM_FORCE_COMPILER_UNKNOWN
178 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
180 #elif defined(__INTEL_COMPILER)
181 # if __INTEL_COMPILER == 1200
182 # define GLM_COMPILER GLM_COMPILER_INTEL12
183 # elif __INTEL_COMPILER == 1210
184 # define GLM_COMPILER GLM_COMPILER_INTEL12_1
185 # elif __INTEL_COMPILER == 1300
186 # define GLM_COMPILER GLM_COMPILER_INTEL13
187 # elif __INTEL_COMPILER == 1400
188 # define GLM_COMPILER GLM_COMPILER_INTEL14
189 # elif __INTEL_COMPILER >= 1500
190 # define GLM_COMPILER GLM_COMPILER_INTEL15
192 # define GLM_COMPILER GLM_COMPILER_INTEL
196 #elif defined(__CUDACC__)
197 # if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
200 # if CUDA_VERSION < 3000
201 # error "GLM requires CUDA 3.0 or higher"
203 # define GLM_COMPILER GLM_COMPILER_CUDA
207 #elif defined(_MSC_VER)
209 # error "GLM requires Visual C++ 2010 or higher"
210 # elif _MSC_VER == 1600
211 # define GLM_COMPILER GLM_COMPILER_VC2010
212 # elif _MSC_VER == 1700
213 # define GLM_COMPILER GLM_COMPILER_VC2012
214 # elif _MSC_VER == 1800
215 # define GLM_COMPILER GLM_COMPILER_VC2013
216 # elif _MSC_VER >= 1900
217 # define GLM_COMPILER GLM_COMPILER_VC2015
219 # define GLM_COMPILER GLM_COMPILER_VC
223 #elif defined(__clang__)
224 # if GLM_PLATFORM & GLM_PLATFORM_APPLE
225 # if __clang_major__ == 4 && __clang_minor__ == 0
226 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG40
227 # elif __clang_major__ == 4 && __clang_minor__ == 1
228 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG41
229 # elif __clang_major__ == 4 && __clang_minor__ == 2
230 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG42
231 # elif __clang_major__ == 5 && __clang_minor__ == 0
232 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG50
233 # elif __clang_major__ == 5 && __clang_minor__ == 1
234 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG51
235 # elif __clang_major__ >= 6
236 # define GLM_COMPILER GLM_COMPILER_APPLE_CLANG60
239 # if __clang_major__ == 3 && __clang_minor__ == 0
240 # define GLM_COMPILER GLM_COMPILER_LLVM30
241 # elif __clang_major__ == 3 && __clang_minor__ == 1
242 # define GLM_COMPILER GLM_COMPILER_LLVM31
243 # elif __clang_major__ == 3 && __clang_minor__ == 2
244 # define GLM_COMPILER GLM_COMPILER_LLVM32
245 # elif __clang_major__ == 3 && __clang_minor__ == 3
246 # define GLM_COMPILER GLM_COMPILER_LLVM33
247 # elif __clang_major__ == 3 && __clang_minor__ == 4
248 # define GLM_COMPILER GLM_COMPILER_LLVM34
249 # elif __clang_major__ == 3 && __clang_minor__ == 5
250 # define GLM_COMPILER GLM_COMPILER_LLVM35
252 # define GLM_COMPILER GLM_COMPILER_LLVM35
257 #elif defined(__GNUC__) || defined(__MINGW32__)
258 # if (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
259 # define GLM_COMPILER (GLM_COMPILER_GCC42)
260 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
261 # define GLM_COMPILER (GLM_COMPILER_GCC43)
262 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
263 # define GLM_COMPILER (GLM_COMPILER_GCC44)
264 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
265 # define GLM_COMPILER (GLM_COMPILER_GCC45)
266 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
267 # define GLM_COMPILER (GLM_COMPILER_GCC46)
268 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
269 # define GLM_COMPILER (GLM_COMPILER_GCC47)
270 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
271 # define GLM_COMPILER (GLM_COMPILER_GCC48)
272 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
273 # define GLM_COMPILER (GLM_COMPILER_GCC49)
274 # elif (__GNUC__ > 4 )
275 # define GLM_COMPILER (GLM_COMPILER_GCC50)
277 # define GLM_COMPILER (GLM_COMPILER_GCC)
281 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
285 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
289 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED)
290 # define GLM_MESSAGE_COMPILER_DISPLAYED
291 # if GLM_COMPILER & GLM_COMPILER_CUDA
292 # pragma message("GLM: CUDA compiler detected")
293 # elif GLM_COMPILER & GLM_COMPILER_VC
294 # pragma message("GLM: Visual C++ compiler detected")
295 # elif GLM_COMPILER & GLM_COMPILER_APPLE_CLANG
296 # pragma message("GLM: Clang compiler detected")
297 # elif GLM_COMPILER & GLM_COMPILER_LLVM
298 # pragma message("GLM: LLVM compiler detected")
299 # elif GLM_COMPILER & GLM_COMPILER_INTEL
300 # pragma message("GLM: Intel Compiler detected")
301 # elif GLM_COMPILER & GLM_COMPILER_GCC
302 # pragma message("GLM: GCC compiler detected")
304 # pragma message("GLM: Compiler not detected")
311 #if defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__)
312 # define GLM_MODEL GLM_MODEL_64
313 #elif defined(__i386__) || defined(__ppc__)
314 # define GLM_MODEL GLM_MODEL_32
316 # define GLM_MODEL GLM_MODEL_32
319 #if !defined(GLM_MODEL) && GLM_COMPILER != 0
320 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
323 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED)
324 # define GLM_MESSAGE_MODEL_DISPLAYED
325 # if(GLM_MODEL == GLM_MODEL_64)
326 # pragma message("GLM: 64 bits model")
327 # elif(GLM_MODEL == GLM_MODEL_32)
328 # pragma message("GLM: 32 bits model")
337 #define GLM_LANG_CXX98_FLAG (1 << 1)
338 #define GLM_LANG_CXX03_FLAG (1 << 2)
339 #define GLM_LANG_CXX0X_FLAG (1 << 3)
340 #define GLM_LANG_CXX11_FLAG (1 << 4)
341 #define GLM_LANG_CXX1Y_FLAG (1 << 5)
342 #define GLM_LANG_CXXMS_FLAG (1 << 6)
343 #define GLM_LANG_CXXGNU_FLAG (1 << 7)
345 #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG
346 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
347 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
348 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
349 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
350 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
351 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
353 #if defined(GLM_FORCE_CXX1Y)
354 # define GLM_LANG GLM_LANG_CXX1Y
355 #elif defined(GLM_FORCE_CXX11)
356 # define GLM_LANG GLM_LANG_CXX11
357 #elif defined(GLM_FORCE_CXX03)
358 # define GLM_LANG GLM_LANG_CXX03
359 #elif defined(GLM_FORCE_CXX98)
360 # define GLM_LANG GLM_LANG_CXX98
362 # if __cplusplus >= 201103L
363 # define GLM_LANG GLM_LANG_CXX11
364 # elif GLM_COMPILER & GLM_COMPILER_CLANG
365 # if(GLM_PLATFORM == GLM_PLATFORM_APPLE)
366 # define GLM_DETAIL_MAJOR 1
368 # define GLM_DETAIL_MAJOR 0
370 # if __clang_major__ < (2 + GLM_DETAIL_MAJOR)
371 # define GLM_LANG GLM_LANG_CXX
372 # elif __has_feature(cxx_auto_type)
373 # define GLM_LANG GLM_LANG_CXX0X
375 # define GLM_LANG GLM_LANG_CXX98
377 # elif GLM_COMPILER & GLM_COMPILER_GCC
378 # ifdef __GXX_EXPERIMENTAL_CXX0X__
379 # define GLM_LANG GLM_LANG_CXX0X
381 # define GLM_LANG GLM_LANG_CXX98
383 # elif GLM_COMPILER & GLM_COMPILER_VC
384 # ifdef _MSC_EXTENSIONS
385 # if GLM_COMPILER >= GLM_COMPILER_VC2010
386 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
388 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
391 # if GLM_COMPILER >= GLM_COMPILER_VC2010
392 # define GLM_LANG GLM_LANG_CXX0X
394 # define GLM_LANG GLM_LANG_CXX98
397 # elif GLM_COMPILER & GLM_COMPILER_INTEL
398 # ifdef _MSC_EXTENSIONS
399 # if GLM_COMPILER >= GLM_COMPILER_INTEL13
400 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
402 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
405 # if GLM_COMPILER >= GLM_COMPILER_INTEL13
406 # define GLM_LANG (GLM_LANG_CXX0X)
408 # define GLM_LANG (GLM_LANG_CXX98)
412 # if __cplusplus >= 199711L
413 # define GLM_LANG GLM_LANG_CXX98
415 # ifndef GLM_FORCE_CXX98
416 # define GLM_FORCE_CXX98
418 # ifndef GLM_FORCE_PURE
419 # define GLM_FORCE_PURE
424 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED)
425 # define GLM_MESSAGE_LANG_DISPLAYED
426 # if(GLM_LANG & GLM_LANG_CXXGNU_FLAG)
427 # pragma message("GLM: C++ with language extensions")
428 # elif(GLM_LANG & GLM_LANG_CXXMS_FLAG)
429 # pragma message("GLM: C++ with language extensions")
430 # elif(GLM_LANG & GLM_LANG_CXX11_FLAG)
431 # pragma message("GLM: C++11")
432 # elif(GLM_LANG & GLM_LANG_CXX0X_FLAG)
433 # pragma message("GLM: C++0x")
434 # elif(GLM_LANG & GLM_LANG_CXX03_FLAG)
435 # pragma message("GLM: C++03")
436 # elif(GLM_LANG & GLM_LANG_CXX98_FLAG)
437 # pragma message("GLM: C++98")
439 # pragma message("GLM: C++ language undetected")
441 # 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")
447 #ifndef __has_feature
448 # define __has_feature(x) 0 // Compatibility with non-clang compilers.
450 #ifndef __has_extension
451 # define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
459 #define GLM_HAS_CXX11_STL ( \
460 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
461 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015)))
464 #define GLM_HAS_STATIC_ASSERT ( \
465 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
466 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)) || \
467 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
468 __has_feature(cxx_static_assert))
471 #define GLM_HAS_EXTENDED_INTEGER_TYPE ( \
472 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
473 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
474 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
475 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_LLVM) && (GLM_COMPILER >= GLM_COMPILER_LLVM30)) || \
476 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_APPLE_CLANG) && (GLM_COMPILER >= GLM_COMPILER_APPLE_CLANG40)))
479 #define GLM_HAS_CONSTEXPR ( \
480 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
481 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
482 __has_feature(cxx_constexpr))
485 #define GLM_HAS_INITIALIZER_LISTS ( \
486 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
487 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
488 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
489 __has_feature(cxx_generalized_initializers))
492 #define GLM_HAS_UNRESTRICTED_UNIONS ( \
493 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
494 (GLM_LANG & GLM_LANG_CXXMS_FLAG) || \
495 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
496 __has_feature(cxx_unrestricted_unions))
499 #define GLM_HAS_DEFAULTED_FUNCTIONS ( \
500 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
501 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
502 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
503 __has_feature(cxx_defaulted_functions))
506 #define GLM_HAS_RVALUE_REFERENCES ( \
507 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
508 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))) || \
509 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
510 __has_feature(cxx_rvalue_references))
512 #define GLM_HAS_STL_ARRAY ( \
513 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
514 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010))) || \
515 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)))
517 #define GLM_HAS_TEMPLATE_ALIASES ( \
518 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
519 __has_feature(cxx_alias_templates))
521 #define GLM_HAS_RANGE_FOR ( \
522 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
523 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))) || \
524 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
525 __has_feature(cxx_range_for))
527 #define GLM_HAS_ASSIGNABLE ( \
528 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
529 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
531 #define GLM_HAS_TRIVIAL_QUERIES (\
532 ((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_COMPILER & GLM_COMPILER_GCC)) || \
533 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
535 #define GLM_HAS_MAKE_SIGNED (\
536 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
537 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
541 # if GLM_COMPILER & GLM_COMPILER_GCC
542 # if GLM_COMPILER >= GLM_COMPILER_GCC47
543 # define GLM_HAS_OPENMP 31
544 # elif GLM_COMPILER >= GLM_COMPILER_GCC44
545 # define GLM_HAS_OPENMP 30
546 # elif GLM_COMPILER >= GLM_COMPILER_GCC42
547 # define GLM_HAS_OPENMP 25
549 # endif// GLM_COMPILER & GLM_COMPILER_GCC
551 # if GLM_COMPILER & GLM_COMPILER_VC
552 # if GLM_COMPILER >= GLM_COMPILER_VC2010
553 # define GLM_HAS_OPENMP 20
555 # endif// GLM_COMPILER & GLM_COMPILER_VC
559 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
566 #define GLM_ARCH_PURE 0x0000
567 #define GLM_ARCH_X86 0x0001
568 #define GLM_ARCH_SSE2 0x0002
569 #define GLM_ARCH_SSE3 0x0004
570 #define GLM_ARCH_SSE4 0x0008
571 #define GLM_ARCH_AVX 0x0010
572 #define GLM_ARCH_AVX2 0x0020
574 #if defined(GLM_FORCE_PURE)
575 # define GLM_ARCH GLM_ARCH_PURE
576 #elif defined(GLM_FORCE_AVX2)
577 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
578 #elif defined(GLM_FORCE_AVX)
579 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
580 #elif defined(GLM_FORCE_SSE4)
581 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
582 #elif defined(GLM_FORCE_SSE3)
583 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
584 #elif defined(GLM_FORCE_SSE2)
585 # define GLM_ARCH (GLM_ARCH_SSE2)
586 #elif GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)
588 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
590 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
592 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
594 # define GLM_ARCH (GLM_ARCH_SSE2)
596 # define GLM_ARCH GLM_ARCH_PURE
598 #elif GLM_COMPILER & GLM_COMPILER_VC
599 # if defined(__AVX2__)
600 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
601 # elif defined(__AVX__)
602 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
603 # elif _M_IX86_FP == 2
604 # define GLM_ARCH (GLM_ARCH_SSE2)
606 # define GLM_ARCH (GLM_ARCH_PURE)
608 #elif (GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))
609 # if defined(__AVX2__)
610 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
611 # elif defined(__AVX__)
612 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
613 # elif defined(__SSE4_1__ )
614 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
615 # elif defined(__SSE3__)
616 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
617 # elif defined(__SSE2__)
618 # define GLM_ARCH (GLM_ARCH_SSE2)
620 # define GLM_ARCH (GLM_ARCH_PURE)
623 # define GLM_ARCH GLM_ARCH_PURE
629 #if defined(__MINGW32__) && (GLM_ARCH != GLM_ARCH_PURE)
633 #if GLM_ARCH & GLM_ARCH_AVX2
634 # include <immintrin.h>
636 #if GLM_ARCH & GLM_ARCH_AVX
637 # include <immintrin.h>
639 #if GLM_ARCH & GLM_ARCH_SSE4
640 # include <smmintrin.h>
642 #if GLM_ARCH & GLM_ARCH_SSE3
643 # include <pmmintrin.h>
645 #if GLM_ARCH & GLM_ARCH_SSE2
646 # include <emmintrin.h>
647 # if(GLM_COMPILER == GLM_COMPILER_VC2005) // VC2005 is missing some intrinsics, workaround
648 inline float _mm_cvtss_f32(__m128 A) {
return A.m128_f32[0]; }
649 inline __m128 _mm_castpd_ps(__m128d PD) {
union { __m128 ps; __m128d pd; } c; c.pd = PD;
return c.ps; }
650 inline __m128d _mm_castps_pd(__m128 PS) {
union { __m128 ps; __m128d pd; } c; c.ps = PS;
return c.pd; }
651 inline __m128i _mm_castps_si128(__m128 PS) {
union { __m128 ps; __m128i
pi; } c; c.ps = PS;
return c.pi; }
652 inline __m128 _mm_castsi128_ps(__m128i PI) {
union { __m128 ps; __m128i
pi; } c; c.pi = PI;
return c.ps; }
656 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
657 # define GLM_MESSAGE_ARCH_DISPLAYED
658 # if(GLM_ARCH == GLM_ARCH_PURE)
659 # pragma message("GLM: Platform independent code")
660 # elif(GLM_ARCH & GLM_ARCH_AVX2)
661 # pragma message("GLM: AVX2 instruction set")
662 # elif(GLM_ARCH & GLM_ARCH_AVX)
663 # pragma message("GLM: AVX instruction set")
664 # elif(GLM_ARCH & GLM_ARCH_SSE3)
665 # pragma message("GLM: SSE3 instruction set")
666 # elif(GLM_ARCH & GLM_ARCH_SSE2)
667 # pragma message("GLM: SSE2 instruction set")
669 # pragma message("GLM: #define GLM_FORCE_PURE to avoid using platform specific instruction sets")
675 #if GLM_HAS_STATIC_ASSERT
676 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
677 #elif defined(BOOST_STATIC_ASSERT)
678 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
679 #elif GLM_COMPILER & GLM_COMPILER_VC
680 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
682 # define GLM_STATIC_ASSERT(x, message)
683 # define GLM_STATIC_ASSERT_NULL
689 #if GLM_COMPILER & GLM_COMPILER_CUDA
690 # define GLM_CUDA_FUNC_DEF __device__ __host__
691 # define GLM_CUDA_FUNC_DECL __device__ __host__
693 # define GLM_CUDA_FUNC_DEF
694 # define GLM_CUDA_FUNC_DECL
697 #if GLM_COMPILER & GLM_COMPILER_GCC
698 # define GLM_VAR_USED __attribute__ ((unused))
700 # define GLM_VAR_USED
703 #if defined(GLM_FORCE_INLINE)
704 # if GLM_COMPILER & GLM_COMPILER_VC
705 # define GLM_INLINE __forceinline
706 # define GLM_NEVER_INLINE __declspec((noinline))
707 # elif GLM_COMPILER & GLM_COMPILER_GCC
708 # define GLM_INLINE inline __attribute__((__always_inline__))
709 # define GLM_NEVER_INLINE __attribute__((__noinline__))
710 # elif GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)
711 # define GLM_INLINE __attribute__((__always_inline__))
712 # define GLM_NEVER_INLINE __attribute__((__noinline__))
714 # define GLM_INLINE inline
715 # define GLM_NEVER_INLINE
716 # endif//GLM_COMPILER
718 # define GLM_INLINE inline
719 # define GLM_NEVER_INLINE
720 #endif//defined(GLM_FORCE_INLINE)
722 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
723 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
730 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)
731 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
732 # if defined(GLM_SWIZZLE)
733 # pragma message("GLM: Swizzling operators enabled")
735 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
742 #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
743 # define GLM_DEPRECATED __declspec(deprecated)
744 # define GLM_ALIGN(x) __declspec(align(x))
745 # define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x))
746 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name
747 # define GLM_RESTRICT __declspec(restrict)
748 # define GLM_RESTRICT_VAR __restrict
749 #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_CUDA | GLM_COMPILER_INTEL)
750 # define GLM_DEPRECATED __attribute__((__deprecated__))
751 # define GLM_ALIGN(x) __attribute__((aligned(x)))
752 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
753 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment)))
754 # define GLM_RESTRICT __restrict__
755 # define GLM_RESTRICT_VAR __restrict__
757 # define GLM_DEPRECATED
759 # define GLM_ALIGNED_STRUCT(x) struct
760 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name
761 # define GLM_RESTRICT
762 # define GLM_RESTRICT_VAR
765 #if GLM_HAS_CONSTEXPR
766 # define GLM_CONSTEXPR constexpr
768 # define GLM_CONSTEXPR
779 #if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC)
780 typedef size_t length_t;
782 typedef int length_t;
787 # ifdef GLM_FORCE_SIZE_FUNC
788 typedef size_t component_count_t;
790 typedef length_t component_count_t;
793 template <
typename genType>
794 GLM_FUNC_QUALIFIER GLM_CONSTEXPR component_count_t component_count(genType
const & m)
796 # ifdef GLM_FORCE_SIZE_FUNC
805 #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH)
806 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
807 # if defined(GLM_FORCE_SIZE_T_LENGTH)
808 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
810 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
811 # pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a size_t")
820 enum ctor{uninitialize};
GLM_FUNC_DECL genType pi()
Return the pi constant.