From d427da09df13344a367d43ca282c3b72baa70775 Mon Sep 17 00:00:00 2001 From: Groove Date: Sun, 29 Jul 2018 17:09:25 +0200 Subject: [PATCH] Fixed aligned matrices #777 --- glm/detail/func_matrix_simd.inl | 8 +++----- glm/gtc/type_aligned.hpp | 2 +- test/gtc/gtc_type_aligned.cpp | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/glm/detail/func_matrix_simd.inl b/glm/detail/func_matrix_simd.inl index 9478ce52..0a6aaf47 100644 --- a/glm/detail/func_matrix_simd.inl +++ b/glm/detail/func_matrix_simd.inl @@ -33,9 +33,7 @@ namespace detail 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( - *static_cast(&m[0].data), - *static_cast(&Result[0].data)); + glm_mat4_transpose(&m[0].data, &Result[0].data); return Result; } }; @@ -45,7 +43,7 @@ namespace detail { 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) { 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; } }; diff --git a/glm/gtc/type_aligned.hpp b/glm/gtc/type_aligned.hpp index 2129f2da..52184e61 100644 --- a/glm/gtc/type_aligned.hpp +++ b/glm/gtc/type_aligned.hpp @@ -20,10 +20,10 @@ # pragma message("GLM: GLM_GTC_type_aligned extension included") #endif +#include "../gtc/vec1.hpp" #include "../vec2.hpp" #include "../vec3.hpp" #include "../vec4.hpp" -#include "../gtc/vec1.hpp" namespace glm { diff --git a/test/gtc/gtc_type_aligned.cpp b/test/gtc/gtc_type_aligned.cpp index d93584da..85517fc7 100644 --- a/test/gtc/gtc_type_aligned.cpp +++ b/test/gtc/gtc_type_aligned.cpp @@ -127,7 +127,6 @@ static int test_ctor() return Error; } -/* using namespace glm; typedef mat<4, 4, float, aligned> aligned_mat4; @@ -144,7 +143,6 @@ static int test_aligned_mat4() return Error; } -*/ int main() { @@ -152,7 +150,7 @@ int main() Error += test_ctor(); Error += test_copy(); -// Error += test_aligned_mat4(); + Error += test_aligned_mat4(); return Error; }