Tentative fix of GLM_FORCE_QUAT_DATA_WXYZ on Clang with tests

This commit is contained in:
Christophe Riccio 2020-01-05 20:41:51 +01:00
parent 638eb14fcd
commit 85e491b30c
3 changed files with 44 additions and 9 deletions

View File

@ -90,32 +90,52 @@ namespace detail
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0), z(0), w(1)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(1), x(0), y(0), z(0)
# else
: x(0), y(0), z(0), w(1)
# endif
# endif
{}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(qua<T, Q> const& q)
: x(q.x), y(q.y), z(q.z), w(q.w)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(q.w), x(q.x), y(q.y), z(q.z)
# else
: x(q.x), y(q.y), z(q.z), w(q.w)
# endif
{}
# endif
template<typename T, qualifier Q>
template<qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(qua<T, P> const& q)
: x(q.x), y(q.y), z(q.z), w(q.w)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(q.w), x(q.x), y(q.y), z(q.z)
# else
: x(q.x), y(q.y), z(q.z), w(q.w)
# endif
{}
// -- Explicit basic constructors --
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(T s, vec<3, T, Q> const& v)
: x(v.x), y(v.y), z(v.z), w(s)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(s), x(v.x), y(v.y), z(v.z)
# else
: x(v.x), y(v.y), z(v.z), w(s)
# endif
{}
template <typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(T _w, T _x, T _y, T _z)
: x(_x), y(_y), z(_z), w(_w)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: y(_y), z(_z), w(_w), x(_x)
# else
: x(_x), y(_y), z(_z), w(_w)
# endif
{}
// -- Conversion constructors --
@ -123,10 +143,11 @@ namespace detail
template<typename T, qualifier Q>
template<typename U, qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(qua<U, P> const& q)
: x(static_cast<T>(q.x))
, y(static_cast<T>(q.y))
, z(static_cast<T>(q.z))
, w(static_cast<T>(q.w))
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(static_cast<T>(q.w)), x(static_cast<T>(q.x)), y(static_cast<T>(q.y)), z(static_cast<T>(q.z))
# else
: x(static_cast<T>(q.x)), y(static_cast<T>(q.y)), z(static_cast<T>(q.z)), w(static_cast<T>(q.w))
# endif
{}
//template<typename valType>

View File

@ -7,6 +7,7 @@ glmCreateTestGTC(core_force_inline)
glmCreateTestGTC(core_force_pure)
glmCreateTestGTC(core_force_unrestricted_gentype)
glmCreateTestGTC(core_force_xyzw_only)
glmCreateTestGTC(core_force_quat_wxyz)
glmCreateTestGTC(core_type_aligned)
glmCreateTestGTC(core_type_cast)
glmCreateTestGTC(core_type_ctor)

View File

@ -0,0 +1,13 @@
#define GLM_FORCE_QUAT_DATA_WXYZ
#define GLM_FORCE_INLINE
#include <glm/glm.hpp>
#include <glm/ext.hpp>
int main()
{
int Error = 0;
return Error;
}