mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 02:04:35 +00:00
Fix quat packing XYZW usage (#1204)
This commit is contained in:
parent
5ce98b7514
commit
8d337c0c65
@ -89,7 +89,7 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR qua(T s, vec<3, T, Q> const& v);
|
||||
|
||||
# ifdef GLM_FORCE_QUAT_DATA_XYZW
|
||||
# ifdef GLM_FORCE_QUAT_CTOR_XYZW
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR qua(T x, T y, T z, T w);
|
||||
# else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR qua(T w, T x, T y, T z);
|
||||
|
@ -141,7 +141,11 @@ namespace detail
|
||||
{}
|
||||
|
||||
template <typename T, qualifier Q>
|
||||
# ifdef GLM_FORCE_QUAT_CTOR_XYZW
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(T _x, T _y, T _z, T _w)
|
||||
# else
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(T _w, T _x, T _y, T _z)
|
||||
# endif
|
||||
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
|
||||
: w(_w), x(_x), y(_y), z(_z)
|
||||
# else
|
||||
|
@ -161,10 +161,10 @@ namespace detail
|
||||
{
|
||||
static vec<4, float, Q> call(qua<float, Q> const& q, vec<4, float, Q> const& v)
|
||||
{
|
||||
# ifdef GLM_FORCE_QUAT_DATA_XYZW
|
||||
__m128 const q_wwww = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 3, 3, 3));
|
||||
__m128 const q_swp0 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 const q_swp1 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
|
||||
__m128 const q_wwww = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
__m128 const q_swp0 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(0, 1, 3, 2));
|
||||
__m128 const q_swp1 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(0, 2, 1, 3));
|
||||
__m128 const v_swp0 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 const v_swp1 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
|
||||
@ -181,9 +181,9 @@ namespace detail
|
||||
Result.data = _mm_add_ps(v.data, _mm_add_ps(uv, uuv));
|
||||
return Result;
|
||||
# else
|
||||
__m128 const q_wwww = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
__m128 const q_swp0 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(0, 1, 3, 2));
|
||||
__m128 const q_swp1 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(0, 2, 1, 3));
|
||||
__m128 const q_wwww = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 3, 3, 3));
|
||||
__m128 const q_swp0 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 const q_swp1 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
__m128 const v_swp0 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 const v_swp1 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
|
||||
|
@ -173,10 +173,10 @@ namespace detail
|
||||
j = Next[i];
|
||||
k = Next[j];
|
||||
|
||||
# ifdef GLM_FORCE_QUAT_DATA_XYZW
|
||||
int off = 0;
|
||||
# else
|
||||
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
|
||||
int off = 1;
|
||||
# else
|
||||
int off = 0;
|
||||
# endif
|
||||
|
||||
root = sqrt(Row[i][i] - Row[j][j] - Row[k][k] + static_cast<T>(1.0));
|
||||
|
Loading…
Reference in New Issue
Block a user