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