Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #pragma once
00030
00031 #include <cassert>
00032
00034
00035
00036 #define GLM_VERSION 96
00037 #define GLM_VERSION_MAJOR 0
00038 #define GLM_VERSION_MINOR 9
00039 #define GLM_VERSION_PATCH 6
00040 #define GLM_VERSION_REVISION 0
00041
00043
00044
00045 #define GLM_PLATFORM_UNKNOWN 0x00000000
00046 #define GLM_PLATFORM_WINDOWS 0x00010000
00047 #define GLM_PLATFORM_LINUX 0x00020000
00048 #define GLM_PLATFORM_APPLE 0x00040000
00049
00050 #define GLM_PLATFORM_ANDROID 0x00100000
00051 #define GLM_PLATFORM_CHROME_NACL 0x00200000
00052 #define GLM_PLATFORM_UNIX 0x00400000
00053 #define GLM_PLATFORM_QNXNTO 0x00800000
00054 #define GLM_PLATFORM_WINCE 0x01000000
00055
00056 #ifdef GLM_FORCE_PLATFORM_UNKNOWN
00057 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
00058 #elif defined(__QNXNTO__)
00059 # define GLM_PLATFORM GLM_PLATFORM_QNXNTO
00060 #elif defined(__APPLE__)
00061 # define GLM_PLATFORM GLM_PLATFORM_APPLE
00062 #elif defined(WINCE)
00063 # define GLM_PLATFORM GLM_PLATFORM_WINCE
00064 #elif defined(_WIN32)
00065 # define GLM_PLATFORM GLM_PLATFORM_WINDOWS
00066 #elif defined(__native_client__)
00067 # define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL
00068 #elif defined(__ANDROID__)
00069 # define GLM_PLATFORM GLM_PLATFORM_ANDROID
00070 #elif defined(__linux)
00071 # define GLM_PLATFORM GLM_PLATFORM_LINUX
00072 #elif defined(__unix)
00073 # define GLM_PLATFORM GLM_PLATFORM_UNIX
00074 #else
00075 # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
00076 #endif//
00077
00078
00079 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
00080 # define GLM_MESSAGE_PLATFORM_DISPLAYED
00081 # if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
00082 # pragma message("GLM: QNX platform detected")
00083
00084
00085 # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
00086 # pragma message("GLM: Apple platform detected")
00087 # elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
00088 # pragma message("GLM: WinCE platform detected")
00089 # elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
00090 # pragma message("GLM: Windows platform detected")
00091 # elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
00092 # pragma message("GLM: Native Client detected")
00093 # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
00094 # pragma message("GLM: Android platform detected")
00095 # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
00096 # pragma message("GLM: Linux platform detected")
00097 # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
00098 # pragma message("GLM: UNIX platform detected")
00099 # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
00100 # pragma message("GLM: platform unknown")
00101 # else
00102 # pragma message("GLM: platform not detected")
00103 # endif
00104 #endif//GLM_MESSAGE
00105
00107
00108
00109
00110
00111
00112 #define GLM_COMPILER_UNKNOWN 0x00000000
00113
00114
00115 #define GLM_COMPILER_INTEL 0x00100000
00116 #define GLM_COMPILER_INTEL9 0x00100010
00117 #define GLM_COMPILER_INTEL10_0 0x00100020
00118 #define GLM_COMPILER_INTEL10_1 0x00100030
00119 #define GLM_COMPILER_INTEL11_0 0x00100040
00120 #define GLM_COMPILER_INTEL11_1 0x00100050
00121 #define GLM_COMPILER_INTEL12_0 0x00100060
00122 #define GLM_COMPILER_INTEL12_1 0x00100070
00123 #define GLM_COMPILER_INTEL13_0 0x00100080
00124
00125
00126 #define GLM_COMPILER_VC 0x01000000
00127 #define GLM_COMPILER_VC8 0x01000070
00128 #define GLM_COMPILER_VC9 0x01000080
00129 #define GLM_COMPILER_VC10 0x01000090
00130 #define GLM_COMPILER_VC11 0x010000A0
00131 #define GLM_COMPILER_VC12 0x010000B0
00132
00133
00134 #define GLM_COMPILER_GCC 0x02000000
00135 #define GLM_COMPILER_GCC34 0x02000050
00136 #define GLM_COMPILER_GCC35 0x02000060
00137 #define GLM_COMPILER_GCC40 0x02000070
00138 #define GLM_COMPILER_GCC41 0x02000080
00139 #define GLM_COMPILER_GCC42 0x02000090
00140 #define GLM_COMPILER_GCC43 0x020000A0
00141 #define GLM_COMPILER_GCC44 0x020000B0
00142 #define GLM_COMPILER_GCC45 0x020000C0
00143 #define GLM_COMPILER_GCC46 0x020000D0
00144 #define GLM_COMPILER_GCC47 0x020000E0
00145 #define GLM_COMPILER_GCC48 0x020000F0
00146 #define GLM_COMPILER_GCC49 0x02000100
00147
00148
00149 #define GLM_COMPILER_BC 0x04000000
00150
00151
00152 #define GLM_COMPILER_CODEWARRIOR 0x08000000
00153
00154
00155 #define GLM_COMPILER_CUDA 0x10000000
00156 #define GLM_COMPILER_CUDA30 0x10000010
00157 #define GLM_COMPILER_CUDA31 0x10000020
00158 #define GLM_COMPILER_CUDA32 0x10000030
00159 #define GLM_COMPILER_CUDA40 0x10000040
00160 #define GLM_COMPILER_CUDA41 0x10000050
00161 #define GLM_COMPILER_CUDA42 0x10000060
00162
00163
00164 #define GLM_COMPILER_CLANG 0x20000000
00165 #define GLM_COMPILER_CLANG26 0x20000010
00166 #define GLM_COMPILER_CLANG27 0x20000020
00167 #define GLM_COMPILER_CLANG28 0x20000030
00168 #define GLM_COMPILER_CLANG29 0x20000040
00169 #define GLM_COMPILER_CLANG30 0x20000050
00170 #define GLM_COMPILER_CLANG31 0x20000060
00171 #define GLM_COMPILER_CLANG32 0x20000070
00172 #define GLM_COMPILER_CLANG33 0x20000080
00173 #define GLM_COMPILER_CLANG40 0x20000090
00174 #define GLM_COMPILER_CLANG41 0x200000A0
00175 #define GLM_COMPILER_CLANG42 0x200000B0
00176 #define GLM_COMPILER_CLANG43 0x200000C0
00177 #define GLM_COMPILER_CLANG50 0x200000D0
00178
00179
00180 #define GLM_COMPILER_LLVM_GCC 0x40000000
00181
00182
00183 #define GLM_MODEL_32 0x00000010
00184 #define GLM_MODEL_64 0x00000020
00185
00186
00187 #ifdef GLM_FORCE_COMPILER_UNKNOWN
00188 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
00189
00190 #elif defined(__INTEL_COMPILER)
00191 # if __INTEL_COMPILER == 900
00192 # define GLM_COMPILER GLM_COMPILER_INTEL9
00193 # elif __INTEL_COMPILER == 1000
00194 # define GLM_COMPILER GLM_COMPILER_INTEL10_0
00195 # elif __INTEL_COMPILER == 1010
00196 # define GLM_COMPILER GLM_COMPILER_INTEL10_1
00197 # elif __INTEL_COMPILER == 1100
00198 # define GLM_COMPILER GLM_COMPILER_INTEL11_0
00199 # elif __INTEL_COMPILER == 1110
00200 # define GLM_COMPILER GLM_COMPILER_INTEL11_1
00201 # elif __INTEL_COMPILER == 1200
00202 # define GLM_COMPILER GLM_COMPILER_INTEL12_0
00203 # elif __INTEL_COMPILER == 1210
00204 # define GLM_COMPILER GLM_COMPILER_INTEL12_1
00205 # elif __INTEL_COMPILER >= 1300
00206 # define GLM_COMPILER GLM_COMPILER_INTEL13_0
00207 # else
00208 # define GLM_COMPILER GLM_COMPILER_INTEL
00209 # endif
00210
00211
00212 #elif defined(__CUDACC__)
00213 # if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
00214 # include <cuda.h>
00215 # endif
00216 # if CUDA_VERSION < 3000
00217 # error "GLM requires CUDA 3.0 or higher"
00218 # else
00219 # define GLM_COMPILER GLM_COMPILER_CUDA
00220 # endif
00221
00222
00223 #elif defined(_MSC_VER)
00224 # if _MSC_VER < 1400
00225 # error "GLM requires Visual C++ 2005 or higher"
00226 # elif _MSC_VER == 1400
00227 # define GLM_COMPILER GLM_COMPILER_VC8
00228 # elif _MSC_VER == 1500
00229 # define GLM_COMPILER GLM_COMPILER_VC9
00230 # elif _MSC_VER == 1600
00231 # define GLM_COMPILER GLM_COMPILER_VC10
00232 # elif _MSC_VER == 1700
00233 # define GLM_COMPILER GLM_COMPILER_VC11
00234 # elif _MSC_VER >= 1800
00235 # define GLM_COMPILER GLM_COMPILER_VC12
00236 # else//_MSC_VER
00237 # define GLM_COMPILER GLM_COMPILER_VC
00238 # endif//_MSC_VER
00239
00240
00241 #elif defined(__clang__)
00242 # if (__clang_major__ <= 1) || ((__clang_major__ == 2) && (__clang_minor__ < 6))
00243 # error "GLM requires Clang 2.6 or higher"
00244 # elif(__clang_major__ == 2) && (__clang_minor__ == 6)
00245 # define GLM_COMPILER GLM_COMPILER_CLANG26
00246 # elif(__clang_major__ == 2) && (__clang_minor__ == 7)
00247 # define GLM_COMPILER GLM_COMPILER_CLANG27
00248 # elif(__clang_major__ == 2) && (__clang_minor__ == 8)
00249 # define GLM_COMPILER GLM_COMPILER_CLANG28
00250 # elif(__clang_major__ == 2) && (__clang_minor__ == 9)
00251 # define GLM_COMPILER GLM_COMPILER_CLANG29
00252 # elif(__clang_major__ == 3) && (__clang_minor__ == 0)
00253 # define GLM_COMPILER GLM_COMPILER_CLANG30
00254 # elif(__clang_major__ == 3) && (__clang_minor__ == 1)
00255 # define GLM_COMPILER GLM_COMPILER_CLANG31
00256 # elif(__clang_major__ == 3) && (__clang_minor__ == 2)
00257 # define GLM_COMPILER GLM_COMPILER_CLANG32
00258 # elif(__clang_major__ == 3) && (__clang_minor__ == 3)
00259 # define GLM_COMPILER GLM_COMPILER_CLANG33
00260 # elif(__clang_major__ == 4) && (__clang_minor__ == 0)
00261 # define GLM_COMPILER GLM_COMPILER_CLANG40
00262 # elif(__clang_major__ == 4) && (__clang_minor__ == 1)
00263 # define GLM_COMPILER GLM_COMPILER_CLANG41
00264 # elif(__clang_major__ == 4) && (__clang_minor__ == 2)
00265 # define GLM_COMPILER GLM_COMPILER_CLANG42
00266 # elif(__clang_major__ == 4) && (__clang_minor__ >= 3)
00267 # define GLM_COMPILER GLM_COMPILER_CLANG43
00268 # elif(__clang_major__ > 4)
00269 # define GLM_COMPILER GLM_COMPILER_CLANG50
00270 # else
00271 # define GLM_COMPILER GLM_COMPILER_CLANG
00272 # endif
00273
00274
00275 #elif(defined(__GNUC__) || defined(__MINGW32__))// || defined(__llvm__) || defined(__clang__)
00276 # if (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
00277 # define GLM_COMPILER GLM_COMPILER_GCC34
00278 # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
00279 # define GLM_COMPILER GLM_COMPILER_GCC35
00280 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
00281 # define GLM_COMPILER (GLM_COMPILER_GCC40)
00282 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
00283 # define GLM_COMPILER (GLM_COMPILER_GCC41)
00284 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
00285 # define GLM_COMPILER (GLM_COMPILER_GCC42)
00286 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
00287 # define GLM_COMPILER (GLM_COMPILER_GCC43)
00288 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
00289 # define GLM_COMPILER (GLM_COMPILER_GCC44)
00290 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
00291 # define GLM_COMPILER (GLM_COMPILER_GCC45)
00292 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
00293 # define GLM_COMPILER (GLM_COMPILER_GCC46)
00294 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
00295 # define GLM_COMPILER (GLM_COMPILER_GCC47)
00296 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
00297 # define GLM_COMPILER (GLM_COMPILER_GCC48)
00298 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
00299 # define GLM_COMPILER (GLM_COMPILER_GCC49)
00300 # elif (__GNUC__ > 4 )
00301 # define GLM_COMPILER (GLM_COMPILER_GCC49)
00302 # else
00303 # define GLM_COMPILER (GLM_COMPILER_GCC)
00304 # endif
00305
00306
00307 #elif defined(_BORLANDC_)
00308 # define GLM_COMPILER GLM_COMPILER_BC
00309
00310
00311 #elif defined(__MWERKS__)
00312 # define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
00313
00314 #else
00315 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
00316 #endif
00317
00318 #ifndef GLM_COMPILER
00319 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
00320 #endif//GLM_COMPILER
00321
00322
00323 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
00324 # define GLM_MESSAGE_COMPILER_DISPLAYED
00325 # if(GLM_COMPILER & GLM_COMPILER_CUDA)
00326 # pragma message("GLM: CUDA compiler detected")
00327 # elif(GLM_COMPILER & GLM_COMPILER_VC)
00328 # pragma message("GLM: Visual C++ compiler detected")
00329 # elif(GLM_COMPILER & GLM_COMPILER_CLANG)
00330 # pragma message("GLM: Clang compiler detected")
00331 # elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
00332 # pragma message("GLM: LLVM GCC compiler detected")
00333 # elif(GLM_COMPILER & GLM_COMPILER_INTEL)
00334 # pragma message("GLM: Intel Compiler detected")
00335 # elif(GLM_COMPILER & GLM_COMPILER_GCC)
00336 # if(GLM_COMPILER == GLM_COMPILER_GCC_LLVM)
00337 # pragma message("GLM: LLVM GCC compiler detected")
00338 # elif(GLM_COMPILER == GLM_COMPILER_GCC_CLANG)
00339 # pragma message("GLM: CLANG compiler detected")
00340 # else
00341 # pragma message("GLM: GCC compiler detected")
00342 # endif
00343 # elif(GLM_COMPILER & GLM_COMPILER_BC)
00344 # pragma message("GLM: Borland compiler detected but not supported")
00345 # elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
00346 # pragma message("GLM: Codewarrior compiler detected but not supported")
00347 # else
00348 # pragma message("GLM: Compiler not detected")
00349 # endif
00350 #endif//GLM_MESSAGE
00351
00353
00354
00355 #if(defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__))
00356 # define GLM_MODEL GLM_MODEL_64
00357 #elif(defined(__i386__) || defined(__ppc__))
00358 # define GLM_MODEL GLM_MODEL_32
00359 #else
00360 # define GLM_MODEL GLM_MODEL_32
00361 #endif//
00362
00363 #if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
00364 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
00365 #endif//GLM_MODEL
00366
00367 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
00368 # define GLM_MESSAGE_MODEL_DISPLAYED
00369 # if(GLM_MODEL == GLM_MODEL_64)
00370 # pragma message("GLM: 64 bits model")
00371 # elif(GLM_MODEL == GLM_MODEL_32)
00372 # pragma message("GLM: 32 bits model")
00373 # endif//GLM_MODEL
00374 #endif//GLM_MESSAGE
00375
00377
00378
00379
00380
00381 #define GLM_LANG_CXX_FLAG (1 << 0)
00382 #define GLM_LANG_CXX98_FLAG (1 << 1)
00383 #define GLM_LANG_CXX03_FLAG (1 << 2)
00384 #define GLM_LANG_CXX0X_FLAG (1 << 3)
00385 #define GLM_LANG_CXX11_FLAG (1 << 4)
00386 #define GLM_LANG_CXX1Y_FLAG (1 << 5)
00387 #define GLM_LANG_CXXMS_FLAG (1 << 6)
00388 #define GLM_LANG_CXXGNU_FLAG (1 << 7)
00389
00390 #define GLM_LANG_CXX GLM_LANG_CXX_FLAG
00391 #define GLM_LANG_CXX98 (GLM_LANG_CXX | GLM_LANG_CXX98_FLAG)
00392 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
00393 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
00394 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
00395 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
00396 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
00397 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
00398
00399 #if(defined(GLM_FORCE_CXX1Y))
00400 # define GLM_LANG GLM_LANG_CXX1Y
00401 #elif(defined(GLM_FORCE_CXX11))
00402 # define GLM_LANG GLM_LANG_CXX11
00403 #elif(defined(GLM_FORCE_CXX03))
00404 # define GLM_LANG GLM_LANG_CXX03
00405 #elif(defined(GLM_FORCE_CXX98))
00406 # define GLM_LANG GLM_LANG_CXX98
00407 #else
00408 # if(__cplusplus >= 201103L)
00409 # define GLM_LANG GLM_LANG_CXX11
00410 # elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG)
00411 # if(GLM_PLATFORM == GLM_PLATFORM_APPLE)
00412 # define GLM_DETAIL_MAJOR 1
00413 # else
00414 # define GLM_DETAIL_MAJOR 0
00415 # endif
00416 # if(__clang_major__ < (2 + GLM_DETAIL_MAJOR))
00417 # define GLM_LANG GLM_LANG_CXX
00418 # elif(__has_feature(cxx_auto_type))
00419 # define GLM_LANG GLM_LANG_CXX0X
00420 # else
00421 # define GLM_LANG GLM_LANG_CXX98
00422 # endif
00423 # elif((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC)
00424 # if defined(__GXX_EXPERIMENTAL_CXX0X__)
00425 # define GLM_LANG GLM_LANG_CXX0X
00426 # else
00427 # define GLM_LANG GLM_LANG_CXX98
00428 # endif
00429 # elif(GLM_COMPILER & GLM_COMPILER_VC)
00430 # if(defined(_MSC_EXTENSIONS))
00431 # if(GLM_COMPILER >= GLM_COMPILER_VC10)
00432 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
00433 # else
00434 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
00435 # endif
00436 # else
00437 # if(GLM_COMPILER >= GLM_COMPILER_VC10)
00438 # define GLM_LANG GLM_LANG_CXX0X
00439 # else
00440 # define GLM_LANG GLM_LANG_CXX98
00441 # endif
00442 # endif
00443 # elif(GLM_COMPILER & GLM_COMPILER_INTEL)
00444 # if(defined(_MSC_EXTENSIONS))
00445 # if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
00446 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
00447 # else
00448 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
00449 # endif
00450 # else
00451 # if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
00452 # define GLM_LANG (GLM_LANG_CXX0X)
00453 # else
00454 # define GLM_LANG (GLM_LANG_CXX98)
00455 # endif
00456 # endif
00457 # elif(__cplusplus >= 199711L)
00458 # define GLM_LANG GLM_LANG_CXX98
00459 # else
00460 # define GLM_LANG GLM_LANG_CXX
00461 # endif
00462 #endif
00463
00464 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
00465 # define GLM_MESSAGE_LANG_DISPLAYED
00466 # if(GLM_LANG & GLM_LANG_CXXGNU_FLAG)
00467 # pragma message("GLM: C++ with language extensions")
00468 # elif(GLM_LANG & GLM_LANG_CXXMS_FLAG)
00469 # pragma message("GLM: C++ with language extensions")
00470 # elif(GLM_LANG & GLM_LANG_CXX11_FLAG)
00471 # pragma message("GLM: C++11")
00472 # elif(GLM_LANG & GLM_LANG_CXX0X_FLAG)
00473 # pragma message("GLM: C++0x")
00474 # elif(GLM_LANG & GLM_LANG_CXX03_FLAG)
00475 # pragma message("GLM: C++03")
00476 # elif(GLM_LANG & GLM_LANG_CXX98_FLAG)
00477 # pragma message("GLM: C++98")
00478 # else
00479 # pragma message("GLM: C++ language undetected")
00480 # endif//GLM_MODEL
00481 # 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")
00482 #endif//GLM_MESSAGE
00483
00485
00486
00487 #ifndef __has_feature
00488 # define __has_feature(x) 0 // Compatibility with non-clang compilers.
00489 #endif
00490 #ifndef __has_extension
00491 # define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
00492 #endif
00493
00494
00495
00496
00497
00498
00499 #define GLM_HAS_STATIC_ASSERT ( \
00500 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
00501 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC10)) || \
00502 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
00503 __has_feature(cxx_static_assert))
00504
00505
00506 #define GLM_HAS_EXTENDED_INTEGER_TYPE ( \
00507 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
00508 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \
00509 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
00510 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG29)))
00511
00512
00513 #define GLM_HAS_CONSTEXPR ( \
00514 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
00515 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
00516 __has_feature(cxx_constexpr))
00517
00518
00519 #define GLM_HAS_INITIALIZER_LISTS ( \
00520 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
00521 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) || \
00522 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
00523 __has_feature(cxx_generalized_initializers))
00524
00525
00526 #define GLM_HAS_UNRESTRICTED_UNIONS ( \
00527 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
00528 (GLM_LANG & GLM_LANG_CXXMS_FLAG) || \
00529 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
00530 __has_feature(cxx_unrestricted_unions))
00531
00532
00533 #define GLM_HAS_DEFAULTED_FUNCTIONS ( \
00534 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
00535 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) || \
00536 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
00537 __has_feature(cxx_defaulted_functions))
00538
00539
00540 #define GLM_HAS_RVALUE_REFERENCES ( \
00541 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
00542 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))) || \
00543 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
00544 __has_feature(cxx_rvalue_references))
00545
00546 #define GLM_HAS_STL_ARRAY ( \
00547 (GLM_LANG & GLM_LANG_CXX11_FLAG) || \
00548 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC10))) || \
00549 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)))
00550
00551
00552 #ifdef _OPENMP
00553 # if(GLM_COMPILER & GLM_COMPILER_GCC)
00554 # if(GLM_COMPILER > GLM_COMPILER_GCC47)
00555 # define GLM_HAS_OPENMP 31
00556 # elif(GLM_COMPILER > GLM_COMPILER_GCC44)
00557 # define GLM_HAS_OPENMP 30
00558 # elif(GLM_COMPILER > GLM_COMPILER_GCC42)
00559 # define GLM_HAS_OPENMP 25
00560 # endif
00561 # endif//(GLM_COMPILER & GLM_COMPILER_GCC)
00562
00563 # if(GLM_COMPILER & GLM_COMPILER_VC)
00564 # if(GLM_COMPILER > GLM_COMPILER_VC8)
00565 # define GLM_HAS_OPENMP 20
00566 # endif
00567 # endif//(GLM_COMPILER & GLM_COMPILER_GCC)
00568 #endif
00569
00570
00571 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
00572
00574
00575
00576
00577
00578 #define GLM_ARCH_PURE 0x0000
00579 #define GLM_ARCH_SSE2 0x0001
00580 #define GLM_ARCH_SSE3 0x0002
00581 #define GLM_ARCH_SSE4 0x0004
00582 #define GLM_ARCH_AVX 0x0008
00583 #define GLM_ARCH_AVX2 0x0010
00584
00585 #if(defined(GLM_FORCE_PURE))
00586 # define GLM_ARCH GLM_ARCH_PURE
00587 #elif(defined(GLM_FORCE_AVX2))
00588 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00589 #elif(defined(GLM_FORCE_AVX))
00590 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00591 #elif(defined(GLM_FORCE_SSE4))
00592 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00593 #elif(defined(GLM_FORCE_SSE3))
00594 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00595 #elif(defined(GLM_FORCE_SSE2))
00596 # define GLM_ARCH (GLM_ARCH_SSE2)
00597 #elif((GLM_COMPILER & GLM_COMPILER_CLANG) || (GLM_COMPILER & GLM_COMPILER_GCC))
00598 # if(__AVX2__)
00599 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00600 # elif(__AVX__)
00601 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00602 # elif(__SSE3__)
00603 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00604 # elif(__SSE2__)
00605 # define GLM_ARCH (GLM_ARCH_SSE2)
00606 # else
00607 # define GLM_ARCH GLM_ARCH_PURE
00608 # endif
00609 #elif(GLM_COMPILER & GLM_COMPILER_VC)
00610 # if _M_IX86_FP == 2 && defined(__AVX__)
00611 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00612 # elif _M_IX86_FP == 2
00613 # define GLM_ARCH (GLM_ARCH_SSE2)
00614 # else
00615 # define GLM_ARCH (GLM_ARCH_PURE)
00616 # endif
00617 #elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC) || (GLM_COMPILER & GLM_COMPILER_CLANG))
00618 # if defined(__AVX2__)
00619 # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00620 # elif defined(__AVX__)
00621 # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00622 # elif defined(__SSE4_1__ )
00623 # define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00624 # elif defined(__SSE3__)
00625 # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00626 # elif defined(__SSE2__)
00627 # define GLM_ARCH (GLM_ARCH_SSE2)
00628 # else
00629 # define GLM_ARCH (GLM_ARCH_PURE)
00630 # endif
00631 #else
00632 # define GLM_ARCH GLM_ARCH_PURE
00633 #endif
00634
00635
00636
00637
00638 #if defined(__MINGW32__) && (GLM_ARCH != GLM_ARCH_PURE)
00639 # include <intrin.h>
00640 #endif
00641
00642 #if(GLM_ARCH & GLM_ARCH_AVX2)
00643 # include <immintrin.h>
00644 #endif//GLM_ARCH
00645 #if(GLM_ARCH & GLM_ARCH_AVX)
00646 # include <immintrin.h>
00647 #endif//GLM_ARCH
00648 #if(GLM_ARCH & GLM_ARCH_SSE4)
00649 # include <smmintrin.h>
00650 #endif//GLM_ARCH
00651 #if(GLM_ARCH & GLM_ARCH_SSE3)
00652 # include <pmmintrin.h>
00653 #endif//GLM_ARCH
00654 #if(GLM_ARCH & GLM_ARCH_SSE2)
00655 # include <emmintrin.h>
00656 # if(GLM_COMPILER == GLM_COMPILER_VC8) // VC8 is missing some intrinsics, workaround
00657 inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; }
00658 inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; }
00659 inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; }
00660 inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; }
00661 inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; }
00662 # endif
00663 #endif//GLM_ARCH
00664
00665 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
00666 # define GLM_MESSAGE_ARCH_DISPLAYED
00667 # if(GLM_ARCH == GLM_ARCH_PURE)
00668 # pragma message("GLM: Platform independent code")
00669 # elif(GLM_ARCH & GLM_ARCH_AVX2)
00670 # pragma message("GLM: AVX2 instruction set")
00671 # elif(GLM_ARCH & GLM_ARCH_AVX)
00672 # pragma message("GLM: AVX instruction set")
00673 # elif(GLM_ARCH & GLM_ARCH_SSE3)
00674 # pragma message("GLM: SSE3 instruction set")
00675 # elif(GLM_ARCH & GLM_ARCH_SSE2)
00676 # pragma message("GLM: SSE2 instruction set")
00677 # endif//GLM_ARCH
00678 # pragma message("GLM: #define GLM_FORCE_PURE to avoid using platform specific instruction sets")
00679 #endif//GLM_MESSAGE
00680
00682
00683
00684 #if GLM_HAS_STATIC_ASSERT
00685 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
00686 #elif(defined(BOOST_STATIC_ASSERT))
00687 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
00688 #elif(GLM_COMPILER & GLM_COMPILER_VC)
00689 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
00690 #else
00691 # define GLM_STATIC_ASSERT(x, message)
00692 # define GLM_STATIC_ASSERT_NULL
00693 #endif//GLM_LANG
00694
00696
00697
00698
00699
00700 #if(defined(GLM_FORCE_CUDA) || (GLM_COMPILER & GLM_COMPILER_CUDA))
00701 # define GLM_CUDA_FUNC_DEF __device__ __host__
00702 # define GLM_CUDA_FUNC_DECL __device__ __host__
00703 #else
00704 # define GLM_CUDA_FUNC_DEF
00705 # define GLM_CUDA_FUNC_DECL
00706 #endif
00707
00708 #if GLM_COMPILER & GLM_COMPILER_GCC
00709 # define GLM_VAR_USED __attribute__ ((unused))
00710 #else
00711 # define GLM_VAR_USED
00712 #endif
00713
00714 #if(defined(GLM_FORCE_INLINE))
00715 # if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
00716 # define GLM_INLINE __forceinline
00717 # elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
00718 # define GLM_INLINE __attribute__((always_inline)) inline
00719 # elif(GLM_COMPILER & GLM_COMPILER_CLANG)
00720 # define GLM_INLINE __attribute__((always_inline))
00721 # else
00722 # define GLM_INLINE inline
00723 # endif//GLM_COMPILER
00724 #else
00725 # define GLM_INLINE inline
00726 #endif//defined(GLM_FORCE_INLINE)
00727
00728 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
00729 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
00730
00732
00733
00734
00735
00736 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
00737 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
00738 # if defined(GLM_SWIZZLE)
00739 # pragma message("GLM: Swizzling operators enabled")
00740 # else
00741 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
00742 # endif
00743 #endif//GLM_MESSAGE
00744
00746
00747
00748
00749
00750 namespace glm
00751 {
00752 #if defined(GLM_FORCE_SIZE_T_LENGTH)
00753 typedef std::size_t length_t;
00754 #else
00755 typedef int length_t;
00756 #endif
00757 }
00758
00759 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH))
00760 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
00761 # if defined(GLM_FORCE_SIZE_T_LENGTH)
00762 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
00763 # else
00764 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
00765 # pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a std::size_t")
00766 # endif
00767 #endif//GLM_MESSAGE
00768
00770
00771
00772 #if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
00773 # define GLM_DEPRECATED __declspec(deprecated)
00774 # define GLM_ALIGN(x) __declspec(align(x))
00775 # define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
00776 # define GLM_RESTRICT __declspec(restrict)
00777 # define GLM_RESTRICT_VAR __restrict
00778 #elif(GLM_COMPILER & GLM_COMPILER_INTEL)
00779 # define GLM_DEPRECATED
00780 # define GLM_ALIGN(x) __declspec(align(x))
00781 # define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
00782 # define GLM_RESTRICT
00783 # define GLM_RESTRICT_VAR __restrict
00784 #elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
00785 # define GLM_DEPRECATED __attribute__((__deprecated__))
00786 # define GLM_ALIGN(x) __attribute__((aligned(x)))
00787 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
00788 # define GLM_RESTRICT __restrict__
00789 # define GLM_RESTRICT_VAR __restrict__
00790 #else
00791 # define GLM_DEPRECATED
00792 # define GLM_ALIGN
00793 # define GLM_ALIGNED_STRUCT(x)
00794 # define GLM_RESTRICT
00795 # define GLM_RESTRICT_VAR
00796 #endif//GLM_COMPILER
00797
00798 #if GLM_HAS_CONSTEXPR
00799 # define GLM_CONSTEXPR constexpr
00800 #else
00801 # define GLM_CONSTEXPR
00802 #endif