diff --git a/glm/detail/type_quat.hpp b/glm/detail/type_quat.hpp index 4d082fd7..4e7e618a 100644 --- a/glm/detail/type_quat.hpp +++ b/glm/detail/type_quat.hpp @@ -42,12 +42,20 @@ namespace glm # if GLM_LANG & GLM_LANG_CXXMS_FLAG union { - struct { T x, y, z, w;}; +# ifdef GLM_FORCE_QUAT_DATA_WXYZ + struct { T w, x, y, z; }; +# else + struct { T x, y, z, w; }; +# endif typename detail::storage<4, T, detail::is_aligned::value>::type data; }; # else - T x, y, z, w; +# ifdef GLM_FORCE_QUAT_DATA_WXYZ + T x, y, z, w; +# else + T w, x, y, z; +# endif # endif # if GLM_SILENT_WARNINGS == GLM_ENABLE diff --git a/manual.md b/manual.md index 15d8120a..1d346417 100644 --- a/manual.md +++ b/manual.md @@ -35,6 +35,7 @@ + [2.18. GLM\_FORCE\_SIZE\_T\_LENGTH: Vector and matrix static size type](#section2_18) + [2.19. GLM\_FORCE\_UNRESTRICTED\_GENTYPE: Removing genType restriction](#section2_19) + [2.20. GLM\_FORCE\_SILENT\_WARNINGS: Silent C++ warnings from language extensions](#section2_20) ++ [2.21. GLM\_FORCE\_QUAT\_DATA\_WXYZ: Force GLM to store quat data as w,x,y,z instead of x,y,z,w](#section2_21) + [3. Stable extensions](#section3) + [3.1. Scalar types](#section3_1) + [3.2. Scalar functions](#section3_2) @@ -716,6 +717,11 @@ int average(int const A, int const B) When using /W4 on Visual C++ or -Wpedantic on GCC, for example, the compilers will generate warnings for using C++ language extensions (/Za with Visual C++) such as anonymous struct. GLM relies on anonymous structs for swizzle operators and aligned vector types. To silent those warnings define `GLM_FORCE_SILENT_WARNINGS` before including GLM headers. + +### 2.21. GLM\_FORCE\_QUAT\_DATA\_WXYZ: Force GLM to store quat data as w,x,y,z instead of x,y,z,w + +By default GLM store quaternion components with the x, y, z, w order. `GLM_FORCE_QUAT_DATA_WXYZ` allows switching the quaternion data storage to the w, x, y, z order. + ---
diff --git a/readme.md b/readme.md index 5397a4c1..931c716f 100644 --- a/readme.md +++ b/readme.md @@ -59,6 +59,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate) - Added CMake GLM interface #963 - Added fma implementation based on std::fma #969 - Added missing quat constexpr #955 +- Added GLM_FORCE_QUAT_DATA_WXYZ to store quat data as w,x,y,z instead of x,y,z,w #983 #### Fixes: - Fixed equal ULP variation when using negative sign #965