| 1 | #ifndef GLM_SETUP_INCLUDED |
| 2 | |
| 3 | #include <cassert> |
| 4 | #include <cstddef> |
| 5 | #include <type_traits> |
| 6 | |
| 7 | #define GLM_VERSION_MAJOR 1 |
| 8 | #define GLM_VERSION_MINOR 1 |
| 9 | #define GLM_VERSION_PATCH 0 |
| 10 | #define GLM_VERSION_REVISION 0 |
| 11 | #define GLM_VERSION 1000 |
| 12 | |
| 13 | #define GLM_MAKE_API_VERSION(variant, major, minor, patch) \ |
| 14 | ((((uint32_t)(variant)) << 29U) | (((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch))) |
| 15 | |
| 16 | #define GLM_VERSION_COMPLETE GLM_MAKE_API_VERSION(0, GLM_VERSION_MAJOR, GLM_VERSION_MINOR, GLM_VERSION_PATCH) |
| 17 | |
| 18 | #define GLM_SETUP_INCLUDED GLM_VERSION |
| 19 | |
| 20 | #define GLM_GET_VERSION_VARIANT(version) ((uint32_t)(version) >> 29U) |
| 21 | #define GLM_GET_VERSION_MAJOR(version) (((uint32_t)(version) >> 22U) & 0x7FU) |
| 22 | #define GLM_GET_VERSION_MINOR(version) (((uint32_t)(version) >> 12U) & 0x3FFU) |
| 23 | #define GLM_GET_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | #define GLM_DISABLE 0 |
| 29 | #define GLM_ENABLE 1 |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | #if defined(GLM_FORCE_MESSAGES) |
| 35 | # define GLM_MESSAGES GLM_ENABLE |
| 36 | #else |
| 37 | # define GLM_MESSAGES GLM_DISABLE |
| 38 | #endif |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | #include "../simd/platform.h" |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | #if defined(_M_ARM64) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__) |
| 49 | # define GLM_MODEL GLM_MODEL_64 |
| 50 | #elif defined(__i386__) || defined(__ppc__) || defined(__ILP32__) || defined(_M_ARM) |
| 51 | # define GLM_MODEL GLM_MODEL_32 |
| 52 | #else |
| 53 | # define GLM_MODEL GLM_MODEL_32 |
| 54 | #endif |
| 55 | |
| 56 | #if !defined(GLM_MODEL) && GLM_COMPILER != 0 |
| 57 | # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message." |
| 58 | #endif |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | #define GLM_LANG_CXX98_FLAG (1 << 1) |
| 66 | #define GLM_LANG_CXX03_FLAG (1 << 2) |
| 67 | #define GLM_LANG_CXX0X_FLAG (1 << 3) |
| 68 | #define GLM_LANG_CXX11_FLAG (1 << 4) |
| 69 | #define GLM_LANG_CXX14_FLAG (1 << 5) |
| 70 | #define GLM_LANG_CXX17_FLAG (1 << 6) |
| 71 | #define GLM_LANG_CXX20_FLAG (1 << 7) |
| 72 | #define GLM_LANG_CXX23_FLAG (1 << 8) |
| 73 | #define GLM_LANG_CXXMS_FLAG (1 << 9) |
| 74 | #define GLM_LANG_CXXGNU_FLAG (1 << 10) |
| 75 | |
| 76 | #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG |
| 77 | #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG) |
| 78 | #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG) |
| 79 | #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG) |
| 80 | #define GLM_LANG_CXX14 (GLM_LANG_CXX11 | GLM_LANG_CXX14_FLAG) |
| 81 | #define GLM_LANG_CXX17 (GLM_LANG_CXX14 | GLM_LANG_CXX17_FLAG) |
| 82 | #define GLM_LANG_CXX20 (GLM_LANG_CXX17 | GLM_LANG_CXX20_FLAG) |
| 83 | #define GLM_LANG_CXX23 (GLM_LANG_CXX20 | GLM_LANG_CXX23_FLAG) |
| 84 | #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG |
| 85 | #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG |
| 86 | |
| 87 | #if (defined(_MSC_EXTENSIONS)) |
| 88 | # define GLM_LANG_EXT GLM_LANG_CXXMS_FLAG |
| 89 | #elif ((GLM_COMPILER & (GLM_COMPILER_CLANG | GLM_COMPILER_GCC)) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)) |
| 90 | # define GLM_LANG_EXT GLM_LANG_CXXMS_FLAG |
| 91 | #else |
| 92 | # define GLM_LANG_EXT 0 |
| 93 | #endif |
| 94 | |
| 95 | #if (defined(GLM_FORCE_CXX_UNKNOWN)) |
| 96 | # define GLM_LANG 0 |
| 97 | #elif defined(GLM_FORCE_CXX20) |
| 98 | # define GLM_LANG (GLM_LANG_CXX20 | GLM_LANG_EXT) |
| 99 | #elif defined(GLM_FORCE_CXX17) |
| 100 | # define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT) |
| 101 | #else |
| 102 | # if GLM_COMPILER & GLM_COMPILER_VC && defined(_MSVC_LANG) |
| 103 | # if GLM_COMPILER >= GLM_COMPILER_VC15_7 |
| 104 | # define GLM_LANG_PLATFORM _MSVC_LANG |
| 105 | # elif GLM_COMPILER >= GLM_COMPILER_VC15 |
| 106 | # if _MSVC_LANG > 201402L |
| 107 | # define GLM_LANG_PLATFORM 201402L |
| 108 | # else |
| 109 | # define GLM_LANG_PLATFORM _MSVC_LANG |
| 110 | # endif |
| 111 | # else |
| 112 | # define GLM_LANG_PLATFORM 0 |
| 113 | # endif |
| 114 | # else |
| 115 | # define GLM_LANG_PLATFORM 0 |
| 116 | # endif |
| 117 | |
| 118 | # if __cplusplus > 202302L || GLM_LANG_PLATFORM > 202302L |
| 119 | # define GLM_LANG (GLM_LANG_CXX23 | GLM_LANG_EXT) |
| 120 | # elif __cplusplus == 202302L || GLM_LANG_PLATFORM == 202302L |
| 121 | # define GLM_LANG (GLM_LANG_CXX23 | GLM_LANG_EXT) |
| 122 | # elif __cplusplus == 202002L || GLM_LANG_PLATFORM == 202002L |
| 123 | # define GLM_LANG (GLM_LANG_CXX20 | GLM_LANG_EXT) |
| 124 | # elif __cplusplus == 201703L || GLM_LANG_PLATFORM == 201703L |
| 125 | # define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT) |
| 126 | # else |
| 127 | # define GLM_LANG (0 | GLM_LANG_EXT) |
| 128 | # endif |
| 129 | #endif |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) |
| 137 | # define GLM_HAS_CONSTEXPR 0 |
| 138 | #else |
| 139 | # define GLM_HAS_CONSTEXPR 1 |
| 140 | #endif |
| 141 | |
| 142 | #if GLM_HAS_CONSTEXPR |
| 143 | # define GLM_CONSTEXPR constexpr |
| 144 | #else |
| 145 | # define GLM_CONSTEXPR |
| 146 | #endif |
| 147 | |
| 148 | |
| 149 | #if defined(GLM_FORCE_INTRINSICS) |
| 150 | # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\ |
| 151 | ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \ |
| 152 | ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT)))) |
| 153 | #else |
| 154 | # define GLM_HAS_BITSCAN_WINDOWS 0 |
| 155 | #endif |
| 156 | |
| 157 | |
| 158 | |
| 159 | #ifdef _OPENMP |
| 160 | # if GLM_COMPILER & GLM_COMPILER_GCC |
| 161 | # if GLM_COMPILER >= GLM_COMPILER_GCC61 |
| 162 | # define GLM_HAS_OPENMP 45 |
| 163 | # elif GLM_COMPILER >= GLM_COMPILER_GCC49 |
| 164 | # define GLM_HAS_OPENMP 40 |
| 165 | # elif GLM_COMPILER >= GLM_COMPILER_GCC47 |
| 166 | # define GLM_HAS_OPENMP 31 |
| 167 | # else |
| 168 | # define GLM_HAS_OPENMP 0 |
| 169 | # endif |
| 170 | # elif GLM_COMPILER & GLM_COMPILER_CLANG |
| 171 | # if GLM_COMPILER >= GLM_COMPILER_CLANG38 |
| 172 | # define GLM_HAS_OPENMP 31 |
| 173 | # else |
| 174 | # define GLM_HAS_OPENMP 0 |
| 175 | # endif |
| 176 | # elif GLM_COMPILER & GLM_COMPILER_VC |
| 177 | # define GLM_HAS_OPENMP 20 |
| 178 | # elif GLM_COMPILER & GLM_COMPILER_INTEL |
| 179 | # if GLM_COMPILER >= GLM_COMPILER_INTEL16 |
| 180 | # define GLM_HAS_OPENMP 40 |
| 181 | # else |
| 182 | # define GLM_HAS_OPENMP 0 |
| 183 | # endif |
| 184 | # else |
| 185 | # define GLM_HAS_OPENMP 0 |
| 186 | # endif |
| 187 | #else |
| 188 | # define GLM_HAS_OPENMP 0 |
| 189 | #endif |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | #if (GLM_COMPILER & GLM_COMPILER_CUDA) || (GLM_COMPILER & GLM_COMPILER_HIP) |
| 197 | # if defined(GLM_CUDA_FORCE_DEVICE_FUNC) && defined(GLM_CUDA_FORCE_HOST_FUNC) |
| 198 | # error "GLM error: GLM_CUDA_FORCE_DEVICE_FUNC and GLM_CUDA_FORCE_HOST_FUNC should not be defined at the same time, GLM by default generates both device and host code for CUDA compiler." |
| 199 | # endif |
| 200 | |
| 201 | # if defined(GLM_CUDA_FORCE_DEVICE_FUNC) |
| 202 | # define GLM_CUDA_FUNC_DEF __device__ |
| 203 | # define GLM_CUDA_FUNC_DECL __device__ |
| 204 | # elif defined(GLM_CUDA_FORCE_HOST_FUNC) |
| 205 | # define GLM_CUDA_FUNC_DEF __host__ |
| 206 | # define GLM_CUDA_FUNC_DECL __host__ |
| 207 | # else |
| 208 | # define GLM_CUDA_FUNC_DEF __device__ __host__ |
| 209 | # define GLM_CUDA_FUNC_DECL __device__ __host__ |
| 210 | # endif |
| 211 | #else |
| 212 | # define GLM_CUDA_FUNC_DEF |
| 213 | # define GLM_CUDA_FUNC_DECL |
| 214 | #endif |
| 215 | |
| 216 | #if defined(GLM_FORCE_INLINE) |
| 217 | # if GLM_COMPILER & GLM_COMPILER_VC |
| 218 | # define GLM_INLINE __forceinline |
| 219 | # define GLM_NEVER_INLINE __declspec(noinline) |
| 220 | # elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG) |
| 221 | # define GLM_INLINE inline __attribute__((__always_inline__)) |
| 222 | # define GLM_NEVER_INLINE __attribute__((__noinline__)) |
| 223 | # elif (GLM_COMPILER & GLM_COMPILER_CUDA) || (GLM_COMPILER & GLM_COMPILER_HIP) |
| 224 | # define GLM_INLINE __forceinline__ |
| 225 | # define GLM_NEVER_INLINE __noinline__ |
| 226 | # else |
| 227 | # define GLM_INLINE inline |
| 228 | # define GLM_NEVER_INLINE |
| 229 | # endif |
| 230 | #else |
| 231 | # define GLM_INLINE inline |
| 232 | # define GLM_NEVER_INLINE |
| 233 | #endif |
| 234 | |
| 235 | #define GLM_CTOR_DECL GLM_CUDA_FUNC_DECL GLM_CONSTEXPR |
| 236 | #define GLM_FUNC_DISCARD_DECL GLM_CUDA_FUNC_DECL |
| 237 | #define GLM_FUNC_DECL [[nodiscard]] GLM_CUDA_FUNC_DECL |
| 238 | #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE |
| 239 | |
| 240 | |
| 241 | |
| 242 | #if !defined(GLM_FORCE_CTOR_INIT) |
| 243 | # define GLM_DEFAULTED_DEFAULT_CTOR_DECL |
| 244 | # define GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_INLINE |
| 245 | #else |
| 246 | # define GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_FUNC_DISCARD_DECL |
| 247 | # define GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_FUNC_QUALIFIER |
| 248 | #endif |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | #define GLM_SWIZZLE_DISABLED 0 |
| 256 | #define GLM_SWIZZLE_OPERATOR 1 |
| 257 | #define GLM_SWIZZLE_FUNCTION 2 |
| 258 | |
| 259 | #if defined(GLM_SWIZZLE) |
| 260 | # pragma message("GLM: GLM_SWIZZLE is deprecated, use GLM_FORCE_SWIZZLE instead.") |
| 261 | # define GLM_FORCE_SWIZZLE |
| 262 | #endif |
| 263 | |
| 264 | #if defined(GLM_FORCE_SWIZZLE) && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && !defined(GLM_FORCE_XYZW_ONLY) |
| 265 | # define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_OPERATOR |
| 266 | #elif defined(GLM_FORCE_SWIZZLE) |
| 267 | # define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_FUNCTION |
| 268 | #else |
| 269 | # define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_DISABLED |
| 270 | #endif |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | #ifdef GLM_FORCE_UNRESTRICTED_GENTYPE |
| 278 | # define GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_ENABLE |
| 279 | #else |
| 280 | # define GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_DISABLE |
| 281 | #endif |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | #ifdef GLM_FORCE_UNRESTRICTED_FLOAT |
| 289 | # define GLM_CONFIG_UNRESTRICTED_FLOAT GLM_ENABLE |
| 290 | #else |
| 291 | # define GLM_CONFIG_UNRESTRICTED_FLOAT GLM_DISABLE |
| 292 | #endif |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | #define GLM_CLIP_CONTROL_ZO_BIT (1 << 0) |
| 301 | #define GLM_CLIP_CONTROL_NO_BIT (1 << 1) |
| 302 | #define GLM_CLIP_CONTROL_LH_BIT (1 << 2) |
| 303 | #define GLM_CLIP_CONTROL_RH_BIT (1 << 3) |
| 304 | |
| 305 | #define GLM_CLIP_CONTROL_LH_ZO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_ZO_BIT) |
| 306 | #define GLM_CLIP_CONTROL_LH_NO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_NO_BIT) |
| 307 | #define GLM_CLIP_CONTROL_RH_ZO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_ZO_BIT) |
| 308 | #define GLM_CLIP_CONTROL_RH_NO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_NO_BIT) |
| 309 | |
| 310 | #ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE |
| 311 | # ifdef GLM_FORCE_LEFT_HANDED |
| 312 | # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_ZO |
| 313 | # else |
| 314 | # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_ZO |
| 315 | # endif |
| 316 | #else |
| 317 | # ifdef GLM_FORCE_LEFT_HANDED |
| 318 | # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_NO |
| 319 | # else |
| 320 | # define GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_NO |
| 321 | # endif |
| 322 | #endif |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)) |
| 328 | # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name |
| 329 | #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL) |
| 330 | # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment))) |
| 331 | #elif (GLM_COMPILER & GLM_COMPILER_CUDA) || (GLM_COMPILER & GLM_COMPILER_HIP) |
| 332 | # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x) |
| 333 | #else |
| 334 | # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name |
| 335 | #endif |
| 336 | |
| 337 | |
| 338 | |
| 339 | #ifdef GLM_FORCE_EXPLICIT_CTOR |
| 340 | # define GLM_EXPLICIT explicit |
| 341 | #else |
| 342 | # define GLM_EXPLICIT |
| 343 | #endif |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | #define GLM_LENGTH_INT 1 |
| 351 | #define GLM_LENGTH_SIZE_T 2 |
| 352 | |
| 353 | #ifdef GLM_FORCE_SIZE_T_LENGTH |
| 354 | # define GLM_CONFIG_LENGTH_TYPE GLM_LENGTH_SIZE_T |
| 355 | # define GLM_ASSERT_LENGTH(l, max) (assert ((l) < (max))) |
| 356 | #else |
| 357 | # define GLM_CONFIG_LENGTH_TYPE GLM_LENGTH_INT |
| 358 | # define GLM_ASSERT_LENGTH(l, max) (assert ((l) >= 0 && (l) < (max))) |
| 359 | #endif |
| 360 | |
| 361 | namespace glm |
| 362 | { |
| 363 | using std::size_t; |
| 364 | # if GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T |
| 365 | typedef size_t length_t; |
| 366 | # else |
| 367 | typedef int length_t; |
| 368 | # endif |
| 369 | } |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | #include <cstdint> |
| 375 | |
| 376 | namespace glm{ |
| 377 | namespace detail |
| 378 | { |
| 379 | typedef std::int8_t int8; |
| 380 | typedef std::int16_t int16; |
| 381 | typedef std::int32_t int32; |
| 382 | typedef std::int64_t int64; |
| 383 | |
| 384 | typedef std::uint8_t uint8; |
| 385 | typedef std::uint16_t uint16; |
| 386 | typedef std::uint32_t uint32; |
| 387 | typedef std::uint64_t uint64; |
| 388 | |
| 389 | template<typename T> |
| 390 | struct is_int |
| 391 | { |
| 392 | enum test {value = 0}; |
| 393 | }; |
| 394 | |
| 395 | template<> |
| 396 | struct is_int<int8> |
| 397 | { |
| 398 | enum test {value = ~0}; |
| 399 | }; |
| 400 | |
| 401 | template<> |
| 402 | struct is_int<int16> |
| 403 | { |
| 404 | enum test {value = ~0}; |
| 405 | }; |
| 406 | |
| 407 | template<> |
| 408 | struct is_int<int32> |
| 409 | { |
| 410 | enum test {value = ~0}; |
| 411 | }; |
| 412 | |
| 413 | template<> |
| 414 | struct is_int<int64> |
| 415 | { |
| 416 | enum test {value = ~0}; |
| 417 | }; |
| 418 | |
| 419 | template<> |
| 420 | struct is_int<uint8> |
| 421 | { |
| 422 | enum test {value = ~0}; |
| 423 | }; |
| 424 | |
| 425 | template<> |
| 426 | struct is_int<uint16> |
| 427 | { |
| 428 | enum test {value = ~0}; |
| 429 | }; |
| 430 | |
| 431 | template<> |
| 432 | struct is_int<uint32> |
| 433 | { |
| 434 | enum test {value = ~0}; |
| 435 | }; |
| 436 | |
| 437 | template<> |
| 438 | struct is_int<uint64> |
| 439 | { |
| 440 | enum test {value = ~0}; |
| 441 | }; |
| 442 | } |
| 443 | |
| 444 | typedef unsigned int uint; |
| 445 | } |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 450 | #ifdef GLM_FORCE_XYZW_ONLY |
| 451 | # define GLM_CONFIG_XYZW_ONLY GLM_ENABLE |
| 452 | #else |
| 453 | # define GLM_CONFIG_XYZW_ONLY GLM_DISABLE |
| 454 | #endif |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | #if (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT) |
| 460 | # define GLM_CONFIG_SIMD GLM_ENABLE |
| 461 | #else |
| 462 | # define GLM_CONFIG_SIMD GLM_DISABLE |
| 463 | #endif |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | #if defined(GLM_FORCE_CTOR_INIT) |
| 469 | # define GLM_CONFIG_CTOR_INIT GLM_ENABLE |
| 470 | #else |
| 471 | # define GLM_CONFIG_CTOR_INIT GLM_DISABLE |
| 472 | #endif |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | #define GLM_DEFAULT = default |
| 478 | |
| 479 | #if GLM_CONFIG_CTOR_INIT == GLM_DISABLE |
| 480 | # define GLM_DEFAULT_CTOR GLM_DEFAULT |
| 481 | #else |
| 482 | # define GLM_DEFAULT_CTOR |
| 483 | #endif |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | #ifdef GLM_FORCE_ALIGNED |
| 489 | # define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES |
| 490 | #endif |
| 491 | |
| 492 | #ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES |
| 493 | # define GLM_FORCE_ALIGNED_GENTYPES |
| 494 | #endif |
| 495 | |
| 496 | #if (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (defined(GLM_FORCE_ALIGNED_GENTYPES) || (GLM_CONFIG_SIMD == GLM_ENABLE)) |
| 497 | # define GLM_CONFIG_ALIGNED_GENTYPES GLM_ENABLE |
| 498 | #else |
| 499 | # define GLM_CONFIG_ALIGNED_GENTYPES GLM_DISABLE |
| 500 | #endif |
| 501 | |
| 502 | |
| 503 | |
| 504 | |
| 505 | #if ((GLM_CONFIG_SIMD == GLM_ENABLE) || (GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR) || (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE)) |
| 506 | # define GLM_CONFIG_ANONYMOUS_STRUCT GLM_ENABLE |
| 507 | #else |
| 508 | # define GLM_CONFIG_ANONYMOUS_STRUCT GLM_DISABLE |
| 509 | #endif |
| 510 | |
| 511 | |
| 512 | |
| 513 | |
| 514 | #ifdef GLM_FORCE_WARNINGS |
| 515 | # define GLM_SILENT_WARNINGS GLM_DISABLE |
| 516 | #else |
| 517 | # define GLM_SILENT_WARNINGS GLM_ENABLE |
| 518 | #endif |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | #define GLM_HIGHP 1 |
| 524 | #define GLM_MEDIUMP 2 |
| 525 | #define GLM_LOWP 3 |
| 526 | |
| 527 | #if defined(GLM_FORCE_PRECISION_HIGHP_BOOL) || defined(GLM_PRECISION_HIGHP_BOOL) |
| 528 | # define GLM_CONFIG_PRECISION_BOOL GLM_HIGHP |
| 529 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_BOOL) || defined(GLM_PRECISION_MEDIUMP_BOOL) |
| 530 | # define GLM_CONFIG_PRECISION_BOOL GLM_MEDIUMP |
| 531 | #elif defined(GLM_FORCE_PRECISION_LOWP_BOOL) || defined(GLM_PRECISION_LOWP_BOOL) |
| 532 | # define GLM_CONFIG_PRECISION_BOOL GLM_LOWP |
| 533 | #else |
| 534 | # define GLM_CONFIG_PRECISION_BOOL GLM_HIGHP |
| 535 | #endif |
| 536 | |
| 537 | #if defined(GLM_FORCE_PRECISION_HIGHP_INT) || defined(GLM_PRECISION_HIGHP_INT) |
| 538 | # define GLM_CONFIG_PRECISION_INT GLM_HIGHP |
| 539 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_INT) || defined(GLM_PRECISION_MEDIUMP_INT) |
| 540 | # define GLM_CONFIG_PRECISION_INT GLM_MEDIUMP |
| 541 | #elif defined(GLM_FORCE_PRECISION_LOWP_INT) || defined(GLM_PRECISION_LOWP_INT) |
| 542 | # define GLM_CONFIG_PRECISION_INT GLM_LOWP |
| 543 | #else |
| 544 | # define GLM_CONFIG_PRECISION_INT GLM_HIGHP |
| 545 | #endif |
| 546 | |
| 547 | #if defined(GLM_FORCE_PRECISION_HIGHP_UINT) || defined(GLM_PRECISION_HIGHP_UINT) |
| 548 | # define GLM_CONFIG_PRECISION_UINT GLM_HIGHP |
| 549 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_UINT) || defined(GLM_PRECISION_MEDIUMP_UINT) |
| 550 | # define GLM_CONFIG_PRECISION_UINT GLM_MEDIUMP |
| 551 | #elif defined(GLM_FORCE_PRECISION_LOWP_UINT) || defined(GLM_PRECISION_LOWP_UINT) |
| 552 | # define GLM_CONFIG_PRECISION_UINT GLM_LOWP |
| 553 | #else |
| 554 | # define GLM_CONFIG_PRECISION_UINT GLM_HIGHP |
| 555 | #endif |
| 556 | |
| 557 | #if defined(GLM_FORCE_PRECISION_HIGHP_FLOAT) || defined(GLM_PRECISION_HIGHP_FLOAT) |
| 558 | # define GLM_CONFIG_PRECISION_FLOAT GLM_HIGHP |
| 559 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_FLOAT) || defined(GLM_PRECISION_MEDIUMP_FLOAT) |
| 560 | # define GLM_CONFIG_PRECISION_FLOAT GLM_MEDIUMP |
| 561 | #elif defined(GLM_FORCE_PRECISION_LOWP_FLOAT) || defined(GLM_PRECISION_LOWP_FLOAT) |
| 562 | # define GLM_CONFIG_PRECISION_FLOAT GLM_LOWP |
| 563 | #else |
| 564 | # define GLM_CONFIG_PRECISION_FLOAT GLM_HIGHP |
| 565 | #endif |
| 566 | |
| 567 | #if defined(GLM_FORCE_PRECISION_HIGHP_DOUBLE) || defined(GLM_PRECISION_HIGHP_DOUBLE) |
| 568 | # define GLM_CONFIG_PRECISION_DOUBLE GLM_HIGHP |
| 569 | #elif defined(GLM_FORCE_PRECISION_MEDIUMP_DOUBLE) || defined(GLM_PRECISION_MEDIUMP_DOUBLE) |
| 570 | # define GLM_CONFIG_PRECISION_DOUBLE GLM_MEDIUMP |
| 571 | #elif defined(GLM_FORCE_PRECISION_LOWP_DOUBLE) || defined(GLM_PRECISION_LOWP_DOUBLE) |
| 572 | # define GLM_CONFIG_PRECISION_DOUBLE GLM_LOWP |
| 573 | #else |
| 574 | # define GLM_CONFIG_PRECISION_DOUBLE GLM_HIGHP |
| 575 | #endif |
| 576 | |
| 577 | |
| 578 | |
| 579 | |
| 580 | #elif ((GLM_SETUP_INCLUDED != GLM_VERSION) && !defined(GLM_FORCE_IGNORE_VERSION)) |
| 581 | # error "GLM error: A different version of GLM is already included. Define GLM_FORCE_IGNORE_VERSION before including GLM headers to ignore this error." |
| 582 | #elif GLM_SETUP_INCLUDED == GLM_VERSION |
| 583 | |
| 584 | |
| 585 | |
| 586 | |
| 587 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_DISPLAYED) |
| 588 | # define GLM_MESSAGE_DISPLAYED |
| 589 | # define GLM_STR_HELPER(x) #x |
| 590 | # define GLM_STR(x) GLM_STR_HELPER(x) |
| 591 | |
| 592 | |
| 593 | # pragma message ("GLM: version " GLM_STR(GLM_VERSION_MAJOR) "." GLM_STR(GLM_VERSION_MINOR) "." GLM_STR(GLM_VERSION_PATCH)) |
| 594 | |
| 595 | |
| 596 | # if (GLM_LANG & GLM_LANG_CXX23_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
| 597 | # pragma message("GLM: C++ 23 with extensions") |
| 598 | # elif (GLM_LANG & GLM_LANG_CXX23_FLAG) |
| 599 | # pragma message("GLM: C++ 23") |
| 600 | # elif (GLM_LANG & GLM_LANG_CXX20_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
| 601 | # pragma message("GLM: C++ 20 with extensions") |
| 602 | # elif (GLM_LANG & GLM_LANG_CXX20_FLAG) |
| 603 | # pragma message("GLM: C++ 20") |
| 604 | # elif (GLM_LANG & GLM_LANG_CXX17_FLAG) && (GLM_LANG & GLM_LANG_EXT) |
| 605 | # pragma message("GLM: C++ 17 with extensions") |
| 606 | # elif (GLM_LANG & GLM_LANG_CXX17_FLAG) |
| 607 | # pragma message("GLM: C++ 17") |
| 608 | # else |
| 609 | # pragma message("GLM: C++ language undetected") |
| 610 | # endif |
| 611 | |
| 612 | |
| 613 | # if GLM_COMPILER & GLM_COMPILER_CUDA |
| 614 | # pragma message("GLM: CUDA compiler detected") |
| 615 | # elif GLM_COMPILER & GLM_COMPILER_HIP |
| 616 | # pragma message("GLM: HIP compiler detected") |
| 617 | # elif GLM_COMPILER & GLM_COMPILER_VC |
| 618 | # pragma message("GLM: Visual C++ compiler detected") |
| 619 | # elif GLM_COMPILER & GLM_COMPILER_CLANG |
| 620 | # pragma message("GLM: Clang compiler detected") |
| 621 | # elif GLM_COMPILER & GLM_COMPILER_INTEL |
| 622 | # pragma message("GLM: Intel Compiler detected") |
| 623 | # elif GLM_COMPILER & GLM_COMPILER_GCC |
| 624 | # pragma message("GLM: GCC compiler detected") |
| 625 | # else |
| 626 | # pragma message("GLM: Compiler not detected") |
| 627 | # endif |
| 628 | |
| 629 | |
| 630 | # if (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 631 | # pragma message("GLM: x86 64 bits with AVX2 instruction set build target") |
| 632 | # elif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 633 | # pragma message("GLM: x86 32 bits with AVX2 instruction set build target") |
| 634 | |
| 635 | # elif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 636 | # pragma message("GLM: x86 64 bits with AVX instruction set build target") |
| 637 | # elif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 638 | # pragma message("GLM: x86 32 bits with AVX instruction set build target") |
| 639 | |
| 640 | # elif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 641 | # pragma message("GLM: x86 64 bits with SSE4.2 instruction set build target") |
| 642 | # elif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 643 | # pragma message("GLM: x86 32 bits with SSE4.2 instruction set build target") |
| 644 | |
| 645 | # elif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 646 | # pragma message("GLM: x86 64 bits with SSE4.1 instruction set build target") |
| 647 | # elif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 648 | # pragma message("GLM: x86 32 bits with SSE4.1 instruction set build target") |
| 649 | |
| 650 | # elif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 651 | # pragma message("GLM: x86 64 bits with SSSE3 instruction set build target") |
| 652 | # elif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 653 | # pragma message("GLM: x86 32 bits with SSSE3 instruction set build target") |
| 654 | |
| 655 | # elif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 656 | # pragma message("GLM: x86 64 bits with SSE3 instruction set build target") |
| 657 | # elif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 658 | # pragma message("GLM: x86 32 bits with SSE3 instruction set build target") |
| 659 | |
| 660 | # elif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 661 | # pragma message("GLM: x86 64 bits with SSE2 instruction set build target") |
| 662 | # elif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 663 | # pragma message("GLM: x86 32 bits with SSE2 instruction set build target") |
| 664 | |
| 665 | # elif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 666 | # pragma message("GLM: x86 64 bits build target") |
| 667 | # elif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 668 | # pragma message("GLM: x86 32 bits build target") |
| 669 | |
| 670 | # elif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 671 | # pragma message("GLM: ARM 64 bits with Neon instruction set build target") |
| 672 | # elif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 673 | # pragma message("GLM: ARM 32 bits with Neon instruction set build target") |
| 674 | |
| 675 | # elif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 676 | # pragma message("GLM: ARM 64 bits build target") |
| 677 | # elif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 678 | # pragma message("GLM: ARM 32 bits build target") |
| 679 | |
| 680 | # elif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 681 | # pragma message("GLM: MIPS 64 bits build target") |
| 682 | # elif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 683 | # pragma message("GLM: MIPS 32 bits build target") |
| 684 | |
| 685 | # elif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_64) |
| 686 | # pragma message("GLM: PowerPC 64 bits build target") |
| 687 | # elif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_32) |
| 688 | # pragma message("GLM: PowerPC 32 bits build target") |
| 689 | # else |
| 690 | # pragma message("GLM: Unknown build target") |
| 691 | # endif |
| 692 | |
| 693 | |
| 694 | # if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO) |
| 695 | # pragma message("GLM: QNX platform detected") |
| 696 | |
| 697 | |
| 698 | # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE) |
| 699 | # pragma message("GLM: Apple platform detected") |
| 700 | # elif(GLM_PLATFORM & GLM_PLATFORM_WINCE) |
| 701 | # pragma message("GLM: WinCE platform detected") |
| 702 | # elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) |
| 703 | # pragma message("GLM: Windows platform detected") |
| 704 | # elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL) |
| 705 | # pragma message("GLM: Native Client detected") |
| 706 | # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) |
| 707 | # pragma message("GLM: Android platform detected") |
| 708 | # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX) |
| 709 | # pragma message("GLM: Linux platform detected") |
| 710 | # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX) |
| 711 | # pragma message("GLM: UNIX platform detected") |
| 712 | # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN) |
| 713 | # pragma message("GLM: platform unknown") |
| 714 | # else |
| 715 | # pragma message("GLM: platform not detected") |
| 716 | # endif |
| 717 | |
| 718 | |
| 719 | # if defined GLM_FORCE_XYZW_ONLY |
| 720 | # 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.") |
| 721 | # endif |
| 722 | |
| 723 | |
| 724 | # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR |
| 725 | # pragma message("GLM: GLM_FORCE_SWIZZLE is defined, swizzling operators enabled.") |
| 726 | # elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION |
| 727 | # pragma message("GLM: GLM_FORCE_SWIZZLE is defined, swizzling functions enabled. Enable compiler C++ language extensions to enable swizzle operators.") |
| 728 | # else |
| 729 | # pragma message("GLM: GLM_FORCE_SWIZZLE is undefined. swizzling functions or operators are disabled.") |
| 730 | # endif |
| 731 | |
| 732 | |
| 733 | # if GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T |
| 734 | # pragma message("GLM: GLM_FORCE_SIZE_T_LENGTH is defined. .length() returns a glm::length_t, a typedef of std::size_t.") |
| 735 | # else |
| 736 | # pragma message("GLM: GLM_FORCE_SIZE_T_LENGTH is undefined. .length() returns a glm::length_t, a typedef of int following GLSL.") |
| 737 | # endif |
| 738 | |
| 739 | # if GLM_CONFIG_UNRESTRICTED_GENTYPE == GLM_ENABLE |
| 740 | # pragma message("GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is defined. Removes GLSL restrictions on valid function genTypes.") |
| 741 | # else |
| 742 | # pragma message("GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is undefined. Follows strictly GLSL on valid function genTypes.") |
| 743 | # endif |
| 744 | |
| 745 | # if GLM_SILENT_WARNINGS == GLM_ENABLE |
| 746 | # pragma message("GLM: GLM_FORCE_SILENT_WARNINGS is defined. Ignores C++ warnings from using C++ language extensions.") |
| 747 | # else |
| 748 | # pragma message("GLM: GLM_FORCE_SILENT_WARNINGS is undefined. Shows C++ warnings from using C++ language extensions.") |
| 749 | # endif |
| 750 | |
| 751 | # ifdef GLM_FORCE_SINGLE_ONLY |
| 752 | # pragma message("GLM: GLM_FORCE_SINGLE_ONLY is defined. Using only single precision floating-point types.") |
| 753 | # endif |
| 754 | |
| 755 | # if defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE) |
| 756 | # undef GLM_FORCE_ALIGNED_GENTYPES |
| 757 | # pragma message("GLM: GLM_FORCE_ALIGNED_GENTYPES is defined, allowing aligned types. This prevents the use of C++ constexpr.") |
| 758 | # elif defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE) |
| 759 | # undef GLM_FORCE_ALIGNED_GENTYPES |
| 760 | # pragma message("GLM: GLM_FORCE_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.") |
| 761 | # endif |
| 762 | |
| 763 | # if defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES) |
| 764 | # if GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE |
| 765 | # undef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES |
| 766 | # pragma message("GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.") |
| 767 | # elif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE |
| 768 | # pragma message("GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined. All gentypes (e.g. vec3) will be aligned and padded by default.") |
| 769 | # endif |
| 770 | # endif |
| 771 | |
| 772 | # if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT |
| 773 | # pragma message("GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is defined. Using zero to one depth clip space.") |
| 774 | # else |
| 775 | # pragma message("GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is undefined. Using negative one to one depth clip space.") |
| 776 | # endif |
| 777 | |
| 778 | # if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT |
| 779 | # pragma message("GLM: GLM_FORCE_LEFT_HANDED is defined. Using left handed coordinate system.") |
| 780 | # else |
| 781 | # pragma message("GLM: GLM_FORCE_LEFT_HANDED is undefined. Using right handed coordinate system.") |
| 782 | # endif |
| 783 | #endif |
| 784 | |
| 785 | #endif |