Fixed aligned matrices #777

This commit is contained in:
Groove 2018-07-29 17:09:25 +02:00
parent d18c7f55ec
commit d427da09df
3 changed files with 5 additions and 9 deletions

View File

@ -33,9 +33,7 @@ namespace detail
GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m) GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m)
{ {
mat<4, 4, float, Q> Result; mat<4, 4, float, Q> Result;
glm_mat4_transpose( glm_mat4_transpose(&m[0].data, &Result[0].data);
*static_cast<glm_vec4 const (*)[4]>(&m[0].data),
*static_cast<glm_vec4(*)[4]>(&Result[0].data));
return Result; return Result;
} }
}; };
@ -45,7 +43,7 @@ namespace detail
{ {
GLM_FUNC_QUALIFIER static float call(mat<4, 4, float, Q> const& m) GLM_FUNC_QUALIFIER static float call(mat<4, 4, float, Q> const& m)
{ {
return _mm_cvtss_f32(glm_mat4_determinant(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data))); return _mm_cvtss_f32(glm_mat4_determinant(&m[0].data));
} }
}; };
@ -55,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m) GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m)
{ {
mat<4, 4, float, Q> Result; mat<4, 4, float, Q> Result;
glm_mat4_inverse(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data), *reinterpret_cast<__m128(*)[4]>(&Result[0].data)); glm_mat4_inverse(&m[0].data, &Result[0].data);
return Result; return Result;
} }
}; };

View File

@ -20,10 +20,10 @@
# pragma message("GLM: GLM_GTC_type_aligned extension included") # pragma message("GLM: GLM_GTC_type_aligned extension included")
#endif #endif
#include "../gtc/vec1.hpp"
#include "../vec2.hpp" #include "../vec2.hpp"
#include "../vec3.hpp" #include "../vec3.hpp"
#include "../vec4.hpp" #include "../vec4.hpp"
#include "../gtc/vec1.hpp"
namespace glm namespace glm
{ {

View File

@ -127,7 +127,6 @@ static int test_ctor()
return Error; return Error;
} }
/*
using namespace glm; using namespace glm;
typedef mat<4, 4, float, aligned> aligned_mat4; typedef mat<4, 4, float, aligned> aligned_mat4;
@ -144,7 +143,6 @@ static int test_aligned_mat4()
return Error; return Error;
} }
*/
int main() int main()
{ {
@ -152,7 +150,7 @@ int main()
Error += test_ctor(); Error += test_ctor();
Error += test_copy(); Error += test_copy();
// Error += test_aligned_mat4(); Error += test_aligned_mat4();
return Error; return Error;
} }