Browse Source

Merge pull request #368 from JesseTG/jtg/oops-sorry

Fixed some of my own metaprogramming-helper mistakes #368
Christophe R. 10 years ago
parent
commit
37d4ca9c4c

+ 1 - 1
glm/detail/type_mat2x2.hpp

@@ -56,7 +56,7 @@ namespace glm
 
 #		ifdef GLM_META_PROG_HELPERS
 			static GLM_RELAXED_CONSTEXPR length_t components = 2;
-			static GLM_RELAXED_CONSTEXPR length_t columns = 2;
+			static GLM_RELAXED_CONSTEXPR length_t cols = 2;
 			static GLM_RELAXED_CONSTEXPR length_t rows = 2;
 			static GLM_RELAXED_CONSTEXPR precision prec = P;
 #		endif//GLM_META_PROG_HELPERS

+ 2 - 2
glm/detail/type_mat2x3.hpp

@@ -52,8 +52,8 @@ namespace glm
 
 #		ifdef GLM_META_PROG_HELPERS
 			static GLM_RELAXED_CONSTEXPR length_t components = 2;
-			static GLM_RELAXED_CONSTEXPR length_t cols = 3;
-			static GLM_RELAXED_CONSTEXPR length_t rows = 2;
+			static GLM_RELAXED_CONSTEXPR length_t cols = 2;
+			static GLM_RELAXED_CONSTEXPR length_t rows = 3;
 			static GLM_RELAXED_CONSTEXPR precision prec = P;
 #		endif//GLM_META_PROG_HELPERS
 

+ 2 - 2
glm/detail/type_mat2x4.hpp

@@ -52,8 +52,8 @@ namespace glm
 
 #		ifdef GLM_META_PROG_HELPERS
 			static GLM_RELAXED_CONSTEXPR length_t components = 2;
-			static GLM_RELAXED_CONSTEXPR length_t cols = 4;
-			static GLM_RELAXED_CONSTEXPR length_t rows = 2;
+			static GLM_RELAXED_CONSTEXPR length_t cols = 2;
+			static GLM_RELAXED_CONSTEXPR length_t rows = 4;
 			static GLM_RELAXED_CONSTEXPR precision prec = P;
 #		endif//GLM_META_PROG_HELPERS
 

+ 2 - 2
glm/detail/type_mat3x2.hpp

@@ -52,8 +52,8 @@ namespace glm
 
 #		ifdef GLM_META_PROG_HELPERS
 			static GLM_RELAXED_CONSTEXPR length_t components = 3;
-			static GLM_RELAXED_CONSTEXPR length_t cols = 2;
-			static GLM_RELAXED_CONSTEXPR length_t rows = 3;
+			static GLM_RELAXED_CONSTEXPR length_t cols = 3;
+			static GLM_RELAXED_CONSTEXPR length_t rows = 2;
 			static GLM_RELAXED_CONSTEXPR precision prec = P;
 #		endif//GLM_META_PROG_HELPERS
 

+ 2 - 2
glm/detail/type_mat3x4.hpp

@@ -52,8 +52,8 @@ namespace glm
 
 #		ifdef GLM_META_PROG_HELPERS
 			static GLM_RELAXED_CONSTEXPR length_t components = 3;
-			static GLM_RELAXED_CONSTEXPR length_t cols = 4;
-			static GLM_RELAXED_CONSTEXPR length_t rows = 3;
+			static GLM_RELAXED_CONSTEXPR length_t cols = 3;
+			static GLM_RELAXED_CONSTEXPR length_t rows = 4;
 			static GLM_RELAXED_CONSTEXPR precision prec = P;
 #		endif//GLM_META_PROG_HELPERS
 

+ 2 - 2
glm/detail/type_mat4x2.hpp

@@ -52,8 +52,8 @@ namespace glm
 
 #		ifdef GLM_META_PROG_HELPERS
 			static GLM_RELAXED_CONSTEXPR length_t components = 4;
-			static GLM_RELAXED_CONSTEXPR length_t cols = 2;
-			static GLM_RELAXED_CONSTEXPR length_t rows = 4;
+			static GLM_RELAXED_CONSTEXPR length_t cols = 4;
+			static GLM_RELAXED_CONSTEXPR length_t rows = 2;
 			static GLM_RELAXED_CONSTEXPR precision prec = P;
 #		endif//GLM_META_PROG_HELPERS
 

+ 2 - 2
glm/detail/type_mat4x3.hpp

@@ -52,8 +52,8 @@ namespace glm
 
 #		ifdef GLM_META_PROG_HELPERS
 			static GLM_RELAXED_CONSTEXPR length_t components = 4;
-			static GLM_RELAXED_CONSTEXPR length_t cols = 3;
-			static GLM_RELAXED_CONSTEXPR length_t rows = 4;
+			static GLM_RELAXED_CONSTEXPR length_t cols = 4;
+			static GLM_RELAXED_CONSTEXPR length_t rows = 3;
 			static GLM_RELAXED_CONSTEXPR precision prec = P;
 #		endif//GLM_META_PROG_HELPERS
 

+ 1 - 1
glm/gtx/dual_quaternion.hpp

@@ -65,7 +65,7 @@ namespace glm
 		typedef glm::tquat<T, P> part_type;
 
 #		ifdef GLM_META_PROG_HELPERS
-			static GLM_RELAXED_CONSTEXPR length_t components = 8;
+			static GLM_RELAXED_CONSTEXPR length_t components = 2;
 			static GLM_RELAXED_CONSTEXPR precision prec = P;
 #		endif//GLM_META_PROG_HELPERS
 

+ 5 - 0
glm/gtx/simd_mat4.hpp

@@ -71,6 +71,11 @@ namespace detail
 		typedef fmat4x4SIMD type;
 		typedef fmat4x4SIMD transpose_type;
 
+		typedef tmat4x4<float, defaultp> pure_type;
+		typedef tvec4<float, defaultp> pure_row_type;
+		typedef tvec4<float, defaultp> pure_col_type;
+		typedef tmat4x4<float, defaultp> pure_transpose_type;
+
 #		ifdef GLM_META_PROG_HELPERS
 			static GLM_RELAXED_CONSTEXPR length_t components = 4;
 			static GLM_RELAXED_CONSTEXPR length_t cols = 4;

+ 2 - 2
glm/gtx/simd_quat.hpp

@@ -69,12 +69,12 @@ namespace detail
 {
 	GLM_ALIGNED_STRUCT(16) fquatSIMD
 	{
-		typedef __m128 value_type;
+		typedef float value_type;
 		typedef std::size_t size_type;
-		static size_type value_size();
 
 		typedef fquatSIMD type;
 		typedef tquat<bool, defaultp> bool_type;
+		typedef tquat<float, defaultp> pure_type;
 
 #		ifdef GLM_META_PROG_HELPERS
 			static GLM_RELAXED_CONSTEXPR length_t components = 4;

+ 2 - 2
glm/gtx/simd_vec4.hpp

@@ -92,11 +92,11 @@ namespace detail
 	/// \ingroup gtx_simd_vec4
 	GLM_ALIGNED_STRUCT(16) fvec4SIMD
 	{
-		typedef __m128 value_type;
+		typedef float value_type;
 		typedef std::size_t size_type;
-		static size_type value_size();
 
 		typedef fvec4SIMD type;
+		typedef tvec4<float, defaultp> pure_type;
 		typedef tvec4<bool, highp> bool_type;
 
 #		ifdef GLM_META_PROG_HELPERS

+ 5 - 0
test/core/core_type_mat2x2.cpp

@@ -124,6 +124,11 @@ int main()
 {
 	int Error(0);
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::mat2::rows == glm::mat2::row_type::components);
+		assert(glm::mat2::cols == glm::mat2::col_type::components);
+#endif
+
 	Error += test_ctr();
 	Error += test_operators();
 	Error += test_inverse();

+ 5 - 0
test/core/core_type_mat2x3.cpp

@@ -98,6 +98,11 @@ int main()
 {
 	int Error = 0;
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::mat2x3::rows == glm::mat2x3::row_type::components);
+		assert(glm::mat2x3::cols == glm::mat2x3::col_type::components);
+#endif
+
 	Error += test_ctr();
 	Error += test_operators();
 

+ 5 - 0
test/core/core_type_mat2x4.cpp

@@ -98,6 +98,11 @@ int main()
 {
 	int Error = 0;
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::mat2x4::rows == glm::mat2x4::row_type::components);
+		assert(glm::mat2x4::cols == glm::mat2x4::col_type::components);
+#endif
+
 	Error += test_ctr();
 	Error += test_operators();
 

+ 5 - 0
test/core/core_type_mat3x2.cpp

@@ -102,6 +102,11 @@ int main()
 {
 	int Error = 0;
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::mat3x2::rows == glm::mat3x2::row_type::components);
+		assert(glm::mat3x2::cols == glm::mat3x2::col_type::components);
+#endif
+
 	Error += test_ctr();
 	Error += test_operators();
 

+ 5 - 0
test/core/core_type_mat3x3.cpp

@@ -161,6 +161,11 @@ int main()
 {
 	int Error = 0;
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::mat3::rows == glm::mat3::row_type::components);
+		assert(glm::mat3::cols == glm::mat3::col_type::components);
+#endif
+
 	Error += test_ctr();
 	Error += test_mat3x3();
 	Error += test_operators();

+ 6 - 1
test/core/core_type_mat3x4.cpp

@@ -101,7 +101,12 @@ int test_ctr()
 int main()
 {
 	int Error = 0;
-	
+
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::mat3x4::rows == glm::mat3x4::row_type::components);
+		assert(glm::mat3x4::cols == glm::mat3x4::col_type::components);
+#endif
+
 	Error += test_ctr();
 	Error += test_operators();
 

+ 5 - 0
test/core/core_type_mat4x2.cpp

@@ -106,6 +106,11 @@ int main()
 {
 	int Error = 0;
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::mat4x2::rows == glm::mat4x2::row_type::components);
+		assert(glm::mat4x2::cols == glm::mat4x2::col_type::components);
+#endif
+
 	Error += test_ctr();
 	Error += test_operators();
 

+ 5 - 0
test/core/core_type_mat4x3.cpp

@@ -106,6 +106,11 @@ int main()
 {
 	int Error = 0;
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::mat4x3::rows == glm::mat4x3::row_type::components);
+		assert(glm::mat4x3::cols == glm::mat4x3::col_type::components);
+#endif
+
 	Error += test_ctr();
 	Error += test_operators();
 

+ 5 - 0
test/core/core_type_mat4x4.cpp

@@ -278,6 +278,11 @@ int main()
 {
 	int Error = 0;
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::mat4::rows == glm::mat4::row_type::components);
+		assert(glm::mat4::cols == glm::mat4::col_type::components);
+#endif
+
 	Error += test_ctr();
 	Error += test_inverse_dmat4x4();
 	Error += test_inverse_mat4x4();

+ 1 - 0
test/core/core_type_vec1.cpp

@@ -174,6 +174,7 @@ int main()
 	assert(v.length() == 1);
 
 #	ifdef GLM_META_PROG_HELPERS
+		assert(glm::vec1::components == glm::vec1().length());
 		assert(glm::vec1::components == 1);
 #	endif
 

+ 1 - 0
test/core/core_type_vec2.cpp

@@ -333,6 +333,7 @@ int main()
 	assert(v.length() == 2);
 
 #	ifdef GLM_META_PROG_HELPERS
+		assert(glm::vec2::components == glm::vec2().length());
 		assert(glm::vec2::components == 2);
 #	endif
 

+ 1 - 0
test/core/core_type_vec3.cpp

@@ -501,6 +501,7 @@ int main()
 	assert(v.length() == 3);
 
 #	ifdef GLM_META_PROG_HELPERS
+		assert(glm::vec3::components == glm::vec3().length());
 		assert(glm::vec3::components == 3);
 #	endif
 

+ 1 - 0
test/core/core_type_vec4.cpp

@@ -477,6 +477,7 @@ int main()
 	assert(v.length() == 4);
 
 #	ifdef GLM_META_PROG_HELPERS
+		assert(glm::vec4::components == glm::vec4().length());
 		assert(glm::vec4::components == 4);
 #	endif
 

+ 4 - 1
test/gtc/gtc_quaternion.cpp

@@ -327,7 +327,10 @@ int main()
 {
 	int Error(0);
 
-	assert(glm::quat::components == 4);
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::quat::components == 4);
+		assert(glm::quat::components == glm::quat().length());
+#endif
 
 	Error += test_quat_ctr();
 	Error += test_quat_mul_vec();

+ 4 - 0
test/gtx/gtx_dual_quaternion.cpp

@@ -209,6 +209,10 @@ int main()
 {
 	int Error(0);
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::dualquat::components == glm::dualquat().length());
+#endif
+
 	Error += test_dual_quat_ctr();
 	Error += test_dquat_type();
 	Error += test_scalars();

+ 9 - 0
test/gtx/gtx_simd_mat4.cpp

@@ -256,6 +256,15 @@ int main()
 {
 	int Error = 0;
 
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::simdMat4::rows == glm::simdMat4::row_type::components);
+		assert(glm::simdMat4::cols == glm::simdMat4::col_type::components);
+
+		assert(glm::simdMat4::components == glm::simdMat4::pure_type::components);
+		assert(glm::simdMat4::rows == glm::simdMat4::pure_row_type::components);
+		assert(glm::simdMat4::cols == glm::simdMat4::pure_col_type::components);
+#endif
+
 	std::vector<glm::mat4> Data(64 * 64 * 1);
 	for(std::size_t i = 0; i < Data.size(); ++i)
 		Data[i] = glm::mat4(

+ 5 - 0
test/gtx/gtx_simd_vec4.cpp

@@ -37,6 +37,11 @@
 
 int main()
 {
+
+#ifdef GLM_META_PROG_HELPERS
+		assert(glm::simdVec4::components == glm::simdVec4::pure_type::components);
+#endif
+
 	glm::simdVec4 A1(0.0f, 0.1f, 0.2f, 0.3f);
 	glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f);
 	glm::simdVec4 C1 = A1 + B1;