36 #define GLM_VERSION 96
37 #define GLM_VERSION_MAJOR 0
38 #define GLM_VERSION_MINOR 9
39 #define GLM_VERSION_PATCH 6
40 #define GLM_VERSION_REVISION 0
45 #define GLM_PLATFORM_UNKNOWN 0x00000000
46 #define GLM_PLATFORM_WINDOWS 0x00010000
47 #define GLM_PLATFORM_LINUX 0x00020000
48 #define GLM_PLATFORM_APPLE 0x00040000
50 #define GLM_PLATFORM_ANDROID 0x00100000
51 #define GLM_PLATFORM_CHROME_NACL 0x00200000
52 #define GLM_PLATFORM_UNIX 0x00400000
53 #define GLM_PLATFORM_QNXNTO 0x00800000
54 #define GLM_PLATFORM_WINCE 0x01000000
56 #ifdef GLM_FORCE_PLATFORM_UNKNOWN
57 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
58 #elif defined(__QNXNTO__)
59 # define GLM_PLATFORM GLM_PLATFORM_QNXNTO
60 #elif defined(__APPLE__)
61 # define GLM_PLATFORM GLM_PLATFORM_APPLE
63 # define GLM_PLATFORM GLM_PLATFORM_WINCE
65 # define GLM_PLATFORM GLM_PLATFORM_WINDOWS
66 #elif defined(__native_client__)
67 # define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL
68 #elif defined(__ANDROID__)
69 # define GLM_PLATFORM GLM_PLATFORM_ANDROID
70 #elif defined(__linux)
71 # define GLM_PLATFORM GLM_PLATFORM_LINUX
73 # define GLM_PLATFORM GLM_PLATFORM_UNIX
75 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
79 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
80 # define GLM_MESSAGE_PLATFORM_DISPLAYED
81 # if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
82 # pragma message("GLM: QNX platform detected")
85 # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
86 # pragma message("GLM: Apple platform detected")
87 # elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
88 # pragma message("GLM: WinCE platform detected")
89 # elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
90 # pragma message("GLM: Windows platform detected")
91 # elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
92 # pragma message("GLM: Native Client detected")
93 # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
94 # pragma message("GLM: Android platform detected")
95 # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
96 # pragma message("GLM: Linux platform detected")
97 # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
98 # pragma message("GLM: UNIX platform detected")
99 # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
100 # pragma message("GLM: platform unknown")
102 # pragma message("GLM: platform not detected")
112 #define GLM_COMPILER_UNKNOWN 0x00000000
115 #define GLM_COMPILER_INTEL 0x00100000
116 #define GLM_COMPILER_INTEL9 0x00100010
117 #define GLM_COMPILER_INTEL10_0 0x00100020
118 #define GLM_COMPILER_INTEL10_1 0x00100030
119 #define GLM_COMPILER_INTEL11_0 0x00100040
120 #define GLM_COMPILER_INTEL11_1 0x00100050
121 #define GLM_COMPILER_INTEL12_0 0x00100060
122 #define GLM_COMPILER_INTEL12_1 0x00100070
123 #define GLM_COMPILER_INTEL13_0 0x00100080
126 #define GLM_COMPILER_VC 0x01000000
127 #define GLM_COMPILER_VC8 0x01000070
128 #define GLM_COMPILER_VC9 0x01000080
129 #define GLM_COMPILER_VC10 0x01000090
130 #define GLM_COMPILER_VC11 0x010000A0
131 #define GLM_COMPILER_VC12 0x010000B0
134 #define GLM_COMPILER_GCC 0x02000000
135 #define GLM_COMPILER_GCC34 0x02000050
136 #define GLM_COMPILER_GCC35 0x02000060
137 #define GLM_COMPILER_GCC40 0x02000070
138 #define GLM_COMPILER_GCC41 0x02000080
139 #define GLM_COMPILER_GCC42 0x02000090
140 #define GLM_COMPILER_GCC43 0x020000A0
141 #define GLM_COMPILER_GCC44 0x020000B0
142 #define GLM_COMPILER_GCC45 0x020000C0
143 #define GLM_COMPILER_GCC46 0x020000D0
144 #define GLM_COMPILER_GCC47 0x020000E0
145 #define GLM_COMPILER_GCC48 0x020000F0
146 #define GLM_COMPILER_GCC49 0x02000100
149 #define GLM_COMPILER_BC 0x04000000
152 #define GLM_COMPILER_CODEWARRIOR 0x08000000
155 #define GLM_COMPILER_CUDA 0x10000000
156 #define GLM_COMPILER_CUDA30 0x10000010
157 #define GLM_COMPILER_CUDA31 0x10000020
158 #define GLM_COMPILER_CUDA32 0x10000030
159 #define GLM_COMPILER_CUDA40 0x10000040
160 #define GLM_COMPILER_CUDA41 0x10000050
161 #define GLM_COMPILER_CUDA42 0x10000060
164 #define GLM_COMPILER_CLANG 0x20000000
165 #define GLM_COMPILER_CLANG26 0x20000010
166 #define GLM_COMPILER_CLANG27 0x20000020
167 #define GLM_COMPILER_CLANG28 0x20000030
168 #define GLM_COMPILER_CLANG29 0x20000040
169 #define GLM_COMPILER_CLANG30 0x20000050
170 #define GLM_COMPILER_CLANG31 0x20000060
171 #define GLM_COMPILER_CLANG32 0x20000070
172 #define GLM_COMPILER_CLANG33 0x20000080
173 #define GLM_COMPILER_CLANG40 0x20000090
174 #define GLM_COMPILER_CLANG41 0x200000A0
175 #define GLM_COMPILER_CLANG42 0x200000B0
176 #define GLM_COMPILER_CLANG43 0x200000C0
177 #define GLM_COMPILER_CLANG50 0x200000D0
180 #define GLM_COMPILER_LLVM_GCC 0x40000000
183 #define GLM_MODEL_32 0x00000010
184 #define GLM_MODEL_64 0x00000020
187 #ifdef GLM_FORCE_COMPILER_UNKNOWN
188 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
190 #elif defined(__INTEL_COMPILER)
191 # if __INTEL_COMPILER == 900
192 # define GLM_COMPILER GLM_COMPILER_INTEL9
193 # elif __INTEL_COMPILER == 1000
194 # define GLM_COMPILER GLM_COMPILER_INTEL10_0
195 # elif __INTEL_COMPILER == 1010
196 # define GLM_COMPILER GLM_COMPILER_INTEL10_1
197 # elif __INTEL_COMPILER == 1100
198 # define GLM_COMPILER GLM_COMPILER_INTEL11_0
199 # elif __INTEL_COMPILER == 1110
200 # define GLM_COMPILER GLM_COMPILER_INTEL11_1
201 # elif __INTEL_COMPILER == 1200
202 # define GLM_COMPILER GLM_COMPILER_INTEL12_0
203 # elif __INTEL_COMPILER == 1210
204 # define GLM_COMPILER GLM_COMPILER_INTEL12_1
205 # elif __INTEL_COMPILER >= 1300
206 # define GLM_COMPILER GLM_COMPILER_INTEL13_0
208 # define GLM_COMPILER GLM_COMPILER_INTEL
212 #elif defined(__CUDACC__)
213 # if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
216 # if CUDA_VERSION < 3000
217 # error "GLM requires CUDA 3.0 or higher"
219 # define GLM_COMPILER GLM_COMPILER_CUDA
223 #elif defined(_MSC_VER)
225 # error "GLM requires Visual C++ 2005 or higher"
226 # elif _MSC_VER == 1400
227 # define GLM_COMPILER GLM_COMPILER_VC8
228 # elif _MSC_VER == 1500
229 # define GLM_COMPILER GLM_COMPILER_VC9
230 # elif _MSC_VER == 1600
231 # define GLM_COMPILER GLM_COMPILER_VC10
232 # elif _MSC_VER == 1700
233 # define GLM_COMPILER GLM_COMPILER_VC11
234 # elif _MSC_VER >= 1800
235 # define GLM_COMPILER GLM_COMPILER_VC12
237 # define GLM_COMPILER GLM_COMPILER_VC
241 #elif defined(__clang__)
242 # if (__clang_major__ <= 1) || ((__clang_major__ == 2) && (__clang_minor__ < 6))
243 # error "GLM requires Clang 2.6 or higher"
244 # elif(__clang_major__ == 2) && (__clang_minor__ == 6)
245 # define GLM_COMPILER GLM_COMPILER_CLANG26
246 # elif(__clang_major__ == 2) && (__clang_minor__ == 7)
247 # define GLM_COMPILER GLM_COMPILER_CLANG27
248 # elif(__clang_major__ == 2) && (__clang_minor__ == 8)
249 # define GLM_COMPILER GLM_COMPILER_CLANG28
250 # elif(__clang_major__ == 2) && (__clang_minor__ == 9)
251 # define GLM_COMPILER GLM_COMPILER_CLANG29
252 # elif(__clang_major__ == 3) && (__clang_minor__ == 0)
253 # define GLM_COMPILER GLM_COMPILER_CLANG30
254 # elif(__clang_major__ == 3) && (__clang_minor__ == 1)
255 # define GLM_COMPILER GLM_COMPILER_CLANG31
256 # elif(__clang_major__ == 3) && (__clang_minor__ == 2)
257 # define GLM_COMPILER GLM_COMPILER_CLANG32
258 # elif(__clang_major__ == 3) && (__clang_minor__ == 3)
259 # define GLM_COMPILER GLM_COMPILER_CLANG33
260 # elif(__clang_major__ == 4) && (__clang_minor__ == 0)
261 # define GLM_COMPILER GLM_COMPILER_CLANG40
262 # elif(__clang_major__ == 4) && (__clang_minor__ == 1)
263 # define GLM_COMPILER GLM_COMPILER_CLANG41
264 # elif(__clang_major__ == 4) && (__clang_minor__ == 2)
265 # define GLM_COMPILER GLM_COMPILER_CLANG42
266 # elif(__clang_major__ == 4) && (__clang_minor__ >= 3)
267 # define GLM_COMPILER GLM_COMPILER_CLANG43
268 # elif(__clang_major__ > 4)
269 # define GLM_COMPILER GLM_COMPILER_CLANG50
271 # define GLM_COMPILER GLM_COMPILER_CLANG
275 #elif(defined(__GNUC__) || defined(__MINGW32__))// || defined(__llvm__) || defined(__clang__)
276 # if (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
277 # define GLM_COMPILER GLM_COMPILER_GCC34
278 # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
279 # define GLM_COMPILER GLM_COMPILER_GCC35
280 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
281 # define GLM_COMPILER (GLM_COMPILER_GCC40)
282 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
283 # define GLM_COMPILER (GLM_COMPILER_GCC41)
284 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
285 # define GLM_COMPILER (GLM_COMPILER_GCC42)
286 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
287 # define GLM_COMPILER (GLM_COMPILER_GCC43)
288 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
289 # define GLM_COMPILER (GLM_COMPILER_GCC44)
290 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
291 # define GLM_COMPILER (GLM_COMPILER_GCC45)
292 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
293 # define GLM_COMPILER (GLM_COMPILER_GCC46)
294 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
295 # define GLM_COMPILER (GLM_COMPILER_GCC47)
296 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
297 # define GLM_COMPILER (GLM_COMPILER_GCC48)
298 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
299 # define GLM_COMPILER (GLM_COMPILER_GCC49)
300 # elif (__GNUC__ > 4 )
301 # define GLM_COMPILER (GLM_COMPILER_GCC49)
303 # define GLM_COMPILER (GLM_COMPILER_GCC)
307 #elif defined(_BORLANDC_)
308 # define GLM_COMPILER GLM_COMPILER_BC
311 #elif defined(__MWERKS__)
312 # define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
315 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
319 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
323 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
324 # define GLM_MESSAGE_COMPILER_DISPLAYED
325 # if(GLM_COMPILER & GLM_COMPILER_CUDA)
326 # pragma message("GLM: CUDA compiler detected")
327 # elif(GLM_COMPILER & GLM_COMPILER_VC)
328 # pragma message("GLM: Visual C++ compiler detected")
329 # elif(GLM_COMPILER & GLM_COMPILER_CLANG)
330 # pragma message("GLM: Clang compiler detected")
331 # elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
332 # pragma message("GLM: LLVM GCC compiler detected")
333 # elif(GLM_COMPILER & GLM_COMPILER_INTEL)
334 # pragma message("GLM: Intel Compiler detected")
335 # elif(GLM_COMPILER & GLM_COMPILER_GCC)
336 # if(GLM_COMPILER == GLM_COMPILER_GCC_LLVM)
337 # pragma message("GLM: LLVM GCC compiler detected")
338 # elif(GLM_COMPILER == GLM_COMPILER_GCC_CLANG)
339 # pragma message("GLM: CLANG compiler detected")
341 # pragma message("GLM: GCC compiler detected")
343 # elif(GLM_COMPILER & GLM_COMPILER_BC)
344 # pragma message("GLM: Borland compiler detected but not supported")
345 # elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
346 # pragma message("GLM: Codewarrior compiler detected but not supported")
348 # pragma message("GLM: Compiler not detected")
355 #if(defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__))
356 # define GLM_MODEL GLM_MODEL_64
357 #elif(defined(__i386__) || defined(__ppc__))
358 # define GLM_MODEL GLM_MODEL_32
360 # define GLM_MODEL GLM_MODEL_32
363 #if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
364 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
367 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
368 # define GLM_MESSAGE_MODEL_DISPLAYED
369 # if(GLM_MODEL == GLM_MODEL_64)
370 # pragma message("GLM: 64 bits model")
371 # elif(GLM_MODEL == GLM_MODEL_32)
372 # pragma message("GLM: 32 bits model")
381 #define GLM_LANG_CXX_FLAG (1 << 0)
382 #define GLM_LANG_CXX98_FLAG (1 << 1)
383 #define GLM_LANG_CXX03_FLAG (1 << 2)
384 #define GLM_LANG_CXX0X_FLAG (1 << 3)
385 #define GLM_LANG_CXX11_FLAG (1 << 4)
386 #define GLM_LANG_CXX1Y_FLAG (1 << 5)
387 #define GLM_LANG_CXXMS_FLAG (1 << 6)
388 #define GLM_LANG_CXXGNU_FLAG (1 << 7)
390 #define GLM_LANG_CXX GLM_LANG_CXX_FLAG
391 #define GLM_LANG_CXX98 (GLM_LANG_CXX | GLM_LANG_CXX98_FLAG)
392 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
393 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
394 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
395 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
396 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
397 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
399 #if(defined(GLM_FORCE_CXX1Y))
400 # define GLM_LANG GLM_LANG_CXX1Y
401 #elif(defined(GLM_FORCE_CXX11))
402 # define GLM_LANG GLM_LANG_CXX11
403 #elif(defined(GLM_FORCE_CXX03))
404 # define GLM_LANG GLM_LANG_CXX03
405 #elif(defined(GLM_FORCE_CXX98))
406 # define GLM_LANG GLM_LANG_CXX98
408 # if(__cplusplus >= 201103L)
409 # define GLM_LANG GLM_LANG_CXX11
410 # elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG)
411 # if(GLM_PLATFORM == GLM_PLATFORM_APPLE)
412 # define GLM_DETAIL_MAJOR 1
414 # define GLM_DETAIL_MAJOR 0
416 # if(__clang_major__ < (2 + GLM_DETAIL_MAJOR))
417 # define GLM_LANG GLM_LANG_CXX
418 # elif(__has_feature(cxx_auto_type))
419 # define GLM_LANG GLM_LANG_CXX0X
421 # define GLM_LANG GLM_LANG_CXX98
423 # elif((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC)
424 # if defined(__GXX_EXPERIMENTAL_CXX0X__)
425 # define GLM_LANG GLM_LANG_CXX0X
427 # define GLM_LANG GLM_LANG_CXX98
429 # elif(GLM_COMPILER & GLM_COMPILER_VC)
430 # if(defined(_MSC_EXTENSIONS))
431 # if(GLM_COMPILER >= GLM_COMPILER_VC10)
432 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
434 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
437 # if(GLM_COMPILER >= GLM_COMPILER_VC10)
438 # define GLM_LANG GLM_LANG_CXX0X
440 # define GLM_LANG GLM_LANG_CXX98
443 # elif(GLM_COMPILER & GLM_COMPILER_INTEL)
444 # if(defined(_MSC_EXTENSIONS))
445 # if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
446 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
448 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
451 # if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
452 # define GLM_LANG (GLM_LANG_CXX0X)
454 # define GLM_LANG (GLM_LANG_CXX98)
457 # elif(__cplusplus >= 199711L)
458 # define GLM_LANG GLM_LANG_CXX98
460 # define GLM_LANG GLM_LANG_CXX
464 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
465 # define GLM_MESSAGE_LANG_DISPLAYED
466 # if(GLM_LANG & GLM_LANG_CXXGNU_FLAG)
467 # pragma message("GLM: C++ with language extensions")
468 # elif(GLM_LANG & GLM_LANG_CXXMS_FLAG)
469 # pragma message("GLM: C++ with language extensions")
470 # elif(GLM_LANG & GLM_LANG_CXX11_FLAG)
471 # pragma message("GLM: C++11")
472 # elif(GLM_LANG & GLM_LANG_CXX0X_FLAG)
473 # pragma message("GLM: C++0x")
474 # elif(GLM_LANG & GLM_LANG_CXX03_FLAG)
475 # pragma message("GLM: C++03")
476 # elif(GLM_LANG & GLM_LANG_CXX98_FLAG)
477 # pragma message("GLM: C++98")
479 # pragma message("GLM: C++ language undetected")
481 # 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")
487 #ifndef __has_feature
488 # define __has_feature(x) 0 // Compatibility with non-clang compilers.
490 #ifndef __has_extension
491 # define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
499 #define GLM_HAS_STATIC_ASSERT ( \
500 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
501 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC10)) || \
502 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
503 __has_feature(cxx_static_assert))
506 #define GLM_HAS_EXTENDED_INTEGER_TYPE ( \
507 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
508 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \
509 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
510 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG29)))
513 #define GLM_HAS_CONSTEXPR ( \
514 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
515 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
516 __has_feature(cxx_constexpr))
519 #define GLM_HAS_INITIALIZER_LISTS ( \
520 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
521 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) || \
522 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
523 __has_feature(cxx_generalized_initializers))
526 #define GLM_HAS_UNRESTRICTED_UNIONS ( \
527 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
528 (GLM_LANG & GLM_LANG_CXXMS_FLAG) || \
529 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
530 __has_feature(cxx_unrestricted_unions))
533 #define GLM_HAS_DEFAULTED_FUNCTIONS ( \
534 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
535 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) || \
536 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
537 __has_feature(cxx_defaulted_functions))
540 #define GLM_HAS_RVALUE_REFERENCES ( \
541 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
542 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))) || \
543 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
544 __has_feature(cxx_rvalue_references))
546 #define GLM_HAS_STL_ARRAY ( \
547 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
548 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC10))) || \
549 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)))
553 # if(GLM_COMPILER & GLM_COMPILER_GCC)
554 # if(GLM_COMPILER > GLM_COMPILER_GCC47)
555 # define GLM_HAS_OPENMP 31
556 # elif(GLM_COMPILER > GLM_COMPILER_GCC44)
557 # define GLM_HAS_OPENMP 30
558 # elif(GLM_COMPILER > GLM_COMPILER_GCC42)
559 # define GLM_HAS_OPENMP 25
561 # endif//(GLM_COMPILER & GLM_COMPILER_GCC)
563 # if(GLM_COMPILER & GLM_COMPILER_VC)
564 # if(GLM_COMPILER > GLM_COMPILER_VC8)
565 # define GLM_HAS_OPENMP 20
567 # endif//(GLM_COMPILER & GLM_COMPILER_GCC)
571 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
578 #define GLM_ARCH_PURE 0x0000
579 #define GLM_ARCH_SSE2 0x0001
580 #define GLM_ARCH_SSE3 0x0002
581 #define GLM_ARCH_SSE4 0x0004
582 #define GLM_ARCH_AVX 0x0008
583 #define GLM_ARCH_AVX2 0x0010
585 #if(defined(GLM_FORCE_PURE))
586 # define GLM_ARCH GLM_ARCH_PURE
587 #elif(defined(GLM_FORCE_AVX2))
588 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
589 #elif(defined(GLM_FORCE_AVX))
590 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
591 #elif(defined(GLM_FORCE_SSE4))
592 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
593 #elif(defined(GLM_FORCE_SSE3))
594 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
595 #elif(defined(GLM_FORCE_SSE2))
596 # define GLM_ARCH (GLM_ARCH_SSE2)
597 #elif((GLM_COMPILER & GLM_COMPILER_CLANG) || (GLM_COMPILER & GLM_COMPILER_GCC))
599 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
601 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
603 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
605 # define GLM_ARCH (GLM_ARCH_SSE2)
607 # define GLM_ARCH GLM_ARCH_PURE
609 #elif(GLM_COMPILER & GLM_COMPILER_VC)
610 # if _M_IX86_FP == 2 && defined(__AVX__)
611 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
612 # elif _M_IX86_FP == 2
613 # define GLM_ARCH (GLM_ARCH_SSE2)
615 # define GLM_ARCH (GLM_ARCH_PURE)
617 #elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC) || (GLM_COMPILER & GLM_COMPILER_CLANG))
618 # if defined(__AVX2__)
619 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
620 # elif defined(__AVX__)
621 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
622 # elif defined(__SSE4_1__ )
623 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
624 # elif defined(__SSE3__)
625 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
626 # elif defined(__SSE2__)
627 # define GLM_ARCH (GLM_ARCH_SSE2)
629 # define GLM_ARCH (GLM_ARCH_PURE)
632 # define GLM_ARCH GLM_ARCH_PURE
638 #if defined(__MINGW32__) && (GLM_ARCH != GLM_ARCH_PURE)
642 #if(GLM_ARCH & GLM_ARCH_AVX2)
643 # include <immintrin.h>
645 #if(GLM_ARCH & GLM_ARCH_AVX)
646 # include <immintrin.h>
648 #if(GLM_ARCH & GLM_ARCH_SSE4)
649 # include <smmintrin.h>
651 #if(GLM_ARCH & GLM_ARCH_SSE3)
652 # include <pmmintrin.h>
654 #if(GLM_ARCH & GLM_ARCH_SSE2)
655 # include <emmintrin.h>
656 # if(GLM_COMPILER == GLM_COMPILER_VC8) // VC8 is missing some intrinsics, workaround
657 inline float _mm_cvtss_f32(__m128
A) {
return A.m128_f32[0]; }
658 inline __m128 _mm_castpd_ps(__m128d PD) {
union { __m128
ps; __m128d pd; }
c;
c.pd = PD;
return c.ps; }
659 inline __m128d _mm_castps_pd(__m128 PS) {
union { __m128
ps; __m128d pd; }
c;
c.ps = PS;
return c.pd; }
660 inline __m128i _mm_castps_si128(__m128 PS) {
union { __m128
ps; __m128i
pi; }
c;
c.ps = PS;
return c.pi; }
661 inline __m128 _mm_castsi128_ps(__m128i PI) {
union { __m128
ps; __m128i
pi; }
c;
c.pi = PI;
return c.ps; }
665 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
666 # define GLM_MESSAGE_ARCH_DISPLAYED
667 # if(GLM_ARCH == GLM_ARCH_PURE)
668 # pragma message("GLM: Platform independent code")
669 # elif(GLM_ARCH & GLM_ARCH_AVX2)
670 # pragma message("GLM: AVX2 instruction set")
671 # elif(GLM_ARCH & GLM_ARCH_AVX)
672 # pragma message("GLM: AVX instruction set")
673 # elif(GLM_ARCH & GLM_ARCH_SSE3)
674 # pragma message("GLM: SSE3 instruction set")
675 # elif(GLM_ARCH & GLM_ARCH_SSE2)
676 # pragma message("GLM: SSE2 instruction set")
678 # pragma message("GLM: #define GLM_FORCE_PURE to avoid using platform specific instruction sets")
684 #if GLM_HAS_STATIC_ASSERT
685 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
686 #elif(defined(BOOST_STATIC_ASSERT))
687 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
688 #elif(GLM_COMPILER & GLM_COMPILER_VC)
689 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
691 # define GLM_STATIC_ASSERT(x, message)
692 # define GLM_STATIC_ASSERT_NULL
700 #if(defined(GLM_FORCE_CUDA) || (GLM_COMPILER & GLM_COMPILER_CUDA))
701 # define GLM_CUDA_FUNC_DEF __device__ __host__
702 # define GLM_CUDA_FUNC_DECL __device__ __host__
704 # define GLM_CUDA_FUNC_DEF
705 # define GLM_CUDA_FUNC_DECL
708 #if GLM_COMPILER & GLM_COMPILER_GCC
709 # define GLM_VAR_USED __attribute__ ((unused))
711 # define GLM_VAR_USED
714 #if(defined(GLM_FORCE_INLINE))
715 # if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
716 # define GLM_INLINE __forceinline
717 # elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
718 # define GLM_INLINE __attribute__((always_inline)) inline
719 # elif(GLM_COMPILER & GLM_COMPILER_CLANG)
720 # define GLM_INLINE __attribute__((always_inline))
722 # define GLM_INLINE inline
723 # endif//GLM_COMPILER
725 # define GLM_INLINE inline
726 #endif//defined(GLM_FORCE_INLINE)
728 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
729 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
736 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
737 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
738 # if defined(GLM_SWIZZLE)
739 # pragma message("GLM: Swizzling operators enabled")
741 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
752 #if defined(GLM_FORCE_SIZE_T_LENGTH)
759 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH))
760 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
761 # if defined(GLM_FORCE_SIZE_T_LENGTH)
762 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
764 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
765 # pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a std::size_t")
772 #if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
773 # define GLM_DEPRECATED __declspec(deprecated)
774 # define GLM_ALIGN(x) __declspec(align(x))
775 # define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
776 # define GLM_RESTRICT __declspec(restrict)
777 # define GLM_RESTRICT_VAR __restrict
778 #elif(GLM_COMPILER & GLM_COMPILER_INTEL)
779 # define GLM_DEPRECATED
780 # define GLM_ALIGN(x) __declspec(align(x))
781 # define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
782 # define GLM_RESTRICT
783 # define GLM_RESTRICT_VAR __restrict
784 #elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
785 # define GLM_DEPRECATED __attribute__((__deprecated__))
786 # define GLM_ALIGN(x) __attribute__((aligned(x)))
787 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
788 # define GLM_RESTRICT __restrict__
789 # define GLM_RESTRICT_VAR __restrict__
791 # define GLM_DEPRECATED
793 # define GLM_ALIGNED_STRUCT(x)
794 # define GLM_RESTRICT
795 # define GLM_RESTRICT_VAR
798 #if GLM_HAS_CONSTEXPR
799 # define GLM_CONSTEXPR constexpr
801 # define GLM_CONSTEXPR