Browse Source

Fixed aligned matrices #777

Groove 7 years ago
parent
commit
d427da09df
3 changed files with 5 additions and 9 deletions
  1. 3 5
      glm/detail/func_matrix_simd.inl
  2. 1 1
      glm/gtc/type_aligned.hpp
  3. 1 3
      test/gtc/gtc_type_aligned.cpp

+ 3 - 5
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)
 		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(
-				*static_cast<glm_vec4 const (*)[4]>(&m[0].data),
-				*static_cast<glm_vec4(*)[4]>(&Result[0].data));
+			glm_mat4_transpose(&m[0].data, &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;
 		}
 		}
 	};
 	};

+ 1 - 1
glm/gtc/type_aligned.hpp

@@ -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
 {
 {

+ 1 - 3
test/gtc/gtc_type_aligned.cpp

@@ -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;
 }
 }