Replace GLM_FORCE_QUAT_DATA_WXYZ with GLM_FORCE_QUAT_DATA_XYZW

The default data layout for quat has been changed to w,x,y,z to agree
with order of input parameters for quat's constructor.

Signed-off-by: Gaoyang Zhang <gy@blurgy.xyz>
This commit is contained in:
Gaoyang Zhang 2021-05-06 13:58:27 +08:00
parent d573bf099a
commit 59ddeb7d1c
2 changed files with 30 additions and 30 deletions

View File

@ -42,19 +42,19 @@ namespace glm
# if GLM_LANG & GLM_LANG_CXXMS_FLAG
union
{
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
struct { T w, x, y, z; };
# else
# ifdef GLM_FORCE_QUAT_DATA_XYZW
struct { T x, y, z, w; };
# else
struct { T w, x, y, z; };
# endif
typename detail::storage<4, T, detail::is_aligned<Q>::value>::type data;
};
# else
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
T w, x, y, z;
# else
# ifdef GLM_FORCE_QUAT_DATA_XYZW
T x, y, z, w;
# else
T w, x, y, z;
# endif
# endif

View File

@ -75,10 +75,10 @@ namespace detail
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T & qua<T, Q>::operator[](typename qua<T, Q>::length_type i)
{
assert(i >= 0 && i < this->length());
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
return (&w)[i];
# else
# ifdef GLM_FORCE_QUAT_DATA_XYZW
return (&x)[i];
# else
return (&w)[i];
# endif
}
@ -86,10 +86,10 @@ namespace detail
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T const& qua<T, Q>::operator[](typename qua<T, Q>::length_type i) const
{
assert(i >= 0 && i < this->length());
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
return (&w)[i];
# else
# ifdef GLM_FORCE_QUAT_DATA_XYZW
return (&x)[i];
# else
return (&w)[i];
# endif
}
@ -99,10 +99,10 @@ 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
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(1), x(0), y(0), z(0)
# else
# ifdef GLM_FORCE_QUAT_DATA_XYZW
: x(0), y(0), z(0), w(1)
# else
: w(1), x(0), y(0), z(0)
# endif
# endif
{}
@ -111,10 +111,10 @@ namespace detail
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(qua<T, Q> const& q)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(q.w), x(q.x), y(q.y), z(q.z)
# else
# ifdef GLM_FORCE_QUAT_DATA_XYZW
: x(q.x), y(q.y), z(q.z), w(q.w)
# else
: w(q.w), x(q.x), y(q.y), z(q.z)
# endif
{}
# endif
@ -122,10 +122,10 @@ namespace detail
template<typename T, qualifier Q>
template<qualifier P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(qua<T, P> const& q)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(q.w), x(q.x), y(q.y), z(q.z)
# else
# ifdef GLM_FORCE_QUAT_DATA_XYZW
: x(q.x), y(q.y), z(q.z), w(q.w)
# else
: w(q.w), x(q.x), y(q.y), z(q.z)
# endif
{}
@ -133,19 +133,19 @@ namespace detail
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(T s, vec<3, T, Q> const& v)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(s), x(v.x), y(v.y), z(v.z)
# else
# ifdef GLM_FORCE_QUAT_DATA_XYZW
: x(v.x), y(v.y), z(v.z), w(s)
# else
: w(s), x(v.x), y(v.y), z(v.z)
# endif
{}
template <typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(T _w, T _x, T _y, T _z)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
: w(_w), x(_x), y(_y), z(_z)
# else
# ifdef GLM_FORCE_QUAT_DATA_XYZW
: x(_x), y(_y), z(_z), w(_w)
# else
: w(_w), x(_x), y(_y), z(_z)
# endif
{}
@ -154,10 +154,10 @@ 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)
# 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
# ifdef GLM_FORCE_QUAT_DATA_XYZW
: x(static_cast<T>(q.x)), y(static_cast<T>(q.y)), z(static_cast<T>(q.z)), w(static_cast<T>(q.w))
# else
: w(static_cast<T>(q.w)), x(static_cast<T>(q.x)), y(static_cast<T>(q.y)), z(static_cast<T>(q.z))
# endif
{}