setup.hpp 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135
  1. #ifndef GLM_SETUP_INCLUDED
  2. #include <cassert>
  3. #include <cstddef>
  4. #define GLM_VERSION_MAJOR 0
  5. #define GLM_VERSION_MINOR 9
  6. #define GLM_VERSION_PATCH 9
  7. #define GLM_VERSION_REVISION 8
  8. #define GLM_VERSION 998
  9. #define GLM_VERSION_MESSAGE "GLM: version 0.9.9.8"
  10. #define GLM_SETUP_INCLUDED GLM_VERSION
  11. ///////////////////////////////////////////////////////////////////////////////////
  12. // Active states
  13. #define GLM_DISABLE 0
  14. #define GLM_ENABLE 1
  15. ///////////////////////////////////////////////////////////////////////////////////
  16. // Messages
  17. #if defined(GLM_FORCE_MESSAGES)
  18. # define GLM_MESSAGES GLM_ENABLE
  19. #else
  20. # define GLM_MESSAGES GLM_DISABLE
  21. #endif
  22. ///////////////////////////////////////////////////////////////////////////////////
  23. // Detect the platform
  24. #include "../simd/platform.h"
  25. ///////////////////////////////////////////////////////////////////////////////////
  26. // Build model
  27. #if defined(_M_ARM64) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__)
  28. # define GLM_MODEL GLM_MODEL_64
  29. #elif defined(__i386__) || defined(__ppc__) || defined(__ILP32__) || defined(_M_ARM)
  30. # define GLM_MODEL GLM_MODEL_32
  31. #else
  32. # define GLM_MODEL GLM_MODEL_32
  33. #endif//
  34. #if !defined(GLM_MODEL) && GLM_COMPILER != 0
  35. # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
  36. #endif//GLM_MODEL
  37. ///////////////////////////////////////////////////////////////////////////////////
  38. // C++ Version
  39. // User defines: GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_FORCE_CXX11, GLM_FORCE_CXX14, GLM_FORCE_CXX17, GLM_FORCE_CXX2A
  40. #define GLM_LANG_CXX98_FLAG (1 << 1)
  41. #define GLM_LANG_CXX03_FLAG (1 << 2)
  42. #define GLM_LANG_CXX0X_FLAG (1 << 3)
  43. #define GLM_LANG_CXX11_FLAG (1 << 4)
  44. #define GLM_LANG_CXX14_FLAG (1 << 5)
  45. #define GLM_LANG_CXX17_FLAG (1 << 6)
  46. #define GLM_LANG_CXX2A_FLAG (1 << 7)
  47. #define GLM_LANG_CXXMS_FLAG (1 << 8)
  48. #define GLM_LANG_CXXGNU_FLAG (1 << 9)
  49. #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG
  50. #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
  51. #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
  52. #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
  53. #define GLM_LANG_CXX14 (GLM_LANG_CXX11 | GLM_LANG_CXX14_FLAG)
  54. #define GLM_LANG_CXX17 (GLM_LANG_CXX14 | GLM_LANG_CXX17_FLAG)
  55. #define GLM_LANG_CXX2A (GLM_LANG_CXX17 | GLM_LANG_CXX2A_FLAG)
  56. #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
  57. #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
  58. #if (defined(_MSC_EXTENSIONS))
  59. # define GLM_LANG_EXT GLM_LANG_CXXMS_FLAG
  60. #elif ((GLM_COMPILER & (GLM_COMPILER_CLANG | GLM_COMPILER_GCC)) && (GLM_ARCH & GLM_ARCH_SIMD_BIT))
  61. # define GLM_LANG_EXT GLM_LANG_CXXMS_FLAG
  62. #else
  63. # define GLM_LANG_EXT 0
  64. #endif
  65. #if (defined(GLM_FORCE_CXX_UNKNOWN))
  66. # define GLM_LANG 0
  67. #elif defined(GLM_FORCE_CXX2A)
  68. # define GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT)
  69. # define GLM_LANG_STL11_FORCED
  70. #elif defined(GLM_FORCE_CXX17)
  71. # define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT)
  72. # define GLM_LANG_STL11_FORCED
  73. #elif defined(GLM_FORCE_CXX14)
  74. # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_EXT)
  75. # define GLM_LANG_STL11_FORCED
  76. #elif defined(GLM_FORCE_CXX11)
  77. # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_EXT)
  78. # define GLM_LANG_STL11_FORCED
  79. #elif defined(GLM_FORCE_CXX03)
  80. # define GLM_LANG (GLM_LANG_CXX03 | GLM_LANG_EXT)
  81. #elif defined(GLM_FORCE_CXX98)
  82. # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_EXT)
  83. #else
  84. # if GLM_COMPILER & GLM_COMPILER_VC && defined(_MSVC_LANG)
  85. # if GLM_COMPILER >= GLM_COMPILER_VC15_7
  86. # define GLM_LANG_PLATFORM _MSVC_LANG
  87. # elif GLM_COMPILER >= GLM_COMPILER_VC15
  88. # if _MSVC_LANG > 201402L
  89. # define GLM_LANG_PLATFORM 201402L
  90. # else
  91. # define GLM_LANG_PLATFORM _MSVC_LANG
  92. # endif
  93. # else
  94. # define GLM_LANG_PLATFORM 0
  95. # endif
  96. # else
  97. # define GLM_LANG_PLATFORM 0
  98. # endif
  99. # if __cplusplus > 201703L || GLM_LANG_PLATFORM > 201703L
  100. # define GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT)
  101. # elif __cplusplus == 201703L || GLM_LANG_PLATFORM == 201703L
  102. # define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT)
  103. # elif __cplusplus == 201402L || __cplusplus == 201500L || GLM_LANG_PLATFORM == 201402L
  104. # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_EXT)
  105. # elif __cplusplus == 201103L || GLM_LANG_PLATFORM == 201103L
  106. # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_EXT)
  107. # elif defined(__INTEL_CXX11_MODE__) || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  108. # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_EXT)
  109. # elif __cplusplus == 199711L
  110. # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_EXT)
  111. # else
  112. # define GLM_LANG (0 | GLM_LANG_EXT)
  113. # endif
  114. #endif
  115. ///////////////////////////////////////////////////////////////////////////////////
  116. // Has of C++ features
  117. // http://clang.llvm.org/cxx_status.html
  118. // http://gcc.gnu.org/projects/cxx0x.html
  119. // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
  120. // Android has multiple STLs but C++11 STL detection doesn't always work #284 #564
  121. #if GLM_PLATFORM == GLM_PLATFORM_ANDROID && !defined(GLM_LANG_STL11_FORCED)
  122. # define GLM_HAS_CXX11_STL 0
  123. #elif GLM_COMPILER & GLM_COMPILER_CLANG
  124. # if (defined(_LIBCPP_VERSION) || (GLM_LANG & GLM_LANG_CXX11_FLAG) || defined(GLM_LANG_STL11_FORCED))
  125. # define GLM_HAS_CXX11_STL 1
  126. # else
  127. # define GLM_HAS_CXX11_STL 0
  128. # endif
  129. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  130. # define GLM_HAS_CXX11_STL 1
  131. #else
  132. # define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  133. ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \
  134. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
  135. ((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15))))
  136. #endif
  137. // N1720
  138. #if GLM_COMPILER & GLM_COMPILER_CLANG
  139. # define GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert)
  140. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  141. # define GLM_HAS_STATIC_ASSERT 1
  142. #else
  143. # define GLM_HAS_STATIC_ASSERT ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  144. ((GLM_COMPILER & GLM_COMPILER_CUDA)) || \
  145. ((GLM_COMPILER & GLM_COMPILER_VC))))
  146. #endif
  147. // N1988
  148. #if GLM_LANG & GLM_LANG_CXX11_FLAG
  149. # define GLM_HAS_EXTENDED_INTEGER_TYPE 1
  150. #else
  151. # define GLM_HAS_EXTENDED_INTEGER_TYPE (\
  152. ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC)) || \
  153. ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \
  154. ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG)))
  155. #endif
  156. // N2672 Initializer lists http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm
  157. #if GLM_COMPILER & GLM_COMPILER_CLANG
  158. # define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers)
  159. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  160. # define GLM_HAS_INITIALIZER_LISTS 1
  161. #else
  162. # define GLM_HAS_INITIALIZER_LISTS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  163. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \
  164. ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
  165. ((GLM_COMPILER & GLM_COMPILER_CUDA))))
  166. #endif
  167. // N2544 Unrestricted unions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf
  168. #if GLM_COMPILER & GLM_COMPILER_CLANG
  169. # define GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)
  170. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  171. # define GLM_HAS_UNRESTRICTED_UNIONS 1
  172. #else
  173. # define GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  174. (GLM_COMPILER & GLM_COMPILER_VC) || \
  175. ((GLM_COMPILER & GLM_COMPILER_CUDA)))
  176. #endif
  177. // N2346
  178. #if GLM_COMPILER & GLM_COMPILER_CLANG
  179. # define GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions)
  180. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  181. # define GLM_HAS_DEFAULTED_FUNCTIONS 1
  182. #else
  183. # define GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  184. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
  185. ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \
  186. (GLM_COMPILER & GLM_COMPILER_CUDA)))
  187. #endif
  188. // N2118
  189. #if GLM_COMPILER & GLM_COMPILER_CLANG
  190. # define GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
  191. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  192. # define GLM_HAS_RVALUE_REFERENCES 1
  193. #else
  194. # define GLM_HAS_RVALUE_REFERENCES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  195. ((GLM_COMPILER & GLM_COMPILER_VC)) || \
  196. ((GLM_COMPILER & GLM_COMPILER_CUDA))))
  197. #endif
  198. // N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
  199. #if GLM_COMPILER & GLM_COMPILER_CLANG
  200. # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions)
  201. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  202. # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1
  203. #else
  204. # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  205. ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
  206. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
  207. ((GLM_COMPILER & GLM_COMPILER_CUDA))))
  208. #endif
  209. // N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
  210. #if GLM_COMPILER & GLM_COMPILER_CLANG
  211. # define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates)
  212. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  213. # define GLM_HAS_TEMPLATE_ALIASES 1
  214. #else
  215. # define GLM_HAS_TEMPLATE_ALIASES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  216. ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \
  217. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
  218. ((GLM_COMPILER & GLM_COMPILER_CUDA))))
  219. #endif
  220. // N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
  221. #if GLM_COMPILER & GLM_COMPILER_CLANG
  222. # define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for)
  223. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  224. # define GLM_HAS_RANGE_FOR 1
  225. #else
  226. # define GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  227. ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \
  228. ((GLM_COMPILER & GLM_COMPILER_VC)) || \
  229. ((GLM_COMPILER & GLM_COMPILER_CUDA))))
  230. #endif
  231. // N2341 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf
  232. #if GLM_COMPILER & GLM_COMPILER_CLANG
  233. # define GLM_HAS_ALIGNOF __has_feature(cxx_alignas)
  234. #elif GLM_LANG & GLM_LANG_CXX11_FLAG
  235. # define GLM_HAS_ALIGNOF 1
  236. #else
  237. # define GLM_HAS_ALIGNOF ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  238. ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)) || \
  239. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)) || \
  240. ((GLM_COMPILER & GLM_COMPILER_CUDA))))
  241. #endif
  242. // N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf
  243. // N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html
  244. #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) // Compiler SIMD intrinsics don't support constexpr...
  245. # define GLM_HAS_CONSTEXPR 0
  246. #elif (GLM_COMPILER & GLM_COMPILER_CLANG)
  247. # define GLM_HAS_CONSTEXPR __has_feature(cxx_relaxed_constexpr)
  248. #elif (GLM_LANG & GLM_LANG_CXX14_FLAG)
  249. # define GLM_HAS_CONSTEXPR 1
  250. #else
  251. # define GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && GLM_HAS_INITIALIZER_LISTS && (\
  252. ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL17)) || \
  253. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15))))
  254. #endif
  255. #if GLM_HAS_CONSTEXPR
  256. # define GLM_CONSTEXPR constexpr
  257. #else
  258. # define GLM_CONSTEXPR
  259. #endif
  260. //
  261. #if GLM_HAS_CONSTEXPR
  262. # if (GLM_COMPILER & GLM_COMPILER_CLANG)
  263. # if __has_feature(cxx_if_constexpr)
  264. # define GLM_HAS_IF_CONSTEXPR 1
  265. # else
  266. # define GLM_HAS_IF_CONSTEXPR 0
  267. # endif
  268. # elif (GLM_LANG & GLM_LANG_CXX17_FLAG)
  269. # define GLM_HAS_IF_CONSTEXPR 1
  270. # else
  271. # define GLM_HAS_IF_CONSTEXPR 0
  272. # endif
  273. #else
  274. # define GLM_HAS_IF_CONSTEXPR 0
  275. #endif
  276. #if GLM_HAS_IF_CONSTEXPR
  277. # define GLM_IF_CONSTEXPR if constexpr
  278. #else
  279. # define GLM_IF_CONSTEXPR if
  280. #endif
  281. //
  282. #if GLM_LANG & GLM_LANG_CXX11_FLAG
  283. # define GLM_HAS_ASSIGNABLE 1
  284. #else
  285. # define GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  286. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \
  287. ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))))
  288. #endif
  289. //
  290. #define GLM_HAS_TRIVIAL_QUERIES 0
  291. //
  292. #if GLM_LANG & GLM_LANG_CXX11_FLAG
  293. # define GLM_HAS_MAKE_SIGNED 1
  294. #else
  295. # define GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
  296. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
  297. ((GLM_COMPILER & GLM_COMPILER_CUDA))))
  298. #endif
  299. //
  300. #if defined(GLM_FORCE_INTRINSICS)
  301. # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
  302. ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \
  303. ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT))))
  304. #else
  305. # define GLM_HAS_BITSCAN_WINDOWS 0
  306. #endif
  307. ///////////////////////////////////////////////////////////////////////////////////
  308. // OpenMP
  309. #ifdef _OPENMP
  310. # if GLM_COMPILER & GLM_COMPILER_GCC
  311. # if GLM_COMPILER >= GLM_COMPILER_GCC61
  312. # define GLM_HAS_OPENMP 45
  313. # elif GLM_COMPILER >= GLM_COMPILER_GCC49
  314. # define GLM_HAS_OPENMP 40
  315. # elif GLM_COMPILER >= GLM_COMPILER_GCC47
  316. # define GLM_HAS_OPENMP 31
  317. # else
  318. # define GLM_HAS_OPENMP 0
  319. # endif
  320. # elif GLM_COMPILER & GLM_COMPILER_CLANG
  321. # if GLM_COMPILER >= GLM_COMPILER_CLANG38
  322. # define GLM_HAS_OPENMP 31
  323. # else
  324. # define GLM_HAS_OPENMP 0
  325. # endif
  326. # elif GLM_COMPILER & GLM_COMPILER_VC
  327. # define GLM_HAS_OPENMP 20
  328. # elif GLM_COMPILER & GLM_COMPILER_INTEL
  329. # if GLM_COMPILER >= GLM_COMPILER_INTEL16
  330. # define GLM_HAS_OPENMP 40
  331. # else
  332. # define GLM_HAS_OPENMP 0
  333. # endif
  334. # else
  335. # define GLM_HAS_OPENMP 0
  336. # endif
  337. #else
  338. # define GLM_HAS_OPENMP 0
  339. #endif
  340. ///////////////////////////////////////////////////////////////////////////////////
  341. // nullptr
  342. #if GLM_LANG & GLM_LANG_CXX0X_FLAG
  343. # define GLM_CONFIG_NULLPTR GLM_ENABLE
  344. #else
  345. # define GLM_CONFIG_NULLPTR GLM_DISABLE
  346. #endif
  347. #if GLM_CONFIG_NULLPTR == GLM_ENABLE
  348. # define GLM_NULLPTR nullptr
  349. #else
  350. # define GLM_NULLPTR 0
  351. #endif
  352. ///////////////////////////////////////////////////////////////////////////////////
  353. // Static assert
  354. #if GLM_HAS_STATIC_ASSERT
  355. # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
  356. #elif GLM_COMPILER & GLM_COMPILER_VC
  357. # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
  358. #else
  359. # define GLM_STATIC_ASSERT(x, message) assert(x)
  360. #endif//GLM_LANG
  361. ///////////////////////////////////////////////////////////////////////////////////
  362. // Qualifiers
  363. #if GLM_COMPILER & GLM_COMPILER_CUDA
  364. # define GLM_CUDA_FUNC_DEF __device__ __host__
  365. # define GLM_CUDA_FUNC_DECL __device__ __host__
  366. #else
  367. # define GLM_CUDA_FUNC_DEF
  368. # define GLM_CUDA_FUNC_DECL
  369. #endif
  370. #if defined(GLM_FORCE_INLINE)
  371. # if GLM_COMPILER & GLM_COMPILER_VC
  372. # define GLM_INLINE __forceinline
  373. # define GLM_NEVER_INLINE __declspec((noinline))
  374. # elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)
  375. # define GLM_INLINE inline __attribute__((__always_inline__))
  376. # define GLM_NEVER_INLINE __attribute__((__noinline__))
  377. # elif GLM_COMPILER & GLM_COMPILER_CUDA
  378. # define GLM_INLINE __forceinline__
  379. # define GLM_NEVER_INLINE __noinline__
  380. # else
  381. # define GLM_INLINE inline
  382. # define GLM_NEVER_INLINE
  383. # endif//GLM_COMPILER
  384. #else
  385. # define GLM_INLINE inline
  386. # define GLM_NEVER_INLINE
  387. #endif//defined(GLM_FORCE_INLINE)
  388. #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
  389. #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
  390. ///////////////////////////////////////////////////////////////////////////////////
  391. // Swizzle operators
  392. // User defines: GLM_FORCE_SWIZZLE
  393. #define GLM_SWIZZLE_DISABLED 0
  394. #define GLM_SWIZZLE_OPERATOR 1
  395. #define GLM_SWIZZLE_FUNCTION 2
  396. #if defined(GLM_FORCE_XYZW_ONLY)
  397. # undef GLM_FORCE_SWIZZLE
  398. #endif
  399. #if defined(GLM_SWIZZLE)
  400. # pragma message("GLM: GLM_SWIZZLE is deprecated, use GLM_FORCE_SWIZZLE instead.")
  401. # define GLM_FORCE_SWIZZLE
  402. #endif
  403. #if defined(GLM_FORCE_SWIZZLE) && (GLM_LANG & GLM_LANG_CXXMS_FLAG)
  404. # define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_OPERATOR
  405. #elif defined(GLM_FORCE_SWIZZLE)
  406. # define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_FUNCTION
  407. #else
  408. # define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_DISABLED
  409. #endif
  410. ///////////////////////////////////////////////////////////////////////////////////
  411. // Allows using not basic types as genType
  412. // #define GLM_FORCE_UNRESTRICTED_GENTYPE
  413. #ifdef GLM_FORCE_UNRESTRICTED_GENTYPE
  414. # define GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_ENABLE
  415. #else
  416. # define GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_DISABLE
  417. #endif
  418. ///////////////////////////////////////////////////////////////////////////////////
  419. // Clip control, define GLM_FORCE_DEPTH_ZERO_TO_ONE before including GLM
  420. // to use a clip space between 0 to 1.
  421. // Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM
  422. // to use left handed coordinate system by default.
  423. #define GLM_CLIP_CONTROL_ZO_BIT (1 << 0) // ZERO_TO_ONE
  424. #define GLM_CLIP_CONTROL_NO_BIT (1 << 1) // NEGATIVE_ONE_TO_ONE
  425. #define GLM_CLIP_CONTROL_LH_BIT (1 << 2) // LEFT_HANDED, For DirectX, Metal, Vulkan
  426. #define GLM_CLIP_CONTROL_RH_BIT (1 << 3) // RIGHT_HANDED, For OpenGL, default in GLM
  427. #define GLM_CLIP_CONTROL_LH_ZO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_ZO_BIT)
  428. #define GLM_CLIP_CONTROL_LH_NO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_NO_BIT)
  429. #define GLM_CLIP_CONTROL_RH_ZO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_ZO_BIT)
  430. #define GLM_CLIP_CONTROL_RH_NO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_NO_BIT)
  431. #ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE
  432. # ifdef GLM_FORCE_LEFT_HANDED
  433. # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_ZO
  434. # else
  435. # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_ZO
  436. # endif
  437. #else
  438. # ifdef GLM_FORCE_LEFT_HANDED
  439. # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_NO
  440. # else
  441. # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_NO
  442. # endif
  443. #endif
  444. ///////////////////////////////////////////////////////////////////////////////////
  445. // Qualifiers
  446. #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
  447. # define GLM_DEPRECATED __declspec(deprecated)
  448. # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name
  449. #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL)
  450. # define GLM_DEPRECATED __attribute__((__deprecated__))
  451. # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment)))
  452. #elif GLM_COMPILER & GLM_COMPILER_CUDA
  453. # define GLM_DEPRECATED
  454. # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x)
  455. #else
  456. # define GLM_DEPRECATED
  457. # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name
  458. #endif
  459. ///////////////////////////////////////////////////////////////////////////////////
  460. #ifdef GLM_FORCE_EXPLICIT_CTOR
  461. # define GLM_EXPLICIT explicit
  462. #else
  463. # define GLM_EXPLICIT
  464. #endif
  465. ///////////////////////////////////////////////////////////////////////////////////
  466. // SYCL
  467. #if GLM_COMPILER==GLM_COMPILER_SYCL
  468. #include <CL/sycl.hpp>
  469. #include <limits>
  470. namespace glm {
  471. namespace std {
  472. // Import SYCL's functions into the namespace glm::std to force their usages.
  473. // It's important to use the math built-in function (sin, exp, ...)
  474. // of SYCL instead the std ones.
  475. using namespace cl::sycl;
  476. ///////////////////////////////////////////////////////////////////////////////
  477. // Import some "harmless" std's stuffs used by glm into
  478. // the new glm::std namespace.
  479. template<typename T>
  480. using numeric_limits = ::std::numeric_limits<T>;
  481. using ::std::size_t;
  482. using ::std::uint8_t;
  483. using ::std::uint16_t;
  484. using ::std::uint32_t;
  485. using ::std::uint64_t;
  486. using ::std::int8_t;
  487. using ::std::int16_t;
  488. using ::std::int32_t;
  489. using ::std::int64_t;
  490. using ::std::make_unsigned;
  491. ///////////////////////////////////////////////////////////////////////////////
  492. } //namespace std
  493. } //namespace glm
  494. #endif
  495. ///////////////////////////////////////////////////////////////////////////////////
  496. ///////////////////////////////////////////////////////////////////////////////////
  497. // Length type: all length functions returns a length_t type.
  498. // When GLM_FORCE_SIZE_T_LENGTH is defined, length_t is a typedef of size_t otherwise
  499. // length_t is a typedef of int like GLSL defines it.
  500. #define GLM_LENGTH_INT 1
  501. #define GLM_LENGTH_SIZE_T 2
  502. #ifdef GLM_FORCE_SIZE_T_LENGTH
  503. # define GLM_CONFIG_LENGTH_TYPE GLM_LENGTH_SIZE_T
  504. #else
  505. # define GLM_CONFIG_LENGTH_TYPE GLM_LENGTH_INT
  506. #endif
  507. namespace glm
  508. {
  509. using std::size_t;
  510. # if GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T
  511. typedef size_t length_t;
  512. # else
  513. typedef int length_t;
  514. # endif
  515. }//namespace glm
  516. ///////////////////////////////////////////////////////////////////////////////////
  517. // constexpr
  518. #if GLM_HAS_CONSTEXPR
  519. # define GLM_CONFIG_CONSTEXP GLM_ENABLE
  520. namespace glm
  521. {
  522. template<typename T, std::size_t N>
  523. constexpr std::size_t countof(T const (&)[N])
  524. {
  525. return N;
  526. }
  527. }//namespace glm
  528. # define GLM_COUNTOF(arr) glm::countof(arr)
  529. #elif defined(_MSC_VER)
  530. # define GLM_CONFIG_CONSTEXP GLM_DISABLE
  531. # define GLM_COUNTOF(arr) _countof(arr)
  532. #else
  533. # define GLM_CONFIG_CONSTEXP GLM_DISABLE
  534. # define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0])
  535. #endif
  536. ///////////////////////////////////////////////////////////////////////////////////
  537. // uint
  538. namespace glm{
  539. namespace detail
  540. {
  541. template<typename T>
  542. struct is_int
  543. {
  544. enum test {value = 0};
  545. };
  546. template<>
  547. struct is_int<unsigned int>
  548. {
  549. enum test {value = ~0};
  550. };
  551. template<>
  552. struct is_int<signed int>
  553. {
  554. enum test {value = ~0};
  555. };
  556. }//namespace detail
  557. typedef unsigned int uint;
  558. }//namespace glm
  559. ///////////////////////////////////////////////////////////////////////////////////
  560. // 64-bit int
  561. #if GLM_HAS_EXTENDED_INTEGER_TYPE
  562. # include <cstdint>
  563. #endif
  564. namespace glm{
  565. namespace detail
  566. {
  567. # if GLM_HAS_EXTENDED_INTEGER_TYPE
  568. typedef std::uint64_t uint64;
  569. typedef std::int64_t int64;
  570. # elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available
  571. typedef uint64_t uint64;
  572. typedef int64_t int64;
  573. # elif GLM_COMPILER & GLM_COMPILER_VC
  574. typedef unsigned __int64 uint64;
  575. typedef signed __int64 int64;
  576. # elif GLM_COMPILER & GLM_COMPILER_GCC
  577. # pragma GCC diagnostic ignored "-Wlong-long"
  578. __extension__ typedef unsigned long long uint64;
  579. __extension__ typedef signed long long int64;
  580. # elif (GLM_COMPILER & GLM_COMPILER_CLANG)
  581. # pragma clang diagnostic ignored "-Wc++11-long-long"
  582. typedef unsigned long long uint64;
  583. typedef signed long long int64;
  584. # else//unknown compiler
  585. typedef unsigned long long uint64;
  586. typedef signed long long int64;
  587. # endif
  588. }//namespace detail
  589. }//namespace glm
  590. ///////////////////////////////////////////////////////////////////////////////////
  591. // make_unsigned
  592. #if GLM_HAS_MAKE_SIGNED
  593. # include <type_traits>
  594. namespace glm{
  595. namespace detail
  596. {
  597. using std::make_unsigned;
  598. }//namespace detail
  599. }//namespace glm
  600. #else
  601. namespace glm{
  602. namespace detail
  603. {
  604. template<typename genType>
  605. struct make_unsigned
  606. {};
  607. template<>
  608. struct make_unsigned<char>
  609. {
  610. typedef unsigned char type;
  611. };
  612. template<>
  613. struct make_unsigned<signed char>
  614. {
  615. typedef unsigned char type;
  616. };
  617. template<>
  618. struct make_unsigned<short>
  619. {
  620. typedef unsigned short type;
  621. };
  622. template<>
  623. struct make_unsigned<int>
  624. {
  625. typedef unsigned int type;
  626. };
  627. template<>
  628. struct make_unsigned<long>
  629. {
  630. typedef unsigned long type;
  631. };
  632. template<>
  633. struct make_unsigned<int64>
  634. {
  635. typedef uint64 type;
  636. };
  637. template<>
  638. struct make_unsigned<unsigned char>
  639. {
  640. typedef unsigned char type;
  641. };
  642. template<>
  643. struct make_unsigned<unsigned short>
  644. {
  645. typedef unsigned short type;
  646. };
  647. template<>
  648. struct make_unsigned<unsigned int>
  649. {
  650. typedef unsigned int type;
  651. };
  652. template<>
  653. struct make_unsigned<unsigned long>
  654. {
  655. typedef unsigned long type;
  656. };
  657. template<>
  658. struct make_unsigned<uint64>
  659. {
  660. typedef uint64 type;
  661. };
  662. }//namespace detail
  663. }//namespace glm
  664. #endif
  665. ///////////////////////////////////////////////////////////////////////////////////
  666. // Only use x, y, z, w as vector type components
  667. #ifdef GLM_FORCE_XYZW_ONLY
  668. # define GLM_CONFIG_XYZW_ONLY GLM_ENABLE
  669. #else
  670. # define GLM_CONFIG_XYZW_ONLY GLM_DISABLE
  671. #endif
  672. ///////////////////////////////////////////////////////////////////////////////////
  673. // Configure the use of defaulted initialized types
  674. #define GLM_CTOR_INIT_DISABLE 0
  675. #define GLM_CTOR_INITIALIZER_LIST 1
  676. #define GLM_CTOR_INITIALISATION 2
  677. #if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS
  678. # define GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALIZER_LIST
  679. #elif defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS
  680. # define GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALISATION
  681. #else
  682. # define GLM_CONFIG_CTOR_INIT GLM_CTOR_INIT_DISABLE
  683. #endif
  684. ///////////////////////////////////////////////////////////////////////////////////
  685. // Use SIMD instruction sets
  686. #if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)
  687. # define GLM_CONFIG_SIMD GLM_ENABLE
  688. #else
  689. # define GLM_CONFIG_SIMD GLM_DISABLE
  690. #endif
  691. ///////////////////////////////////////////////////////////////////////////////////
  692. // Configure the use of defaulted function
  693. #if GLM_HAS_DEFAULTED_FUNCTIONS && GLM_CONFIG_CTOR_INIT == GLM_CTOR_INIT_DISABLE
  694. # define GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_ENABLE
  695. # define GLM_DEFAULT = default
  696. #else
  697. # define GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_DISABLE
  698. # define GLM_DEFAULT
  699. #endif
  700. ///////////////////////////////////////////////////////////////////////////////////
  701. // Configure the use of aligned gentypes
  702. #ifdef GLM_FORCE_ALIGNED // Legacy define
  703. # define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
  704. #endif
  705. #ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
  706. # define GLM_FORCE_ALIGNED_GENTYPES
  707. #endif
  708. #if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (defined(GLM_FORCE_ALIGNED_GENTYPES) || (GLM_CONFIG_SIMD == GLM_ENABLE))
  709. # define GLM_CONFIG_ALIGNED_GENTYPES GLM_ENABLE
  710. #else
  711. # define GLM_CONFIG_ALIGNED_GENTYPES GLM_DISABLE
  712. #endif
  713. ///////////////////////////////////////////////////////////////////////////////////
  714. // Configure the use of anonymous structure as implementation detail
  715. #if ((GLM_CONFIG_SIMD == GLM_ENABLE) || (GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR) || (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE))
  716. # define GLM_CONFIG_ANONYMOUS_STRUCT GLM_ENABLE
  717. #else
  718. # define GLM_CONFIG_ANONYMOUS_STRUCT GLM_DISABLE
  719. #endif
  720. ///////////////////////////////////////////////////////////////////////////////////
  721. // Silent warnings
  722. #ifdef GLM_FORCE_SILENT_WARNINGS
  723. # define GLM_SILENT_WARNINGS GLM_ENABLE
  724. #else
  725. # define GLM_SILENT_WARNINGS GLM_DISABLE
  726. #endif
  727. ///////////////////////////////////////////////////////////////////////////////////
  728. // Precision
  729. #define GLM_HIGHP 1
  730. #define GLM_MEDIUMP 2
  731. #define GLM_LOWP 3
  732. #if defined(GLM_FORCE_PRECISION_HIGHP_BOOL) || defined(GLM_PRECISION_HIGHP_BOOL)
  733. # define GLM_CONFIG_PRECISION_BOOL GLM_HIGHP
  734. #elif defined(GLM_FORCE_PRECISION_MEDIUMP_BOOL) || defined(GLM_PRECISION_MEDIUMP_BOOL)
  735. # define GLM_CONFIG_PRECISION_BOOL GLM_MEDIUMP
  736. #elif defined(GLM_FORCE_PRECISION_LOWP_BOOL) || defined(GLM_PRECISION_LOWP_BOOL)
  737. # define GLM_CONFIG_PRECISION_BOOL GLM_LOWP
  738. #else
  739. # define GLM_CONFIG_PRECISION_BOOL GLM_HIGHP
  740. #endif
  741. #if defined(GLM_FORCE_PRECISION_HIGHP_INT) || defined(GLM_PRECISION_HIGHP_INT)
  742. # define GLM_CONFIG_PRECISION_INT GLM_HIGHP
  743. #elif defined(GLM_FORCE_PRECISION_MEDIUMP_INT) || defined(GLM_PRECISION_MEDIUMP_INT)
  744. # define GLM_CONFIG_PRECISION_INT GLM_MEDIUMP
  745. #elif defined(GLM_FORCE_PRECISION_LOWP_INT) || defined(GLM_PRECISION_LOWP_INT)
  746. # define GLM_CONFIG_PRECISION_INT GLM_LOWP
  747. #else
  748. # define GLM_CONFIG_PRECISION_INT GLM_HIGHP
  749. #endif
  750. #if defined(GLM_FORCE_PRECISION_HIGHP_UINT) || defined(GLM_PRECISION_HIGHP_UINT)
  751. # define GLM_CONFIG_PRECISION_UINT GLM_HIGHP
  752. #elif defined(GLM_FORCE_PRECISION_MEDIUMP_UINT) || defined(GLM_PRECISION_MEDIUMP_UINT)
  753. # define GLM_CONFIG_PRECISION_UINT GLM_MEDIUMP
  754. #elif defined(GLM_FORCE_PRECISION_LOWP_UINT) || defined(GLM_PRECISION_LOWP_UINT)
  755. # define GLM_CONFIG_PRECISION_UINT GLM_LOWP
  756. #else
  757. # define GLM_CONFIG_PRECISION_UINT GLM_HIGHP
  758. #endif
  759. #if defined(GLM_FORCE_PRECISION_HIGHP_FLOAT) || defined(GLM_PRECISION_HIGHP_FLOAT)
  760. # define GLM_CONFIG_PRECISION_FLOAT GLM_HIGHP
  761. #elif defined(GLM_FORCE_PRECISION_MEDIUMP_FLOAT) || defined(GLM_PRECISION_MEDIUMP_FLOAT)
  762. # define GLM_CONFIG_PRECISION_FLOAT GLM_MEDIUMP
  763. #elif defined(GLM_FORCE_PRECISION_LOWP_FLOAT) || defined(GLM_PRECISION_LOWP_FLOAT)
  764. # define GLM_CONFIG_PRECISION_FLOAT GLM_LOWP
  765. #else
  766. # define GLM_CONFIG_PRECISION_FLOAT GLM_HIGHP
  767. #endif
  768. #if defined(GLM_FORCE_PRECISION_HIGHP_DOUBLE) || defined(GLM_PRECISION_HIGHP_DOUBLE)
  769. # define GLM_CONFIG_PRECISION_DOUBLE GLM_HIGHP
  770. #elif defined(GLM_FORCE_PRECISION_MEDIUMP_DOUBLE) || defined(GLM_PRECISION_MEDIUMP_DOUBLE)
  771. # define GLM_CONFIG_PRECISION_DOUBLE GLM_MEDIUMP
  772. #elif defined(GLM_FORCE_PRECISION_LOWP_DOUBLE) || defined(GLM_PRECISION_LOWP_DOUBLE)
  773. # define GLM_CONFIG_PRECISION_DOUBLE GLM_LOWP
  774. #else
  775. # define GLM_CONFIG_PRECISION_DOUBLE GLM_HIGHP
  776. #endif
  777. ///////////////////////////////////////////////////////////////////////////////////
  778. // Check inclusions of different versions of GLM
  779. #elif ((GLM_SETUP_INCLUDED != GLM_VERSION) && !defined(GLM_FORCE_IGNORE_VERSION))
  780. # error "GLM error: A different version of GLM is already included. Define GLM_FORCE_IGNORE_VERSION before including GLM headers to ignore this error."
  781. #elif GLM_SETUP_INCLUDED == GLM_VERSION
  782. ///////////////////////////////////////////////////////////////////////////////////
  783. // Messages
  784. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_DISPLAYED)
  785. # define GLM_MESSAGE_DISPLAYED
  786. # define GLM_STR_HELPER(x) #x
  787. # define GLM_STR(x) GLM_STR_HELPER(x)
  788. // Report GLM version
  789. # pragma message (GLM_STR(GLM_VERSION_MESSAGE))
  790. // Report C++ language
  791. # if (GLM_LANG & GLM_LANG_CXX2A_FLAG) && (GLM_LANG & GLM_LANG_EXT)
  792. # pragma message("GLM: C++ 2A with extensions")
  793. # elif (GLM_LANG & GLM_LANG_CXX2A_FLAG)
  794. # pragma message("GLM: C++ 2A")
  795. # elif (GLM_LANG & GLM_LANG_CXX17_FLAG) && (GLM_LANG & GLM_LANG_EXT)
  796. # pragma message("GLM: C++ 17 with extensions")
  797. # elif (GLM_LANG & GLM_LANG_CXX17_FLAG)
  798. # pragma message("GLM: C++ 17")
  799. # elif (GLM_LANG & GLM_LANG_CXX14_FLAG) && (GLM_LANG & GLM_LANG_EXT)
  800. # pragma message("GLM: C++ 14 with extensions")
  801. # elif (GLM_LANG & GLM_LANG_CXX14_FLAG)
  802. # pragma message("GLM: C++ 14")
  803. # elif (GLM_LANG & GLM_LANG_CXX11_FLAG) && (GLM_LANG & GLM_LANG_EXT)
  804. # pragma message("GLM: C++ 11 with extensions")
  805. # elif (GLM_LANG & GLM_LANG_CXX11_FLAG)
  806. # pragma message("GLM: C++ 11")
  807. # elif (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_LANG & GLM_LANG_EXT)
  808. # pragma message("GLM: C++ 0x with extensions")
  809. # elif (GLM_LANG & GLM_LANG_CXX0X_FLAG)
  810. # pragma message("GLM: C++ 0x")
  811. # elif (GLM_LANG & GLM_LANG_CXX03_FLAG) && (GLM_LANG & GLM_LANG_EXT)
  812. # pragma message("GLM: C++ 03 with extensions")
  813. # elif (GLM_LANG & GLM_LANG_CXX03_FLAG)
  814. # pragma message("GLM: C++ 03")
  815. # elif (GLM_LANG & GLM_LANG_CXX98_FLAG) && (GLM_LANG & GLM_LANG_EXT)
  816. # pragma message("GLM: C++ 98 with extensions")
  817. # elif (GLM_LANG & GLM_LANG_CXX98_FLAG)
  818. # pragma message("GLM: C++ 98")
  819. # else
  820. # pragma message("GLM: C++ language undetected")
  821. # endif//GLM_LANG
  822. // Report compiler detection
  823. # if GLM_COMPILER & GLM_COMPILER_CUDA
  824. # pragma message("GLM: CUDA compiler detected")
  825. # elif GLM_COMPILER & GLM_COMPILER_VC
  826. # pragma message("GLM: Visual C++ compiler detected")
  827. # elif GLM_COMPILER & GLM_COMPILER_CLANG
  828. # pragma message("GLM: Clang compiler detected")
  829. # elif GLM_COMPILER & GLM_COMPILER_INTEL
  830. # pragma message("GLM: Intel Compiler detected")
  831. # elif GLM_COMPILER & GLM_COMPILER_GCC
  832. # pragma message("GLM: GCC compiler detected")
  833. # else
  834. # pragma message("GLM: Compiler not detected")
  835. # endif
  836. // Report build target
  837. # if (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_64)
  838. # pragma message("GLM: x86 64 bits with AVX2 instruction set build target")
  839. # elif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_32)
  840. # pragma message("GLM: x86 32 bits with AVX2 instruction set build target")
  841. # elif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_64)
  842. # pragma message("GLM: x86 64 bits with AVX instruction set build target")
  843. # elif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_32)
  844. # pragma message("GLM: x86 32 bits with AVX instruction set build target")
  845. # elif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_64)
  846. # pragma message("GLM: x86 64 bits with SSE4.2 instruction set build target")
  847. # elif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_32)
  848. # pragma message("GLM: x86 32 bits with SSE4.2 instruction set build target")
  849. # elif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_64)
  850. # pragma message("GLM: x86 64 bits with SSE4.1 instruction set build target")
  851. # elif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_32)
  852. # pragma message("GLM: x86 32 bits with SSE4.1 instruction set build target")
  853. # elif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_64)
  854. # pragma message("GLM: x86 64 bits with SSSE3 instruction set build target")
  855. # elif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_32)
  856. # pragma message("GLM: x86 32 bits with SSSE3 instruction set build target")
  857. # elif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_64)
  858. # pragma message("GLM: x86 64 bits with SSE3 instruction set build target")
  859. # elif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_32)
  860. # pragma message("GLM: x86 32 bits with SSE3 instruction set build target")
  861. # elif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_64)
  862. # pragma message("GLM: x86 64 bits with SSE2 instruction set build target")
  863. # elif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_32)
  864. # pragma message("GLM: x86 32 bits with SSE2 instruction set build target")
  865. # elif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_64)
  866. # pragma message("GLM: x86 64 bits build target")
  867. # elif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_32)
  868. # pragma message("GLM: x86 32 bits build target")
  869. # elif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_64)
  870. # pragma message("GLM: ARM 64 bits with Neon instruction set build target")
  871. # elif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_32)
  872. # pragma message("GLM: ARM 32 bits with Neon instruction set build target")
  873. # elif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_64)
  874. # pragma message("GLM: ARM 64 bits build target")
  875. # elif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_32)
  876. # pragma message("GLM: ARM 32 bits build target")
  877. # elif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_64)
  878. # pragma message("GLM: MIPS 64 bits build target")
  879. # elif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_32)
  880. # pragma message("GLM: MIPS 32 bits build target")
  881. # elif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_64)
  882. # pragma message("GLM: PowerPC 64 bits build target")
  883. # elif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_32)
  884. # pragma message("GLM: PowerPC 32 bits build target")
  885. # else
  886. # pragma message("GLM: Unknown build target")
  887. # endif//GLM_ARCH
  888. // Report platform name
  889. # if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
  890. # pragma message("GLM: QNX platform detected")
  891. //# elif(GLM_PLATFORM & GLM_PLATFORM_IOS)
  892. //# pragma message("GLM: iOS platform detected")
  893. # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
  894. # pragma message("GLM: Apple platform detected")
  895. # elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
  896. # pragma message("GLM: WinCE platform detected")
  897. # elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
  898. # pragma message("GLM: Windows platform detected")
  899. # elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
  900. # pragma message("GLM: Native Client detected")
  901. # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
  902. # pragma message("GLM: Android platform detected")
  903. # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
  904. # pragma message("GLM: Linux platform detected")
  905. # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
  906. # pragma message("GLM: UNIX platform detected")
  907. # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
  908. # pragma message("GLM: platform unknown")
  909. # else
  910. # pragma message("GLM: platform not detected")
  911. # endif
  912. // Report whether only xyzw component are used
  913. # if defined GLM_FORCE_XYZW_ONLY
  914. # pragma message("GLM: GLM_FORCE_XYZW_ONLY is defined. Only x, y, z and w component are available in vector type. This define disables swizzle operators and SIMD instruction sets.")
  915. # endif
  916. // Report swizzle operator support
  917. # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
  918. # pragma message("GLM: GLM_FORCE_SWIZZLE is defined, swizzling operators enabled.")
  919. # elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
  920. # pragma message("GLM: GLM_FORCE_SWIZZLE is defined, swizzling functions enabled. Enable compiler C++ language extensions to enable swizzle operators.")
  921. # else
  922. # pragma message("GLM: GLM_FORCE_SWIZZLE is undefined. swizzling functions or operators are disabled.")
  923. # endif
  924. // Report .length() type
  925. # if GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T
  926. # pragma message("GLM: GLM_FORCE_SIZE_T_LENGTH is defined. .length() returns a glm::length_t, a typedef of std::size_t.")
  927. # else
  928. # pragma message("GLM: GLM_FORCE_SIZE_T_LENGTH is undefined. .length() returns a glm::length_t, a typedef of int following GLSL.")
  929. # endif
  930. # if GLM_CONFIG_UNRESTRICTED_GENTYPE == GLM_ENABLE
  931. # pragma message("GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is defined. Removes GLSL restrictions on valid function genTypes.")
  932. # else
  933. # pragma message("GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is undefined. Follows strictly GLSL on valid function genTypes.")
  934. # endif
  935. # if GLM_SILENT_WARNINGS == GLM_ENABLE
  936. # pragma message("GLM: GLM_FORCE_SILENT_WARNINGS is defined. Ignores C++ warnings from using C++ language extensions.")
  937. # else
  938. # pragma message("GLM: GLM_FORCE_SILENT_WARNINGS is undefined. Shows C++ warnings from using C++ language extensions.")
  939. # endif
  940. # ifdef GLM_FORCE_SINGLE_ONLY
  941. # pragma message("GLM: GLM_FORCE_SINGLE_ONLY is defined. Using only single precision floating-point types.")
  942. # endif
  943. # if defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE)
  944. # undef GLM_FORCE_ALIGNED_GENTYPES
  945. # pragma message("GLM: GLM_FORCE_ALIGNED_GENTYPES is defined, allowing aligned types. This prevents the use of C++ constexpr.")
  946. # elif defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE)
  947. # undef GLM_FORCE_ALIGNED_GENTYPES
  948. # pragma message("GLM: GLM_FORCE_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.")
  949. # endif
  950. # if defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES)
  951. # if GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE
  952. # undef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
  953. # pragma message("GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.")
  954. # elif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
  955. # pragma message("GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined. All gentypes (e.g. vec3) will be aligned and padded by default.")
  956. # endif
  957. # endif
  958. # if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
  959. # pragma message("GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is defined. Using zero to one depth clip space.")
  960. # else
  961. # pragma message("GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is undefined. Using negative one to one depth clip space.")
  962. # endif
  963. # if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
  964. # pragma message("GLM: GLM_FORCE_LEFT_HANDED is defined. Using left handed coordinate system.")
  965. # else
  966. # pragma message("GLM: GLM_FORCE_LEFT_HANDED is undefined. Using right handed coordinate system.")
  967. # endif
  968. #endif//GLM_MESSAGES
  969. #endif//GLM_SETUP_INCLUDED