mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-10 10:33:23 +08:00
Update GLM to latest version (0.9.9.3). This includes GLM's change of matrices no longer default initializing to the identity matrix. This commit thus also includes the update of all of LearnOpenGL's code to reflect this: all matrices are now constructor-initialized to the identity matrix where relevant.
This commit is contained in:
94
includes/glm/detail/func_matrix_simd.inl
Normal file
94
includes/glm/detail/func_matrix_simd.inl
Normal file
@@ -0,0 +1,94 @@
|
||||
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
|
||||
#include "type_mat4x4.hpp"
|
||||
#include "../geometric.hpp"
|
||||
#include "../simd/matrix.h"
|
||||
#include <cstring>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
# if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
|
||||
template<qualifier Q>
|
||||
struct compute_matrixCompMult<4, 4, float, Q, true>
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::is_aligned<Q>::value, "Specialization requires aligned");
|
||||
|
||||
GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& x, mat<4, 4, float, Q> const& y)
|
||||
{
|
||||
mat<4, 4, float, Q> Result;
|
||||
glm_mat4_matrixCompMult(
|
||||
*static_cast<glm_vec4 const (*)[4]>(&x[0].data),
|
||||
*static_cast<glm_vec4 const (*)[4]>(&y[0].data),
|
||||
*static_cast<glm_vec4(*)[4]>(&Result[0].data));
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
# endif
|
||||
|
||||
template<qualifier Q>
|
||||
struct compute_transpose<4, 4, float, Q, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m)
|
||||
{
|
||||
mat<4, 4, float, Q> Result;
|
||||
glm_mat4_transpose(&m[0].data, &Result[0].data);
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
|
||||
template<qualifier Q>
|
||||
struct compute_determinant<4, 4, float, Q, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static float call(mat<4, 4, float, Q> const& m)
|
||||
{
|
||||
return _mm_cvtss_f32(glm_mat4_determinant(&m[0].data));
|
||||
}
|
||||
};
|
||||
|
||||
template<qualifier Q>
|
||||
struct compute_inverse<4, 4, float, Q, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m)
|
||||
{
|
||||
mat<4, 4, float, Q> Result;
|
||||
glm_mat4_inverse(&m[0].data, &Result[0].data);
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
# if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, float, aligned_lowp> outerProduct<4, 4, float, aligned_lowp>(vec<4, float, aligned_lowp> const& c, vec<4, float, aligned_lowp> const& r)
|
||||
{
|
||||
__m128 NativeResult[4];
|
||||
glm_mat4_outerProduct(c.data, r.data, NativeResult);
|
||||
mat<4, 4, float, aligned_lowp> Result;
|
||||
std::memcpy(&Result[0], &NativeResult[0], sizeof(Result));
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, float, aligned_mediump> outerProduct<4, 4, float, aligned_mediump>(vec<4, float, aligned_mediump> const& c, vec<4, float, aligned_mediump> const& r)
|
||||
{
|
||||
__m128 NativeResult[4];
|
||||
glm_mat4_outerProduct(c.data, r.data, NativeResult);
|
||||
mat<4, 4, float, aligned_mediump> Result;
|
||||
std::memcpy(&Result[0], &NativeResult[0], sizeof(Result));
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, float, aligned_highp> outerProduct<4, 4, float, aligned_highp>(vec<4, float, aligned_highp> const& c, vec<4, float, aligned_highp> const& r)
|
||||
{
|
||||
__m128 NativeResult[4];
|
||||
glm_mat4_outerProduct(c.data, r.data, NativeResult);
|
||||
mat<4, 4, float, aligned_highp> Result;
|
||||
std::memcpy(&Result[0], &NativeResult[0], sizeof(Result));
|
||||
return Result;
|
||||
}
|
||||
# endif
|
||||
}//namespace glm
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user