Browse Source

Fixed relational code, reduced header dependencies

Christophe Riccio 7 years ago
parent
commit
7086d902e2

+ 1 - 37
glm/ext/matrix_relational.inl

@@ -2,29 +2,11 @@
 /// @file glm/ext/vector_relational.inl
 
 // Dependency:
-#include "../vector_relational.hpp"
+#include "../ext/vector_relational.hpp"
 #include "../common.hpp"
 
 namespace glm
 {
-	template<typename genType>
-	GLM_FUNC_QUALIFIER bool equal(genType const& x, genType const& y, genType const& epsilon)
-	{
-		return abs(x - y) <= epsilon;
-	}
-
-	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T epsilon)
-	{
-		return equal(x, y, vec<L, T, Q>(epsilon));
-	}
-
-	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
-	{
-		return lessThanEqual(abs(x - y), epsilon);
-	}
-
 	template<length_t C, length_t R, typename T, qualifier Q>
 	GLM_FUNC_QUALIFIER vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b)
 	{
@@ -46,24 +28,6 @@ namespace glm
 		return Result;
 	}
 
-	template<typename genType>
-	GLM_FUNC_QUALIFIER bool notEqual(genType const& x, genType const& y, genType const& epsilon)
-	{
-		return abs(x - y) > epsilon;
-	}
-
-	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T epsilon)
-	{
-		return notEqual(x, y, vec<L, T, Q>(epsilon));
-	}
-
-	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
-	{
-		return greaterThan(abs(x - y), epsilon);
-	}
-
 	template<length_t C, length_t R, typename T, qualifier Q>
 	GLM_FUNC_QUALIFIER vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
 	{

+ 0 - 18
glm/ext/vector_relational.hpp

@@ -47,15 +47,6 @@ namespace glm
 	template<length_t L, typename T, qualifier Q>
 	GLM_FUNC_DECL vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon);
 
-	/// Returns the component-wise comparison of |x - y| < epsilon.
-	/// True if this expression is satisfied.
-	///
-	/// @tparam genType Floating-point or integer scalar types
-	///
-	/// @see ext_vector_relational
-	template<typename genType>
-	GLM_FUNC_DECL bool equal(genType const& x, genType const& y, genType const& epsilon);
-
 	/// Returns the component-wise comparison of |x - y| >= epsilon.
 	/// True if this expression is not satisfied.
 	///
@@ -78,15 +69,6 @@ namespace glm
 	template<length_t L, typename T, qualifier Q>
 	GLM_FUNC_DECL vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon);
 
-	/// Returns the component-wise comparison of |x - y| >= epsilon.
-	/// True if this expression is not satisfied.
-	///
-	/// @tparam genType Floating-point or integer scalar types
-	///
-	/// @see ext_vector_relational
-	template<typename genType>
-	GLM_FUNC_DECL bool notEqual(genType const& x, genType const& y, genType const& epsilon);
-
 	/// @}
 }//namespace glm
 

+ 0 - 55
glm/ext/vector_relational.inl

@@ -1,5 +1,4 @@
 /// @ref ext_vector_relational
-/// @file glm/ext/vector_relational.inl
 
 // Dependency:
 #include "../vector_relational.hpp"
@@ -8,12 +7,6 @@
 
 namespace glm
 {
-	template<typename genType>
-	GLM_FUNC_QUALIFIER bool equal(genType const& x, genType const& y, genType const& epsilon)
-	{
-		return abs(x - y) <= epsilon;
-	}
-
 	template<length_t L, typename T, qualifier Q>
 	GLM_FUNC_QUALIFIER vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T epsilon)
 	{
@@ -26,33 +19,6 @@ namespace glm
 		return lessThanEqual(abs(x - y), epsilon);
 	}
 
-	template<length_t C, length_t R, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b)
-	{
-		return equal(a, b, static_cast<T>(0));
-	}
-
-	template<length_t C, length_t R, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, T epsilon)
-	{
-		return equal(a, b, vec<C, T, Q>(epsilon));
-	}
-
-	template<length_t C, length_t R, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, T, Q> const& epsilon)
-	{
-		vec<C, bool, Q> Result;
-		for(length_t i = 0, n = C; i < n; ++i)
-			Result[i] = all(equal(a[i], b[i], epsilon[i]));
-		return Result;
-	}
-
-	template<typename genType>
-	GLM_FUNC_QUALIFIER bool notEqual(genType const& x, genType const& y, genType const& epsilon)
-	{
-		return abs(x - y) > epsilon;
-	}
-
 	template<length_t L, typename T, qualifier Q>
 	GLM_FUNC_QUALIFIER vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T epsilon)
 	{
@@ -64,25 +30,4 @@ namespace glm
 	{
 		return greaterThan(abs(x - y), epsilon);
 	}
-
-	template<length_t C, length_t R, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
-	{
-		return notEqual(x, y, static_cast<T>(0));
-	}
-
-	template<length_t C, length_t R, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, T epsilon)
-	{
-		return notEqual(x, y, vec<C, T, Q>(epsilon));
-	}
-
-	template<length_t C, length_t R, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, T, Q> const& epsilon)
-	{
-		vec<C, bool, Q> Result;
-		for(length_t i = 0, n = C; i < n; ++i)
-			Result[i] = any(notEqual(a[i], b[i], epsilon[i]));
-		return Result;
-	}
 }//namespace glm

+ 1 - 0
glm/gtc/packing.inl

@@ -1,5 +1,6 @@
 /// @ref gtc_packing
 
+#include "../ext/scalar_relational.hpp"
 #include "../ext/vector_relational.hpp"
 #include "../common.hpp"
 #include "../vec2.hpp"

+ 1 - 0
test/core/core_cpp_defaulted_ctor.cpp

@@ -4,6 +4,7 @@
 
 #include <glm/gtc/constants.hpp>
 #include <glm/gtc/quaternion.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
 #include <glm/ext/vec1.hpp>
 #include <cstring>

+ 1 - 0
test/core/core_func_common.cpp

@@ -1,4 +1,5 @@
 #define GLM_FORCE_EXPLICIT_CTOR
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
 #include <glm/common.hpp>
 #include <glm/gtc/constants.hpp>

+ 1 - 0
test/core/core_func_geometric.cpp

@@ -1,5 +1,6 @@
 #include <glm/geometric.hpp>
 #include <glm/trigonometric.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
 #include <glm/ext/vector_vec1.hpp>
 #include <glm/vector_vec2.hpp>

+ 1 - 0
test/core/core_func_swizzle.cpp

@@ -1,4 +1,5 @@
 #define GLM_FORCE_SWIZZLE
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
 #include <glm/glm.hpp>
 

+ 2 - 0
test/core/core_type_mat2x2.cpp

@@ -1,4 +1,6 @@
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/gtc/constants.hpp>
 #include <glm/matrix.hpp>
 #include <glm/vector_relational.hpp>

+ 2 - 0
test/core/core_type_mat2x3.cpp

@@ -1,4 +1,6 @@
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/gtc/constants.hpp>
 #include <glm/mat2x2.hpp>
 #include <glm/mat2x3.hpp>

+ 2 - 0
test/core/core_type_mat2x4.cpp

@@ -1,6 +1,8 @@
 #include <glm/gtc/epsilon.hpp>
 #include <glm/gtc/constants.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/mat2x2.hpp>
 #include <glm/mat2x3.hpp>
 #include <glm/mat2x4.hpp>

+ 2 - 0
test/core/core_type_mat3x2.cpp

@@ -1,5 +1,7 @@
 #include <glm/gtc/constants.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/mat2x2.hpp>
 #include <glm/mat2x3.hpp>
 #include <glm/mat2x4.hpp>

+ 2 - 0
test/core/core_type_mat3x3.cpp

@@ -1,5 +1,7 @@
 #include <glm/gtc/constants.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/matrix.hpp>
 #include <glm/vector_relational.hpp>
 #include <glm/mat2x2.hpp>

+ 2 - 0
test/core/core_type_mat3x4.cpp

@@ -1,6 +1,8 @@
 #include <glm/gtc/epsilon.hpp>
 #include <glm/gtc/constants.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/mat2x2.hpp>
 #include <glm/mat2x3.hpp>
 #include <glm/mat2x4.hpp>

+ 2 - 0
test/core/core_type_mat4x2.cpp

@@ -1,5 +1,7 @@
 #include <glm/gtc/constants.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/mat2x2.hpp>
 #include <glm/mat2x3.hpp>
 #include <glm/mat2x4.hpp>

+ 2 - 0
test/core/core_type_mat4x3.cpp

@@ -1,5 +1,7 @@
 #include <glm/gtc/constants.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/mat2x2.hpp>
 #include <glm/mat2x3.hpp>
 #include <glm/mat2x4.hpp>

+ 83 - 226
test/core/core_type_mat4x4.cpp

@@ -1,184 +1,69 @@
 #include <glm/gtc/constants.hpp>
-#include <glm/gtc/epsilon.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/matrix.hpp>
-#include <glm/mat2x2.hpp>
-#include <glm/mat2x3.hpp>
-#include <glm/mat2x4.hpp>
-#include <glm/mat3x2.hpp>
-#include <glm/mat3x3.hpp>
-#include <glm/mat3x4.hpp>
-#include <glm/mat4x2.hpp>
-#include <glm/mat4x3.hpp>
 #include <glm/mat4x4.hpp>
-#include <cstdio>
 #include <vector>
 
-
-template<typename genType>
-void print(genType const& Mat0)
-{
-	printf("mat4(\n");
-	printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast<double>(Mat0[0][0]), static_cast<double>(Mat0[0][1]), static_cast<double>(Mat0[0][2]), static_cast<double>(Mat0[0][3]));
-	printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast<double>(Mat0[1][0]), static_cast<double>(Mat0[1][1]), static_cast<double>(Mat0[1][2]), static_cast<double>(Mat0[1][3]));
-	printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast<double>(Mat0[2][0]), static_cast<double>(Mat0[2][1]), static_cast<double>(Mat0[2][2]), static_cast<double>(Mat0[2][3]));
-	printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f))\n\n", static_cast<double>(Mat0[3][0]), static_cast<double>(Mat0[3][1]), static_cast<double>(Mat0[3][2]), static_cast<double>(Mat0[3][3]));
-}
-
-int test_inverse_mat4x4()
+template <typename matType, typename vecType>
+static int test_operators()
 {
-	glm::mat4 Mat0(
-		glm::vec4(0.6f, 0.2f, 0.3f, 0.4f), 
-		glm::vec4(0.2f, 0.7f, 0.5f, 0.3f), 
-		glm::vec4(0.3f, 0.5f, 0.7f, 0.2f), 
-		glm::vec4(0.4f, 0.3f, 0.2f, 0.6f));
-	glm::mat4 Inv0 = glm::inverse(Mat0);
-	glm::mat4 Res0 = Mat0 * Inv0;
-
-	print(Mat0);
-	print(Inv0);
-	print(Res0);
-
-	return 0;
-}
-
-int test_inverse_dmat4x4()
-{
-	glm::dmat4 Mat0(
-		glm::dvec4(0.6f, 0.2f, 0.3f, 0.4f), 
-		glm::dvec4(0.2f, 0.7f, 0.5f, 0.3f), 
-		glm::dvec4(0.3f, 0.5f, 0.7f, 0.2f), 
-		glm::dvec4(0.4f, 0.3f, 0.2f, 0.6f));
-	glm::dmat4 Inv0 = glm::inverse(Mat0);
-	glm::dmat4 Res0 = Mat0 * Inv0;
-
-	print(Mat0);
-	print(Inv0);
-	print(Res0);
-
-	return 0;
-}
-
-static bool test_operators()
-{
-	glm::mat4x4 l(1.0f);
-	glm::mat4x4 m(1.0f);
-	glm::vec4 u(1.0f);
-	glm::vec4 v(1.0f);
-	float x = 1.0f;
-	glm::vec4 a = m * u;
-	glm::vec4 b = v * m;
-	glm::mat4x4 n = x / m;
-	glm::mat4x4 o = m / x;
-	glm::mat4x4 p = x * m;
-	glm::mat4x4 q = m * x;
-	bool R = glm::any(glm::notEqual(m, q, glm::epsilon<float>()));
-	bool S = glm::all(glm::equal(m, l, glm::epsilon<float>()));
-
-	return (S && !R) ? 0 : 1;
-}
-
-int test_inverse()
-{
-	int Error(0);
+	int Error = 0;
+	
+	float const Epsilon = 0.001f;
+	
+	glm::mat4x4 const M(2.0f);
+	glm::mat4x4 const N(1.0f);
+	glm::vec4 const U(2.0f);
 
 	{
-		glm::mat4 const Matrix(
-			glm::vec4(0.6f, 0.2f, 0.3f, 0.4f), 
-			glm::vec4(0.2f, 0.7f, 0.5f, 0.3f), 
-			glm::vec4(0.3f, 0.5f, 0.7f, 0.2f), 
-			glm::vec4(0.4f, 0.3f, 0.2f, 0.6f));
-		glm::mat4 const Inverse = glm::inverse(Matrix);
-		glm::mat4 const Identity = Matrix * Inverse;
-
-		print(Matrix);
-		print(Inverse);
-		print(Identity);
-
-		Error += glm::all(glm::epsilonEqual(Identity[0], glm::vec4(1.0f, 0.0f, 0.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[1], glm::vec4(0.0f, 1.0f, 0.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[2], glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[3], glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), glm::vec4(0.01f))) ? 0 : 1;
+		glm::mat4 const P = N * 2.0f;
+		Error += glm::all(glm::equal(P, M, Epsilon)) ? 0 : 1;
+		
+		glm::mat4 const Q = M / 2.0f;
+		Error += glm::all(glm::equal(Q, N, Epsilon)) ? 0 : 1;
 	}
-
+	
 	{
-		glm::highp_mat4 const Matrix(
-			glm::highp_vec4(0.6f, 0.2f, 0.3f, 0.4f), 
-			glm::highp_vec4(0.2f, 0.7f, 0.5f, 0.3f), 
-			glm::highp_vec4(0.3f, 0.5f, 0.7f, 0.2f), 
-			glm::highp_vec4(0.4f, 0.3f, 0.2f, 0.6f));
-		glm::highp_mat4 const Inverse = glm::inverse(Matrix);
-		glm::highp_mat4 const Identity = Matrix * Inverse;
-
-		printf("highp_mat4 inverse\n");
-		print(Matrix);
-		print(Inverse);
-		print(Identity);
-
-		Error += glm::all(glm::epsilonEqual(Identity[0], glm::highp_vec4(1.0f, 0.0f, 0.0f, 0.0f), glm::highp_vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[1], glm::highp_vec4(0.0f, 1.0f, 0.0f, 0.0f), glm::highp_vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[2], glm::highp_vec4(0.0f, 0.0f, 1.0f, 0.0f), glm::highp_vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[3], glm::highp_vec4(0.0f, 0.0f, 0.0f, 1.0f), glm::highp_vec4(0.01f))) ? 0 : 1;
+		glm::vec4 const V = M * U;
+		Error += glm::all(glm::equal(V, glm::vec4(4.f), Epsilon)) ? 0 : 1;
+		
+		glm::vec4 const W = U / M;
+		Error += glm::all(glm::equal(V, W, Epsilon)) ? 0 : 1;
 	}
 
 	{
-		glm::mediump_mat4 const Matrix(
-			glm::mediump_vec4(0.6f, 0.2f, 0.3f, 0.4f), 
-			glm::mediump_vec4(0.2f, 0.7f, 0.5f, 0.3f), 
-			glm::mediump_vec4(0.3f, 0.5f, 0.7f, 0.2f), 
-			glm::mediump_vec4(0.4f, 0.3f, 0.2f, 0.6f));
-		glm::mediump_mat4 const Inverse = glm::inverse(Matrix);
-		glm::mediump_mat4 const Identity = Matrix * Inverse;
-
-		printf("mediump_mat4 inverse\n");
-		print(Matrix);
-		print(Inverse);
-		print(Identity);
-
-		Error += glm::all(glm::epsilonEqual(Identity[0], glm::mediump_vec4(1.0f, 0.0f, 0.0f, 0.0f), glm::mediump_vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[1], glm::mediump_vec4(0.0f, 1.0f, 0.0f, 0.0f), glm::mediump_vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[2], glm::mediump_vec4(0.0f, 0.0f, 1.0f, 0.0f), glm::mediump_vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[3], glm::mediump_vec4(0.0f, 0.0f, 0.0f, 1.0f), glm::mediump_vec4(0.01f))) ? 0 : 1;
+		glm::mat4 const O = M * N;
+		Error += glm::all(glm::equal(O, glm::mat4(4.f), Epsilon)) ? 0 : 1;
 	}
 
-	{
-		glm::lowp_mat4 const Matrix(
-			glm::lowp_vec4(0.6f, 0.2f, 0.3f, 0.4f), 
-			glm::lowp_vec4(0.2f, 0.7f, 0.5f, 0.3f), 
-			glm::lowp_vec4(0.3f, 0.5f, 0.7f, 0.2f), 
-			glm::lowp_vec4(0.4f, 0.3f, 0.2f, 0.6f));
-		glm::lowp_mat4 const Inverse = glm::inverse(Matrix);
-		glm::lowp_mat4 const Identity = Matrix * Inverse;
-
-		printf("lowp_mat4 inverse\n");
-		print(Matrix);
-		print(Inverse);
-		print(Identity);
-
-		Error += glm::all(glm::epsilonEqual(Identity[0], glm::lowp_vec4(1.0f, 0.0f, 0.0f, 0.0f), glm::lowp_vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[1], glm::lowp_vec4(0.0f, 1.0f, 0.0f, 0.0f), glm::lowp_vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[2], glm::lowp_vec4(0.0f, 0.0f, 1.0f, 0.0f), glm::lowp_vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[3], glm::lowp_vec4(0.0f, 0.0f, 0.0f, 1.0f), glm::lowp_vec4(0.01f))) ? 0 : 1;
-	}
+	return Error;
+}
 
-	{
-		glm::mat4 const Matrix(
-			glm::vec4(0.6f, 0.2f, 0.3f, 0.4f), 
-			glm::vec4(0.2f, 0.7f, 0.5f, 0.3f), 
-			glm::vec4(0.3f, 0.5f, 0.7f, 0.2f), 
-			glm::vec4(0.4f, 0.3f, 0.2f, 0.6f));
-		glm::mat4 const Identity = Matrix / Matrix;
-
-		Error += glm::all(glm::epsilonEqual(Identity[0], glm::vec4(1.0f, 0.0f, 0.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[1], glm::vec4(0.0f, 1.0f, 0.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[2], glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
-		Error += glm::all(glm::epsilonEqual(Identity[3], glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), glm::vec4(0.01f))) ? 0 : 1;
-	}
+template <typename matType>
+static int test_inverse()
+{
+	typedef typename matType::value_type value_type;
+	
+	int Error = 0;
+
+	matType const Identity(1.0f);
+	matType const Matrix(
+		glm::vec4(0.6f, 0.2f, 0.3f, 0.4f),
+		glm::vec4(0.2f, 0.7f, 0.5f, 0.3f),
+		glm::vec4(0.3f, 0.5f, 0.7f, 0.2f),
+		glm::vec4(0.4f, 0.3f, 0.2f, 0.6f));
+	matType const Inverse = Identity / Matrix;
+	matType const Result = Matrix * Inverse;
 
+	value_type const Epsilon(0.001);
+	Error += glm::all(glm::equal(Identity, Result, Epsilon)) ? 0 : 1;
+	
 	return Error;
 }
 
-int test_ctr()
+static int test_ctr()
 {
 	int Error = 0;
 
@@ -191,7 +76,7 @@ int test_ctr()
 #endif
 
 #if GLM_HAS_INITIALIZER_LISTS
-	glm::mat4 m0(
+	glm::mat4 const m0(
 		glm::vec4(0, 1, 2, 3),
 		glm::vec4(4, 5, 6, 7),
 		glm::vec4(8, 9, 10, 11),
@@ -199,11 +84,11 @@ int test_ctr()
 
 	assert(sizeof(m0) == 4 * 4 * 4);
 
-	glm::vec4 V{0, 1, 2, 3};
+	glm::vec4 const V{0, 1, 2, 3};
 
-	glm::mat4 m1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+	glm::mat4 const m1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
 
-	glm::mat4 m2{
+	glm::mat4 const m2{
 		{0, 1, 2, 3},
 		{4, 5, 6, 7},
 		{8, 9, 10, 11},
@@ -213,13 +98,13 @@ int test_ctr()
 	Error += glm::all(glm::equal(m1, m2, glm::epsilon<float>())) ? 0 : 1;
 
 
-	std::vector<glm::mat4> m3{
+	std::vector<glm::mat4> const m3{
 		{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
 		{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
 		{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
 		{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}};
 
-	glm::mat4 m4{
+	glm::mat4 const m4{
 		{1, 0, 0, 0},
 		{0, 1, 0, 0},
 		{0, 0, 1, 0},
@@ -228,11 +113,11 @@ int test_ctr()
 	Error += glm::equal(m4[0][0], 1.0f, 0.0001f) ? 0 : 1;
 	Error += glm::equal(m4[3][3], 1.0f, 0.0001f) ? 0 : 1;
 
-	std::vector<glm::mat4> v1{
+	std::vector<glm::mat4> const v1{
 		{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
 		{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}};
 
-	std::vector<glm::mat4> v2{
+	std::vector<glm::mat4> const v2{
 		{
 			{ 0, 1, 2, 3 },
 			{ 4, 5, 6, 7 },
@@ -251,57 +136,22 @@ int test_ctr()
 	return Error;
 }
 
-int perf_mul()
+static int test_member_alloc_bug()
 {
 	int Error = 0;
-
-
-
-	return Error;
-}
-
-namespace cast
-{
-	template<typename genType>
-	int entry()
-	{
-		int Error = 0;
-
-		genType A(1.0f);
-		glm::mat4x4 B(A);
-		glm::mat4x4 Identity(1.0f);
-
-		for(glm::length_t i = 0, length = B.length(); i < length; ++i)
-			Error += glm::all(glm::epsilonEqual(B[i], Identity[i], glm::epsilon<float>())) ? 0 : 1;
-
-		return Error;
-	}
-
-	int test()
+	
+	struct repro
 	{
-		int Error = 0;
+		repro(){ this->matrix = new glm::mat4(); }
+		~repro(){delete this->matrix;}
 		
-		Error += entry<glm::mat2x2>();
-		Error += entry<glm::mat2x3>();
-		Error += entry<glm::mat2x4>();
-		Error += entry<glm::mat3x2>();
-		Error += entry<glm::mat3x3>();
-		Error += entry<glm::mat3x4>();
-		Error += entry<glm::mat4x2>();
-		Error += entry<glm::mat4x3>();
-		Error += entry<glm::mat4x4>();
-
-		return Error;
-	}
-}//namespace cast
-
-struct repro
-{
-	repro(){ this->matrix = new glm::mat4(); }
-	~repro(){delete this->matrix;}
-
-	glm::mat4* matrix;
-};
+		glm::mat4* matrix;
+	};
+	
+	repro Repro;
+	
+	return Error;
+}
 
 static int test_size()
 {
@@ -319,8 +169,6 @@ static int test_size()
 
 static int test_constexpr()
 {
-	glm::mat4 const I(1.0f);
-
 #if GLM_HAS_CONSTEXPR
 	static_assert(glm::mat4::length() == 4, "GLM: Failed constexpr");
 #endif
@@ -332,18 +180,27 @@ int main()
 {
 	int Error = 0;
 
-	repro Repro;
-
-	Error += cast::test();
+	Error += test_member_alloc_bug();
+	
 	Error += test_ctr();
-	Error += test_inverse_dmat4x4();
-	Error += test_inverse_mat4x4();
-	Error += test_operators();
-	Error += test_inverse();
+	
+	Error += test_operators<glm::mat4, glm::vec4>();
+	Error += test_operators<glm::lowp_mat4, glm::lowp_vec4>();
+	Error += test_operators<glm::mediump_mat4, glm::mediump_vec4>();
+	Error += test_operators<glm::highp_mat4, glm::highp_vec4>();
+	
+	Error += test_inverse<glm::mat4>();
+	Error += test_inverse<glm::lowp_mat4>();
+	Error += test_inverse<glm::mediump_mat4>();
+	Error += test_inverse<glm::highp_mat4>();
+	
+	Error += test_inverse<glm::dmat4>();
+	Error += test_inverse<glm::lowp_dmat4>();
+	Error += test_inverse<glm::mediump_dmat4>();
+	Error += test_inverse<glm::highp_dmat4>();
+	
 	Error += test_size();
 	Error += test_constexpr();
 
-	Error += perf_mul();
-
 	return Error;
 }

+ 2 - 0
test/gtc/gtc_quaternion.cpp

@@ -1,7 +1,9 @@
 #include <glm/gtc/constants.hpp>
 #include <glm/gtc/quaternion.hpp>
 #include <glm/gtc/matrix_transform.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/glm.hpp>
 #include <vector>
 

+ 1 - 0
test/gtx/gtx_extended_min_max.cpp

@@ -3,6 +3,7 @@
 #include <glm/gtx/extended_min_max.hpp>
 #include <glm/gtc/vec1.hpp>
 #include <glm/gtc/constants.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
 
 // This file has divisions by zero to test isnan

+ 1 - 0
test/gtx/gtx_range.cpp

@@ -1,5 +1,6 @@
 #define GLM_ENABLE_EXPERIMENTAL
 #include <glm/gtc/constants.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
 #include <glm/glm.hpp>
 

+ 2 - 0
test/gtx/gtx_scalar_relational.cpp

@@ -1,7 +1,9 @@
 #define GLM_ENABLE_EXPERIMENTAL
 #include <glm/gtx/scalar_relational.hpp>
 #include <glm/gtc/constants.hpp>
+#include <glm/ext/scalar_relational.hpp>
 #include <glm/ext/vector_relational.hpp>
+#include <glm/ext/matrix_relational.hpp>
 #include <glm/glm.hpp>
 
 static int test_lessThan()