00001
00002
00004
00005
00006
00007
00009
00010 #ifndef glm_setup
00011 #define glm_setup
00012
00014
00015
00016 #define GLM_VERSION 92
00017 #define GLM_VERSION_MAJOR 0
00018 #define GLM_VERSION_MINOR 9
00019 #define GLM_VERSION_PATCH 2
00020 #define GLM_VERSION_REVISION 0
00021
00022
00024
00025
00026
00027
00028 #define GLM_COMPILER_UNKNOWN 0x00000000
00029
00030
00031 #define GLM_COMPILER_VC 0x01000000
00032 #define GLM_COMPILER_VC2 0x01000010
00033 #define GLM_COMPILER_VC4 0x01000020
00034 #define GLM_COMPILER_VC5 0x01000030
00035 #define GLM_COMPILER_VC6 0x01000040
00036 #define GLM_COMPILER_VC2002 0x01000050
00037 #define GLM_COMPILER_VC2003 0x01000060
00038 #define GLM_COMPILER_VC2005 0x01000070
00039 #define GLM_COMPILER_VC2008 0x01000080
00040 #define GLM_COMPILER_VC2010 0x01000090
00041 #define GLM_COMPILER_VC2011 0x010000A0
00042
00043
00044 #define GLM_COMPILER_GCC 0x02000000
00045 #define GLM_COMPILER_GCC30 0x02000010
00046 #define GLM_COMPILER_GCC31 0x02000020
00047 #define GLM_COMPILER_GCC32 0x02000030
00048 #define GLM_COMPILER_GCC33 0x02000040
00049 #define GLM_COMPILER_GCC34 0x02000050
00050 #define GLM_COMPILER_GCC35 0x02000060
00051 #define GLM_COMPILER_GCC40 0x02000070
00052 #define GLM_COMPILER_GCC41 0x02000080
00053 #define GLM_COMPILER_GCC42 0x02000090
00054 #define GLM_COMPILER_GCC43 0x020000A0
00055 #define GLM_COMPILER_GCC44 0x020000B0
00056 #define GLM_COMPILER_GCC45 0x020000C0
00057 #define GLM_COMPILER_GCC46 0x020000D0
00058 #define GLM_COMPILER_GCC47 0x020000E0
00059 #define GLM_COMPILER_GCC48 0x020000F0
00060 #define GLM_COMPILER_GCC49 0x02000100
00061 #define GLM_COMPILER_GCC50 0x02000200
00062
00063
00064
00065
00066
00067 #define GLM_COMPILER_BC 0x04000000
00068 #define GLM_COMPILER_BCB4 0x04000100
00069 #define GLM_COMPILER_BCB5 0x04000200
00070 #define GLM_COMPILER_BCB6 0x04000300
00071
00072 #define GLM_COMPILER_BCB2009 0x04000500
00073
00074
00075 #define GLM_COMPILER_CODEWARRIOR 0x08000000
00076
00077
00078 #define GLM_COMPILER_CUDA 0x10000000
00079 #define GLM_COMPILER_CUDA30 0x10000010
00080 #define GLM_COMPILER_CUDA31 0x10000020
00081 #define GLM_COMPILER_CUDA32 0x10000030
00082 #define GLM_COMPILER_CUDA40 0x10000040
00083
00084
00085 #define GLM_MODEL_32 0x00000010
00086 #define GLM_MODEL_64 0x00000020
00087
00088
00089 #ifdef GLM_FORCE_COMPILER_UNKNOWN
00090 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
00091
00092 #elif defined(_MSC_VER)
00093 # if _MSC_VER == 900
00094 # define GLM_COMPILER GLM_COMPILER_VC2
00095 # elif _MSC_VER == 1000
00096 # define GLM_COMPILER GLM_COMPILER_VC4
00097 # elif _MSC_VER == 1100
00098 # define GLM_COMPILER GLM_COMPILER_VC5
00099 # elif _MSC_VER == 1200
00100 # define GLM_COMPILER GLM_COMPILER_VC6
00101 # elif _MSC_VER == 1300
00102 # define GLM_COMPILER GLM_COMPILER_VC2002
00103 # elif _MSC_VER == 1310
00104 # define GLM_COMPILER GLM_COMPILER_VC2003
00105 # elif _MSC_VER == 1400
00106 # define GLM_COMPILER GLM_COMPILER_VC2005
00107 # elif _MSC_VER == 1500
00108 # define GLM_COMPILER GLM_COMPILER_VC2008
00109 # elif _MSC_VER == 1600
00110 # define GLM_COMPILER GLM_COMPILER_VC2010
00111 # elif _MSC_VER == 1700
00112 # define GLM_COMPILER GLM_COMPILER_VC2011
00113 # else//_MSC_VER
00114 # define GLM_COMPILER GLM_COMPILER_VC
00115 # endif//_MSC_VER
00116
00117
00118 #elif defined(__GNUC__)
00119 # if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
00120 # define GLM_COMPILER GLM_COMPILER_GCC32
00121 # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
00122 # define GLM_COMPILER GLM_COMPILER_GCC33
00123 # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
00124 # define GLM_COMPILER GLM_COMPILER_GCC34
00125 # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
00126 # define GLM_COMPILER GLM_COMPILER_GCC35
00127 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
00128 # define GLM_COMPILER GLM_COMPILER_GCC40
00129 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
00130 # define GLM_COMPILER GLM_COMPILER_GCC41
00131 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
00132 # define GLM_COMPILER GLM_COMPILER_GCC42
00133 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
00134 # define GLM_COMPILER GLM_COMPILER_GCC43
00135 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
00136 # define GLM_COMPILER GLM_COMPILER_GCC44
00137 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
00138 # define GLM_COMPILER GLM_COMPILER_GCC45
00139 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
00140 # define GLM_COMPILER GLM_COMPILER_GCC46
00141 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
00142 # define GLM_COMPILER GLM_COMPILER_GCC47
00143 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
00144 # define GLM_COMPILER GLM_COMPILER_GCC48
00145 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
00146 # define GLM_COMPILER GLM_COMPILER_GCC49
00147 # elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
00148 # define GLM_COMPILER GLM_COMPILER_GCC50
00149 # else
00150 # define GLM_COMPILER GLM_COMPILER_GCC
00151 # endif
00152
00153
00154 #elif defined(_BORLANDC_)
00155 # if defined(VER125)
00156 # define GLM_COMPILER GLM_COMPILER_BCB4
00157 # elif defined(VER130)
00158 # define GLM_COMPILER GLM_COMPILER_BCB5
00159 # elif defined(VER140)
00160 # define GLM_COMPILER GLM_COMPILER_BCB6
00161 # elif defined(VER200)
00162 # define GLM_COMPILER GLM_COMPILER_BCB2009
00163 # else
00164 # define GLM_COMPILER GLM_COMPILER_BC
00165 # endif
00166
00167
00168 #elif defined(__MWERKS__)
00169 # define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189 #else
00190 # define GLM_COMPILER GLM_COMPILER_UNKNOWN
00191 #endif
00192
00193 #ifndef GLM_COMPILER
00194 #error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
00195 #endif//GLM_COMPILER
00196
00197
00198 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
00199 # define GLM_MESSAGE_COMPILER_DISPLAYED
00200 # if(GLM_COMPILER & GLM_COMPILER_VC)
00201 # pragma message("GLM: Visual C++ compiler detected")
00202 # elif(GLM_COMPILER & GLM_COMPILER_GCC)
00203 # pragma message("GLM: GCC compiler detected")
00204 # elif(GLM_COMPILER & GLM_COMPILER_BC)
00205 # pragma message("GLM: Borland compiler detected but not supported")
00206 # elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
00207 # pragma message("GLM: Codewarrior compiler detected but not supported")
00208 # else
00209 # pragma message("GLM: Compiler not detected")
00210 # endif
00211 #endif//GLM_MESSAGE
00212
00214
00215
00216 #if(GLM_COMPILER & GLM_COMPILER_VC)
00217 # if defined(_M_X64)
00218 # define GLM_MODEL GLM_MODEL_64
00219 # else
00220 # define GLM_MODEL GLM_MODEL_32
00221 # endif//_M_X64
00222 #elif(GLM_COMPILER & GLM_COMPILER_GCC)
00223 # if(defined(__WORDSIZE) && (__WORDSIZE == 64)) || defined(__arch64__) || defined(__LP64__) || defined(__x86_64__)
00224 # define GLM_MODEL GLM_MODEL_64
00225 # else
00226 # define GLM_MODEL GLM_MODEL_32
00227 # endif//
00228 #else
00229 # define GLM_MODEL GLM_MODEL_32
00230 #endif//
00231
00232 #if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
00233 #error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
00234 #endif//GLM_MODEL
00235
00236 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
00237 # define GLM_MESSAGE_MODEL_DISPLAYED
00238 # if(GLM_MODEL == GLM_MODEL_64)
00239 # pragma message("GLM: 64 bits model")
00240 # elif(GLM_MODEL == GLM_MODEL_32)
00241 # pragma message("GLM: 32 bits model")
00242 # endif//GLM_MODEL
00243 #endif//GLM_MESSAGE
00244
00246
00247
00248
00249
00250 #define GLM_LANG_CXX 0
00251 #define GLM_LANG_CXX98 1
00252 #define GLM_LANG_CXX0X 2
00253 #define GLM_LANG_CXXMS 3
00254 #define GLM_LANG_CXXGNU 4
00255
00256 #if(defined(GLM_FORCE_CXX98))
00257 # define GLM_LANG GLM_LANG_CXX98
00258 #elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__)) // -std=c++0x or -std=gnu++0x
00259 # define GLM_LANG GLM_LANG_CXX0X
00260 #elif(GLM_COMPILER == GLM_COMPILER_VC2010) //_MSC_EXTENSIONS for MS language extensions
00261 # define GLM_LANG GLM_LANG_CXX0X
00262 #elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__STRICT_ANSI__))
00263 # define GLM_LANG GLM_LANG_CXX98
00264 #elif(((GLM_COMPILER & GLM_COMPILER_VC) == GLM_COMPILER_VC) && !defined(_MSC_EXTENSIONS))
00265 # define GLM_LANG GLM_LANG_CXX98
00266 #else
00267 # define GLM_LANG GLM_LANG_CXX
00268 #endif
00269
00270 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
00271 # define GLM_MESSAGE_LANG_DISPLAYED
00272 # if(GLM_LANG == GLM_LANG_CXX98)
00273 # pragma message("GLM: C++98")
00274 # elif(GLM_LANG == GLM_LANG_CXX0X)
00275 # pragma message("GLM: C++0x")
00276 # endif//GLM_MODEL
00277 #endif//GLM_MESSAGE
00278
00280
00281
00282
00283
00284 #define GLM_ARCH_PURE 0x0000 //(0x0000)
00285 #define GLM_ARCH_SSE2 0x0001 //(0x0001)
00286 #define GLM_ARCH_SSE3 0x0003 //(0x0002 | GLM_ARCH_SSE2)
00287 #define GLM_ARCH_AVX 0x0007 //(0x0004 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
00288
00289 #if(defined(GLM_FORCE_PURE))
00290 # define GLM_ARCH GLM_ARCH_PURE
00291 #elif(defined(GLM_FORCE_AVX))
00292 # define GLM_ARCH GLM_ARCH_AVX
00293 #elif(defined(GLM_FORCE_SSE3))
00294 # define GLM_ARCH GLM_ARCH_SSE3
00295 #elif(defined(GLM_FORCE_SSE2))
00296 # define GLM_ARCH GLM_ARCH_SSE2
00297 #elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64)))
00298 # if(defined(_M_CEE_PURE))
00299 # define GLM_ARCH GLM_ARCH_PURE
00300 # elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
00301 # if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version
00302 # define GLM_ARCH GLM_ARCH_AVX //GLM_ARCH_AVX (Require SP1)
00303 # else
00304 # define GLM_ARCH GLM_ARCH_SSE3
00305 # endif
00306 # elif(GLM_COMPILER >= GLM_COMPILER_VC2008)
00307 # define GLM_ARCH GLM_ARCH_SSE3
00308 # elif(GLM_COMPILER >= GLM_COMPILER_VC2005)
00309 # define GLM_ARCH GLM_ARCH_SSE2
00310 # else
00311 # define GLM_ARCH GLM_ARCH_PURE
00312 # endif
00313 #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__)))
00314 # if(defined(__AVX__))
00315 # define GLM_ARCH GLM_ARCH_AVX
00316 # elif(defined(__SSE3__))
00317 # define GLM_ARCH GLM_ARCH_SSE3
00318 # elif(defined(__SSE2__))
00319 # define GLM_ARCH GLM_ARCH_SSE2
00320 # else
00321 # define GLM_ARCH GLM_ARCH_PURE
00322 # endif
00323 #else
00324 # define GLM_ARCH GLM_ARCH_PURE
00325 #endif
00326
00327 #if(GLM_ARCH != GLM_ARCH_PURE)
00328 #if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX)
00329 # include <immintrin.h>
00330 #endif//GLM_ARCH
00331 #if((GLM_ARCH & GLM_ARCH_SSE3) == GLM_ARCH_SSE3)
00332 # include <pmmintrin.h>
00333 #endif//GLM_ARCH
00334 #if((GLM_ARCH & GLM_ARCH_SSE2) == GLM_ARCH_SSE2)
00335 # include <emmintrin.h>
00336 #endif//GLM_ARCH
00337 #endif//(GLM_ARCH != GLM_ARCH_PURE)
00338
00339 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
00340 # define GLM_MESSAGE_ARCH_DISPLAYED
00341 # if(GLM_ARCH == GLM_ARCH_PURE)
00342 # pragma message("GLM: Platform independent")
00343 # elif(GLM_ARCH == GLM_ARCH_SSE2)
00344 # pragma message("GLM: SSE2 build platform")
00345 # elif(GLM_ARCH == GLM_ARCH_SSE3)
00346 # pragma message("GLM: SSE3 build platform")
00347 # elif(GLM_ARCH == GLM_ARCH_AVX)
00348 # pragma message("GLM: AVX build platform")
00349 # endif//GLM_ARCH
00350 #endif//GLM_MESSAGE
00351
00353
00354
00355
00356 #define GLM_COMPONENT_GLSL_NAMES 0
00357 #define GLM_COMPONENT_ONLY_XYZW 1 // To disable multiple vector component names access.
00358 #define GLM_COMPONENT_MS_EXT 2 // To use anonymous union to provide multiple component names access for class valType. Visual C++ only.
00359
00360 #ifndef GLM_FORCE_ONLY_XYZW
00361 # if((GLM_COMPILER & GLM_COMPILER_VC) && defined(_MSC_EXTENSIONS))
00362 # define GLM_COMPONENT GLM_COMPONENT_MS_EXT
00363 # else
00364 # define GLM_COMPONENT GLM_COMPONENT_GLSL_NAMES
00365 # endif
00366 #else
00367 # define GLM_COMPONENT GLM_COMPONENT_ONLY_XYZW
00368 #endif
00369
00370 #if((GLM_COMPONENT == GLM_COMPONENT_MS_EXT) && !(GLM_COMPILER & GLM_COMPILER_VC))
00371 # error "GLM_COMPONENT value is GLM_COMPONENT_MS_EXT but this is not allowed with the current compiler."
00372 #endif
00373
00374 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPONENT_DISPLAYED))
00375 # define GLM_MESSAGE_COMPONENT_DISPLAYED
00376 # if(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
00377 # pragma message("GLM: GLSL multiple vector component names")
00378 # elif(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
00379 # pragma message("GLM: x,y,z,w vector component names only")
00380 # elif(GLM_COMPONENT == GLM_COMPONENT_MS_EXT)
00381 # pragma message("GLM: Multiple vector component names through Visual C++ language extensions")
00382 # else
00383 # error "GLM_COMPONENT value unknown"
00384 # endif//GLM_MESSAGE_COMPONENT_DISPLAYED
00385 #endif//GLM_MESSAGE
00386
00388
00389
00390 #if(GLM_LANG == GLM_LANG_CXX0X)
00391 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
00392 #elif(defined(BOOST_STATIC_ASSERT))
00393 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
00394 #elif(GLM_COMPILER & GLM_COMPILER_VC)
00395 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
00396 #else
00397 # define GLM_STATIC_ASSERT(x, message)
00398 # define GLM_STATIC_ASSERT_NULL
00399 #endif//GLM_LANG
00400
00402
00403
00404
00405
00406 #if(defined(GLM_FORCE_CUDA) || (defined(GLM_COMPILER) && (GLM_COMPILER >= GLM_COMPILER_CUDA30)))
00407 # define GLM_CUDA_FUNC_DEF __device__ __host__
00408 # define GLM_CUDA_FUNC_DECL __device__ __host__
00409 #else
00410 # define GLM_CUDA_FUNC_DEF
00411 # define GLM_CUDA_FUNC_DECL
00412 #endif
00413
00414 #if(defined(GLM_FORCE_INLINE))
00415 # if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
00416 # define GLM_INLINE __forceinline
00417 # elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
00418 # define GLM_INLINE __attribute__((always_inline))
00419 # else
00420 # define GLM_INLINE inline
00421 # endif//GLM_COMPILER
00422 #else
00423 # define GLM_INLINE inline
00424 #endif//defined(GLM_FORCE_INLINE)
00425
00426 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
00427 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
00428
00430
00431
00432
00433
00434 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
00435 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
00436 # if(defined(GLM_SWIZZLE))
00437 # pragma message("GLM: Full swizzling operator enabled")
00438 # elif(!defined(GLM_SWIZZLE_XYZW) && !defined(GLM_SWIZZLE_RGBA) && !defined(GLM_SWIZZLE_STQP) && !defined(GLM_SWIZZLE))
00439 # pragma message("GLM: No swizzling operator enabled")
00440 # else
00441 # pragma message("GLM: Partial swizzling operator enabled")
00442 # endif
00443 #endif//GLM_MESSAGE
00444
00445 #endif//glm_setup