0.9.9 API documenation
setup.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #if defined(GLM_FORCE_SWIZZLE) && defined(GLM_FORCE_UNRESTRICTED_GENTYPE)
7 # error "Both GLM_FORCE_SWIZZLE and GLM_FORCE_UNRESTRICTED_GENTYPE can't be defined at the same time"
8 #endif
9 
11 // Messages
12 
13 #define GLM_MESSAGES_ENABLED 1
14 #define GLM_MESSAGES_DISABLE 0
15 
16 #if defined(GLM_FORCE_MESSAGES)
17 # define GLM_MESSAGES GLM_MESSAGES_ENABLED
18 #else
19 # define GLM_MESSAGES GLM_MESSAGES_DISABLE
20 #endif
21 
22 #include <cassert>
23 #include <cstddef>
24 #include "../simd/platform.h"
25 
27 // Version
28 
29 #define GLM_VERSION 99
30 #define GLM_VERSION_MAJOR 0
31 #define GLM_VERSION_MINOR 9
32 #define GLM_VERSION_PATCH 9
33 #define GLM_VERSION_REVISION 0
34 
35 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_VERSION_DISPLAYED)
36 # define GLM_MESSAGE_VERSION_DISPLAYED
37 # pragma message ("GLM: version 0.9.9.0")
38 #endif//GLM_MESSAGES
39 
40 // Report compiler detection
41 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_COMPILER_DISPLAYED)
42 # define GLM_MESSAGE_COMPILER_DISPLAYED
43 # if GLM_COMPILER & GLM_COMPILER_CUDA
44 # pragma message("GLM: CUDA compiler detected")
45 # elif GLM_COMPILER & GLM_COMPILER_VC
46 # pragma message("GLM: Visual C++ compiler detected")
47 # elif GLM_COMPILER & GLM_COMPILER_CLANG
48 # pragma message("GLM: Clang compiler detected")
49 # elif GLM_COMPILER & GLM_COMPILER_INTEL
50 # pragma message("GLM: Intel Compiler detected")
51 # elif GLM_COMPILER & GLM_COMPILER_GCC
52 # pragma message("GLM: GCC compiler detected")
53 # else
54 # pragma message("GLM: Compiler not detected")
55 # endif
56 #endif//GLM_MESSAGES
57 
59 // Build model
60 
61 #if defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__)
62 # define GLM_MODEL GLM_MODEL_64
63 #elif defined(__i386__) || defined(__ppc__)
64 # define GLM_MODEL GLM_MODEL_32
65 #else
66 # define GLM_MODEL GLM_MODEL_32
67 #endif//
68 
69 #if !defined(GLM_MODEL) && GLM_COMPILER != 0
70 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
71 #endif//GLM_MODEL
72 
73 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_MODEL_DISPLAYED)
74 # define GLM_MESSAGE_MODEL_DISPLAYED
75 # if(GLM_MODEL == GLM_MODEL_64)
76 # pragma message("GLM: 64 bits model")
77 # elif(GLM_MODEL == GLM_MODEL_32)
78 # pragma message("GLM: 32 bits model")
79 # endif//GLM_MODEL
80 #endif//GLM_MESSAGES
81 
82 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
83 # define GLM_MESSAGE_ARCH_DISPLAYED
84 # if(GLM_ARCH == GLM_ARCH_PURE)
85 # pragma message("GLM: Platform independent code")
86 # elif(GLM_ARCH == GLM_ARCH_AVX2)
87 # pragma message("GLM: AVX2 instruction set")
88 # elif(GLM_ARCH == GLM_ARCH_AVX)
89 # pragma message("GLM: AVX instruction set")
90 # elif(GLM_ARCH == GLM_ARCH_SSE42)
91 # pragma message("GLM: SSE4.2 instruction set")
92 # elif(GLM_ARCH == GLM_ARCH_SSE41)
93 # pragma message("GLM: SSE4.1 instruction set")
94 # elif(GLM_ARCH == GLM_ARCH_SSSE3)
95 # pragma message("GLM: SSSE3 instruction set")
96 # elif(GLM_ARCH == GLM_ARCH_SSE3)
97 # pragma message("GLM: SSE3 instruction set")
98 # elif(GLM_ARCH == GLM_ARCH_SSE2)
99 # pragma message("GLM: SSE2 instruction set")
100 # elif(GLM_ARCH == GLM_ARCH_X86)
101 # pragma message("GLM: x86 instruction set")
102 # elif(GLM_ARCH == GLM_ARCH_NEON)
103 # pragma message("GLM: NEON instruction set")
104 # elif(GLM_ARCH == GLM_ARCH_ARM)
105 # pragma message("GLM: ARM instruction set")
106 # elif(GLM_ARCH == GLM_ARCH_MIPS)
107 # pragma message("GLM: MIPS instruction set")
108 # elif(GLM_ARCH == GLM_ARCH_PPC)
109 # pragma message("GLM: PowerPC architechture")
110 # endif//GLM_ARCH
111 #endif//GLM_MESSAGES
112 
114 // C++ Version
115 
116 // User defines: GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_FORCE_CXX11, GLM_FORCE_CXX14
117 
118 #define GLM_LANG_CXX98_FLAG (1 << 1)
119 #define GLM_LANG_CXX03_FLAG (1 << 2)
120 #define GLM_LANG_CXX0X_FLAG (1 << 3)
121 #define GLM_LANG_CXX11_FLAG (1 << 4)
122 #define GLM_LANG_CXX1Y_FLAG (1 << 5)
123 #define GLM_LANG_CXX14_FLAG (1 << 6)
124 #define GLM_LANG_CXX1Z_FLAG (1 << 7)
125 #define GLM_LANG_CXXMS_FLAG (1 << 8)
126 #define GLM_LANG_CXXGNU_FLAG (1 << 9)
127 
128 #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG
129 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
130 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
131 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
132 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
133 #define GLM_LANG_CXX14 (GLM_LANG_CXX1Y | GLM_LANG_CXX14_FLAG)
134 #define GLM_LANG_CXX1Z (GLM_LANG_CXX14 | GLM_LANG_CXX1Z_FLAG)
135 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
136 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
137 
138 #if defined(GLM_FORCE_CXX14)
139 # if((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER <= GLM_COMPILER_GCC50)) || ((GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER <= GLM_COMPILER_CLANG34))
140 # pragma message("GLM: Using GLM_FORCE_CXX14 with a compiler that doesn't fully support C++14")
141 # elif GLM_COMPILER & GLM_COMPILER_VC
142 # pragma message("GLM: Using GLM_FORCE_CXX14 but there is no known version of Visual C++ compiler that fully supports C++14")
143 # elif GLM_COMPILER & GLM_COMPILER_INTEL
144 # pragma message("GLM: Using GLM_FORCE_CXX14 but there is no known version of ICC compiler that fully supports C++14")
145 # endif
146 # define GLM_LANG GLM_LANG_CXX14
147 # define GLM_LANG_STL11_FORCED
148 #elif defined(GLM_FORCE_CXX11)
149 # if((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER <= GLM_COMPILER_GCC48)) || ((GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER <= GLM_COMPILER_CLANG33))
150 # pragma message("GLM: Using GLM_FORCE_CXX11 with a compiler that doesn't fully support C++11")
151 # elif GLM_COMPILER & GLM_COMPILER_VC
152 # pragma message("GLM: Using GLM_FORCE_CXX11 but there is no known version of Visual C++ compiler that fully supports C++11")
153 # elif GLM_COMPILER & GLM_COMPILER_INTEL
154 # pragma message("GLM: Using GLM_FORCE_CXX11 but there is no known version of ICC compiler that fully supports C++11")
155 # endif
156 # define GLM_LANG GLM_LANG_CXX11
157 # define GLM_LANG_STL11_FORCED
158 #elif defined(GLM_FORCE_CXX03)
159 # define GLM_LANG GLM_LANG_CXX03
160 #elif defined(GLM_FORCE_CXX98)
161 # define GLM_LANG GLM_LANG_CXX98
162 #else
163 # if GLM_COMPILER & GLM_COMPILER_CLANG
164 # if __cplusplus >= 201402L // GLM_COMPILER_CLANG34 + -std=c++14
165 # define GLM_LANG GLM_LANG_CXX14
166 # elif __has_feature(cxx_decltype_auto) && __has_feature(cxx_aggregate_nsdmi) // GLM_COMPILER_CLANG33 + -std=c++1y
167 # define GLM_LANG GLM_LANG_CXX1Y
168 # elif __cplusplus >= 201103L // GLM_COMPILER_CLANG33 + -std=c++11
169 # define GLM_LANG GLM_LANG_CXX11
170 # elif __has_feature(cxx_static_assert) // GLM_COMPILER_CLANG29 + -std=c++11
171 # define GLM_LANG GLM_LANG_CXX0X
172 # elif __cplusplus >= 199711L
173 # define GLM_LANG GLM_LANG_CXX98
174 # else
175 # define GLM_LANG GLM_LANG_CXX
176 # endif
177 # elif GLM_COMPILER & GLM_COMPILER_GCC
178 # if __cplusplus >= 201402L
179 # define GLM_LANG GLM_LANG_CXX14
180 # elif __cplusplus >= 201103L
181 # define GLM_LANG GLM_LANG_CXX11
182 # elif defined(__GXX_EXPERIMENTAL_CXX0X__)
183 # define GLM_LANG GLM_LANG_CXX0X
184 # else
185 # define GLM_LANG GLM_LANG_CXX98
186 # endif
187 # elif GLM_COMPILER & GLM_COMPILER_VC
188 # ifdef _MSC_EXTENSIONS
189 # if __cplusplus >= 201402L
190 # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG)
191 //# elif GLM_COMPILER >= GLM_COMPILER_VC14
192 //# define GLM_LANG (GLM_LANG_CXX1Y | GLM_LANG_CXXMS_FLAG)
193 # elif __cplusplus >= 201103L
194 # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG)
195 # elif GLM_COMPILER >= GLM_COMPILER_VC10
196 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
197 # elif __cplusplus >= 199711L
198 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
199 # else
200 # define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG)
201 # endif
202 # else
203 # if __cplusplus >= 201402L
204 # define GLM_LANG GLM_LANG_CXX14
205 # elif __cplusplus >= 201103L
206 # define GLM_LANG GLM_LANG_CXX11
207 # elif GLM_COMPILER >= GLM_COMPILER_VC10
208 # define GLM_LANG GLM_LANG_CXX0X
209 # elif __cplusplus >= 199711L
210 # define GLM_LANG GLM_LANG_CXX98
211 # else
212 # define GLM_LANG GLM_LANG_CXX
213 # endif
214 # endif
215 # elif GLM_COMPILER & GLM_COMPILER_INTEL
216 # ifdef _MSC_EXTENSIONS
217 # define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG
218 # else
219 # define GLM_MSC_EXT 0
220 # endif
221 # if __cplusplus >= 201402L
222 # define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT)
223 # elif __cplusplus >= 201103L
224 # define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT)
225 # elif __INTEL_CXX11_MODE__
226 # define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT)
227 # elif __cplusplus >= 199711L
228 # define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT)
229 # else
230 # define GLM_LANG (GLM_LANG_CXX | GLM_MSC_EXT)
231 # endif
232 # elif GLM_COMPILER & GLM_COMPILER_CUDA
233 # ifdef _MSC_EXTENSIONS
234 # define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG
235 # else
236 # define GLM_MSC_EXT 0
237 # endif
238 # if GLM_COMPILER >= GLM_COMPILER_CUDA75
239 # define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT)
240 # else
241 # define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT)
242 # endif
243 # else // Unknown compiler
244 # if __cplusplus >= 201402L
245 # define GLM_LANG GLM_LANG_CXX14
246 # elif __cplusplus >= 201103L
247 # define GLM_LANG GLM_LANG_CXX11
248 # elif __cplusplus >= 199711L
249 # define GLM_LANG GLM_LANG_CXX98
250 # else
251 # define GLM_LANG GLM_LANG_CXX // Good luck with that!
252 # endif
253 # ifndef GLM_FORCE_PURE
254 # define GLM_FORCE_PURE
255 # endif
256 # endif
257 #endif
258 
259 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_LANG_DISPLAYED)
260 # define GLM_MESSAGE_LANG_DISPLAYED
261 
262 # if GLM_LANG & GLM_LANG_CXX1Z_FLAG
263 # pragma message("GLM: C++1z")
264 # elif GLM_LANG & GLM_LANG_CXX14_FLAG
265 # pragma message("GLM: C++14")
266 # elif GLM_LANG & GLM_LANG_CXX1Y_FLAG
267 # pragma message("GLM: C++1y")
268 # elif GLM_LANG & GLM_LANG_CXX11_FLAG
269 # pragma message("GLM: C++11")
270 # elif GLM_LANG & GLM_LANG_CXX0X_FLAG
271 # pragma message("GLM: C++0x")
272 # elif GLM_LANG & GLM_LANG_CXX03_FLAG
273 # pragma message("GLM: C++03")
274 # elif GLM_LANG & GLM_LANG_CXX98_FLAG
275 # pragma message("GLM: C++98")
276 # else
277 # pragma message("GLM: C++ language undetected")
278 # endif//GLM_LANG
279 
280 # if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
281 # pragma message("GLM: Language extensions enabled")
282 # endif//GLM_LANG
283 #endif//GLM_MESSAGES
284 
286 // Has of C++ features
287 
288 // http://clang.llvm.org/cxx_status.html
289 // http://gcc.gnu.org/projects/cxx0x.html
290 // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
291 
292 // Android has multiple STLs but C++11 STL detection doesn't always work #284 #564
293 #if GLM_PLATFORM == GLM_PLATFORM_ANDROID && !defined(GLM_LANG_STL11_FORCED)
294 # define GLM_HAS_CXX11_STL 0
295 #elif GLM_COMPILER & GLM_COMPILER_CLANG
296 # if defined(_LIBCPP_VERSION) && GLM_LANG & GLM_LANG_CXX11_FLAG
297 # define GLM_HAS_CXX11_STL 1
298 # else
299 # define GLM_HAS_CXX11_STL 0
300 # endif
301 #else
302 # define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
303  ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \
304  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
305  ((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15))))
306 #endif
307 
308 // N1720
309 #if GLM_COMPILER & GLM_COMPILER_CLANG
310 # define GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert)
311 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
312 # define GLM_HAS_STATIC_ASSERT 1
313 #else
314 # define GLM_HAS_STATIC_ASSERT ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
315  ((GLM_COMPILER & GLM_COMPILER_GCC)) || \
316  ((GLM_COMPILER & GLM_COMPILER_CUDA)) || \
317  ((GLM_COMPILER & GLM_COMPILER_VC))))
318 #endif
319 
320 // N1988
321 #if GLM_LANG & GLM_LANG_CXX11_FLAG
322 # define GLM_HAS_EXTENDED_INTEGER_TYPE 1
323 #else
324 # define GLM_HAS_EXTENDED_INTEGER_TYPE (\
325  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \
326  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \
327  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC)) || \
328  ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG)))
329 #endif
330 
331 // N2235
332 #if GLM_COMPILER & GLM_COMPILER_CLANG
333 # define GLM_HAS_CONSTEXPR __has_feature(cxx_constexpr)
334 # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR
335 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
336 # define GLM_HAS_CONSTEXPR 1
337 # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR
338 #else
339 # define GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
340  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \
341  ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)))) // GCC 4.6 support constexpr but there is a compiler bug causing a crash
342 # define GLM_HAS_CONSTEXPR_PARTIAL (GLM_HAS_CONSTEXPR || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)))
343 #endif
344 
345 // N2672
346 #if GLM_COMPILER & GLM_COMPILER_CLANG
347 # define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers)
348 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
349 # define GLM_HAS_INITIALIZER_LISTS 1
350 #else
351 # define GLM_HAS_INITIALIZER_LISTS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
352  ((GLM_COMPILER & GLM_COMPILER_GCC)) || \
353  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
354  ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75))))
355 #endif
356 
357 // N2544 Unrestricted unions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf
358 #if GLM_COMPILER & GLM_COMPILER_CLANG
359 # define GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)
360 #elif GLM_LANG & (GLM_LANG_CXX11_FLAG | GLM_LANG_CXXMS_FLAG)
361 # define GLM_HAS_UNRESTRICTED_UNIONS 1
362 #else
363 # define GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
364  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_LANG & GLM_LANG_CXXMS_FLAG)) || \
365  ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75)) || \
366  ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)))
367 #endif
368 
369 // N2346
370 #if defined(GLM_FORCE_UNRESTRICTED_GENTYPE)
371 # define GLM_HAS_DEFAULTED_FUNCTIONS 0
372 #elif GLM_COMPILER & GLM_COMPILER_CLANG
373 # define GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions)
374 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
375 # define GLM_HAS_DEFAULTED_FUNCTIONS 1
376 #else
377 # define GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
378  ((GLM_COMPILER & GLM_COMPILER_GCC)) || \
379  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
380  ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12)) || \
381  (GLM_COMPILER & GLM_COMPILER_CUDA)))
382 #endif
383 
384 // N2118
385 #if GLM_COMPILER & GLM_COMPILER_CLANG
386 # define GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
387 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
388 # define GLM_HAS_RVALUE_REFERENCES 1
389 #else
390 # define GLM_HAS_RVALUE_REFERENCES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
391  ((GLM_COMPILER & GLM_COMPILER_GCC)) || \
392  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \
393  ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
394 #endif
395 
396 // N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
397 #if GLM_COMPILER & GLM_COMPILER_CLANG
398 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions)
399 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
400 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1
401 #else
402 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
403  ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \
404  ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
405  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
406  ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
407 #endif
408 
409 // N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
410 #if GLM_COMPILER & GLM_COMPILER_CLANG
411 # define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates)
412 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
413 # define GLM_HAS_TEMPLATE_ALIASES 1
414 #else
415 # define GLM_HAS_TEMPLATE_ALIASES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
416  ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12_1)) || \
417  ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC47)) || \
418  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
419  ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
420 #endif
421 
422 // N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
423 #if GLM_COMPILER & GLM_COMPILER_CLANG
424 # define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for)
425 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
426 # define GLM_HAS_RANGE_FOR 1
427 #else
428 # define GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
429  ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
430  ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL13)) || \
431  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \
432  ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
433 #endif
434 
435 // N2341 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf
436 #if GLM_COMPILER & GLM_COMPILER_CLANG
437 # define GLM_HAS_ALIGNOF __has_feature(c_alignof)
438 #elif GLM_LANG & GLM_LANG_CXX11_FLAG
439 # define GLM_HAS_ALIGNOF 1
440 #else
441 # define GLM_HAS_ALIGNOF ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
442  ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \
443  ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)) || \
444  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)) || \
445  ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA70))))
446 #endif
447 
448 //
449 #if GLM_LANG & GLM_LANG_CXX11_FLAG
450 # define GLM_HAS_ASSIGNABLE 1
451 #else
452 # define GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
453  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \
454  ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))))
455 #endif
456 
457 //
458 #define GLM_HAS_TRIVIAL_QUERIES 0
459 
460 //
461 #if GLM_LANG & GLM_LANG_CXX11_FLAG
462 # define GLM_HAS_MAKE_SIGNED 1
463 #else
464 # define GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
465  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
466  ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50))))
467 #endif
468 
469 #if GLM_ARCH == GLM_ARCH_PURE
470 # define GLM_HAS_BITSCAN_WINDOWS 0
471 #else
472 # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
473  ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \
474  ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT))))
475 #endif
476 
477 // OpenMP
478 #ifdef _OPENMP
479 # if GLM_COMPILER & GLM_COMPILER_GCC
480 # if GLM_COMPILER >= GLM_COMPILER_GCC61
481 # define GLM_HAS_OPENMP 45
482 # elif GLM_COMPILER >= GLM_COMPILER_GCC49
483 # define GLM_HAS_OPENMP 40
484 # elif GLM_COMPILER >= GLM_COMPILER_GCC47
485 # define GLM_HAS_OPENMP 31
486 # elif GLM_COMPILER >= GLM_COMPILER_GCC44
487 # define GLM_HAS_OPENMP 30
488 # elif GLM_COMPILER >= GLM_COMPILER_GCC42
489 # define GLM_HAS_OPENMP 25
490 # else
491 # define GLM_HAS_OPENMP 0
492 # endif
493 # elif GLM_COMPILER & GLM_COMPILER_CLANG
494 # if GLM_COMPILER >= GLM_COMPILER_CLANG38
495 # define GLM_HAS_OPENMP 31
496 # else
497 # define GLM_HAS_OPENMP 0
498 # endif
499 # elif GLM_COMPILER & GLM_COMPILER_VC
500 # if GLM_COMPILER >= GLM_COMPILER_VC10
501 # define GLM_HAS_OPENMP 20
502 # else
503 # define GLM_HAS_OPENMP 0
504 # endif
505 # elif GLM_COMPILER & GLM_COMPILER_INTEL
506 # if GLM_COMPILER >= GLM_COMPILER_INTEL16
507 # define GLM_HAS_OPENMP 40
508 # elif GLM_COMPILER >= GLM_COMPILER_INTEL12
509 # define GLM_HAS_OPENMP 31
510 # else
511 # define GLM_HAS_OPENMP 0
512 # endif
513 # else
514 # define GLM_HAS_OPENMP 0
515 # endif// GLM_COMPILER & GLM_COMPILER_VC
516 #endif
517 
519 // Static assert
520 
521 #if GLM_HAS_STATIC_ASSERT
522 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
523 #elif defined(BOOST_STATIC_ASSERT)
524 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
525 #elif GLM_COMPILER & GLM_COMPILER_VC
526 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
527 #else
528 # define GLM_STATIC_ASSERT(x, message)
529 # define GLM_STATIC_ASSERT_NULL
530 #endif//GLM_LANG
531 
533 // Qualifiers
534 
535 #if GLM_COMPILER & GLM_COMPILER_CUDA
536 # define GLM_CUDA_FUNC_DEF __device__ __host__
537 # define GLM_CUDA_FUNC_DECL __device__ __host__
538 #else
539 # define GLM_CUDA_FUNC_DEF
540 # define GLM_CUDA_FUNC_DECL
541 #endif
542 
543 #if GLM_COMPILER & GLM_COMPILER_GCC
544 # define GLM_VAR_USED __attribute__ ((unused))
545 #else
546 # define GLM_VAR_USED
547 #endif
548 
549 #if defined(GLM_FORCE_INLINE)
550 # if GLM_COMPILER & GLM_COMPILER_VC
551 # define GLM_INLINE __forceinline
552 # define GLM_NEVER_INLINE __declspec((noinline))
553 # elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)
554 # define GLM_INLINE inline __attribute__((__always_inline__))
555 # define GLM_NEVER_INLINE __attribute__((__noinline__))
556 # elif GLM_COMPILER & GLM_COMPILER_CUDA
557 # define GLM_INLINE __forceinline__
558 # define GLM_NEVER_INLINE __noinline__
559 # else
560 # define GLM_INLINE inline
561 # define GLM_NEVER_INLINE
562 # endif//GLM_COMPILER
563 #else
564 # define GLM_INLINE inline
565 # define GLM_NEVER_INLINE
566 #endif//defined(GLM_FORCE_INLINE)
567 
568 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
569 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
570 
572 // Swizzle operators
573 
574 // User defines: GLM_FORCE_SWIZZLE
575 
576 #define GLM_SWIZZLE_ENABLED 1
577 #define GLM_SWIZZLE_DISABLE 0
578 
579 #if defined(GLM_FORCE_SWIZZLE)
580 # define GLM_SWIZZLE GLM_SWIZZLE_ENABLED
581 #else
582 # define GLM_SWIZZLE GLM_SWIZZLE_DISABLE
583 #endif
584 
585 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)
586 # define GLM_MESSAGE_SWIZZLE_DISPLAYED
587 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
588 # pragma message("GLM: Swizzling operators enabled")
589 # else
590 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
591 # endif
592 #endif//GLM_MESSAGES
593 
595 // Allows using not basic types as genType
596 
597 // #define GLM_FORCE_UNRESTRICTED_GENTYPE
598 
599 #ifdef GLM_FORCE_UNRESTRICTED_GENTYPE
600 # define GLM_UNRESTRICTED_GENTYPE 1
601 #else
602 # define GLM_UNRESTRICTED_GENTYPE 0
603 #endif
604 
605 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_UNRESTRICTED_GENTYPE_DISPLAYED)
606 # define GLM_MESSAGE_UNRESTRICTED_GENTYPE_DISPLAYED
607 # ifdef GLM_FORCE_UNRESTRICTED_GENTYPE
608 # pragma message("GLM: Use unrestricted genType")
609 # endif
610 #endif//GLM_MESSAGES
611 
613 // Clip control
614 
615 #define GLM_DEPTH_ZERO_TO_ONE 0x00000001
616 #define GLM_DEPTH_NEGATIVE_ONE_TO_ONE 0x00000002
617 
618 #ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE
619 # define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_ZERO_TO_ONE
620 #else
621 # define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_NEGATIVE_ONE_TO_ONE
622 #endif
623 
624 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_DEPTH_DISPLAYED)
625 # define GLM_MESSAGE_DEPTH_DISPLAYED
626 # if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
627 # pragma message("GLM: Depth clip space: Zero to one")
628 # else
629 # pragma message("GLM: Depth clip space: negative one to one")
630 # endif
631 #endif//GLM_MESSAGES
632 
634 // Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM
635 // to use left handed coordinate system by default.
636 
637 #define GLM_LEFT_HANDED 0x00000001 // For DirectX, Metal, Vulkan
638 #define GLM_RIGHT_HANDED 0x00000002 // For OpenGL, default in GLM
639 
640 #ifdef GLM_FORCE_LEFT_HANDED
641 # define GLM_COORDINATE_SYSTEM GLM_LEFT_HANDED
642 #else
643 # define GLM_COORDINATE_SYSTEM GLM_RIGHT_HANDED
644 #endif
645 
646 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_HANDED_DISPLAYED)
647 # define GLM_MESSAGE_HANDED_DISPLAYED
648 # if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
649 # pragma message("GLM: Coordinate system: left handed")
650 # else
651 # pragma message("GLM: Coordinate system: right handed")
652 # endif
653 #endif//GLM_MESSAGES
654 
656 // Qualifiers
657 
658 #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
659 # define GLM_DEPRECATED __declspec(deprecated)
660 # define GLM_ALIGN(x) __declspec(align(x))
661 # define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x))
662 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name
663 # define GLM_RESTRICT_FUNC __declspec(restrict)
664 # define GLM_RESTRICT __restrict
665 # if GLM_COMPILER >= GLM_COMPILER_VC12
666 # define GLM_VECTOR_CALL __vectorcall
667 # else
668 # define GLM_VECTOR_CALL
669 # endif
670 #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL)
671 # define GLM_DEPRECATED __attribute__((__deprecated__))
672 # define GLM_ALIGN(x) __attribute__((aligned(x)))
673 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
674 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment)))
675 # define GLM_RESTRICT_FUNC __restrict__
676 # define GLM_RESTRICT __restrict__
677 # if GLM_COMPILER & GLM_COMPILER_CLANG
678 # if GLM_COMPILER >= GLM_COMPILER_CLANG37
679 # define GLM_VECTOR_CALL __vectorcall
680 # else
681 # define GLM_VECTOR_CALL
682 # endif
683 # else
684 # define GLM_VECTOR_CALL
685 # endif
686 #elif GLM_COMPILER & GLM_COMPILER_CUDA
687 # define GLM_DEPRECATED
688 # define GLM_ALIGN(x) __align__(x)
689 # define GLM_ALIGNED_STRUCT(x) struct __align__(x)
690 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x)
691 # define GLM_RESTRICT_FUNC __restrict__
692 # define GLM_RESTRICT __restrict__
693 # define GLM_VECTOR_CALL
694 #else
695 # define GLM_DEPRECATED
696 # define GLM_ALIGN
697 # define GLM_ALIGNED_STRUCT(x) struct
698 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name
699 # define GLM_RESTRICT_FUNC
700 # define GLM_RESTRICT
701 # define GLM_VECTOR_CALL
702 #endif//GLM_COMPILER
703 
704 #if GLM_HAS_DEFAULTED_FUNCTIONS
705 # define GLM_DEFAULT = default
706 # ifdef GLM_FORCE_NO_CTOR_INIT
707 # define GLM_DEFAULT_CTOR = default
708 # else
709 # define GLM_DEFAULT_CTOR
710 # endif
711 #else
712 # define GLM_DEFAULT
713 # define GLM_DEFAULT_CTOR
714 #endif
715 
716 #if GLM_HAS_CONSTEXPR
717 # define GLM_CONSTEXPR constexpr
718 # define GLM_CONSTEXPR_CTOR constexpr
719 # define GLM_RELAXED_CONSTEXPR constexpr
720 #elif GLM_HAS_CONSTEXPR_PARTIAL
721 # define GLM_CONSTEXPR constexpr
722 # define GLM_CONSTEXPR_CTOR
723 # define GLM_RELAXED_CONSTEXPR const
724 #else
725 # define GLM_CONSTEXPR
726 # define GLM_CONSTEXPR_CTOR
727 # define GLM_RELAXED_CONSTEXPR const
728 #endif
729 
730 #if GLM_ARCH == GLM_ARCH_PURE
731 # define GLM_CONSTEXPR_SIMD GLM_CONSTEXPR_CTOR
732 #else
733 # define GLM_CONSTEXPR_SIMD
734 #endif
735 
736 #ifdef GLM_FORCE_EXPLICIT_CTOR
737 # define GLM_EXPLICIT explicit
738 #else
739 # define GLM_EXPLICIT
740 #endif
741 
743 
744 #define GLM_HAS_ALIGNED_TYPE GLM_HAS_UNRESTRICTED_UNIONS
745 
747 // Length type
748 
749 // User defines: GLM_FORCE_SIZE_T_LENGTH GLM_FORCE_SIZE_FUNC
750 
751 namespace glm
752 {
753  using std::size_t;
754 # if defined(GLM_FORCE_SIZE_T_LENGTH)
755  typedef size_t length_t;
756 # else
757  typedef int length_t;
758 # endif
759 }//namespace glm
760 
761 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH)
762 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
763 # if defined GLM_FORCE_SIZE_T_LENGTH
764 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
765 # else
766 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
767 # endif
768 #endif//GLM_MESSAGES
769 
771 // countof
772 
773 #ifndef __has_feature
774 # define __has_feature(x) 0 // Compatibility with non-clang compilers.
775 #endif
776 
777 #if GLM_HAS_CONSTEXPR_PARTIAL
778  namespace glm
779  {
780  template <typename T, std::size_t N>
781  constexpr std::size_t countof(T const (&)[N])
782  {
783  return N;
784  }
785  }//namespace glm
786 # define GLM_COUNTOF(arr) glm::countof(arr)
787 #elif defined(_MSC_VER)
788 # define GLM_COUNTOF(arr) _countof(arr)
789 #else
790 # define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0])
791 #endif
792 
794 // Uninitialize constructors
795 
796 namespace glm
797 {
798  enum ctor{uninitialize};
799 }//namespace glm
Definition: _noise.hpp:11