Browse Source

Fixed inverse link error when using namespace glm; (#147)

Christophe Riccio 12 years ago
parent
commit
aa26672da1

+ 5 - 5
glm/detail/_noise.hpp

@@ -35,31 +35,31 @@ namespace detail
 	template <typename T>
 	template <typename T>
 	GLM_FUNC_QUALIFIER T mod289(T const & x)
 	GLM_FUNC_QUALIFIER T mod289(T const & x)
 	{
 	{
-		return x - floor(x * T(1.0 / 289.0)) * T(289.0);
+		return x - floor(x * static_cast<T>(1.0) / static_cast<T>(289.0)) * static_cast<T>(289.0);
 	}
 	}
 
 
 	template <typename T>
 	template <typename T>
 	GLM_FUNC_QUALIFIER T permute(T const & x)
 	GLM_FUNC_QUALIFIER T permute(T const & x)
 	{
 	{
-		return mod289(((x * T(34)) + T(1)) * x);
+		return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec2<T, P> permute(tvec2<T, P> const & x)
 	GLM_FUNC_QUALIFIER tvec2<T, P> permute(tvec2<T, P> const & x)
 	{
 	{
-		return mod289(((x * T(34)) + T(1)) * x);
+		return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
 	}
 	}
 	
 	
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec3<T, P> permute(tvec3<T, P> const & x)
 	GLM_FUNC_QUALIFIER tvec3<T, P> permute(tvec3<T, P> const & x)
 	{
 	{
-		return mod289(((x * T(34)) + T(1)) * x);
+		return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
 	}
 	}
 	
 	
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec4<T, P> permute(tvec4<T, P> const & x)
 	GLM_FUNC_QUALIFIER tvec4<T, P> permute(tvec4<T, P> const & x)
 	{
 	{
-		return mod289(((x * T(34)) + T(1)) * x);
+		return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
 	}
 	}
 /*
 /*
 	template <typename T, precision P, template<typename> class vecType>
 	template <typename T, precision P, template<typename> class vecType>

+ 3 - 5
glm/detail/type_mat2x2.hpp

@@ -50,8 +50,6 @@ namespace detail
 
 
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 
 
-		template <typename U, precision Q>
-		friend tmat2x2<U, Q> inverse(tmat2x2<U, Q> const & m);
 		template <typename U, precision Q>
 		template <typename U, precision Q>
 		friend tvec2<U, Q> operator/(tmat2x2<U, Q> const & m, tvec2<U, Q> const & v);
 		friend tvec2<U, Q> operator/(tmat2x2<U, Q> const & m, tvec2<U, Q> const & v);
 		template <typename U, precision Q>
 		template <typename U, precision Q>
@@ -60,8 +58,6 @@ namespace detail
 	private:
 	private:
 		/// @cond DETAIL
 		/// @cond DETAIL
 		col_type value[2];
 		col_type value[2];
-
-		GLM_FUNC_DECL tmat2x2<T, P> _inverse() const;
 		/// @endcond
 		/// @endcond
 		
 		
 	public:
 	public:
@@ -152,8 +148,10 @@ namespace detail
 		GLM_FUNC_DECL tmat2x2<T, P> operator--(int);
 		GLM_FUNC_DECL tmat2x2<T, P> operator--(int);
 	};
 	};
 
 
-	// Binary operators
+	template <typename T, precision P>
+	GLM_FUNC_DECL tmat2x2<T, P> compute_inverse_mat2(tmat2x2<T, P> const & m);
 
 
+	// Binary operators
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_DECL tmat2x2<T, P> operator+ (
 	GLM_FUNC_DECL tmat2x2<T, P> operator+ (
 		tmat2x2<T, P> const & m,
 		tmat2x2<T, P> const & m,

+ 15 - 16
glm/detail/type_mat2x2.inl

@@ -272,19 +272,6 @@ namespace detail
 		this->value[1] = col_type(m[1]);
 		this->value[1] = col_type(m[1]);
 	}
 	}
 
 
-	template <typename T, precision P> 
-	GLM_FUNC_QUALIFIER tmat2x2<T, P> tmat2x2<T, P>::_inverse() const
-	{
-		T Determinant = this->value[0][0] * this->value[1][1] - this->value[1][0] * this->value[0][1];
-
-		tmat2x2<T, P> Inverse(
-			+ this->value[1][1] / Determinant,
-			- this->value[0][1] / Determinant,
-			- this->value[1][0] / Determinant,
-			+ this->value[0][0] / Determinant);
-		return Inverse;
-	}
-
 	//////////////////////////////////////////////////////////////
 	//////////////////////////////////////////////////////////////
 	// mat2x2 operators
 	// mat2x2 operators
 
 
@@ -371,7 +358,7 @@ namespace detail
 	template <typename U>
 	template <typename U>
 	GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/= (tmat2x2<U, P> const & m)
 	GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/= (tmat2x2<U, P> const & m)
 	{
 	{
-		return (*this = *this * m._inverse());
+		return (*this = *this * compute_inverse_mat2(m));
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -406,6 +393,18 @@ namespace detail
 		return Result;
 		return Result;
 	}
 	}
 
 
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tmat2x2<T, P> compute_inverse_mat2(tmat2x2<T, P> const & m)
+	{
+		T Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
+
+		tmat2x2<T, P> Inverse(
+			+ m[1][1] / Determinant, - m[0][1] / Determinant,
+			- m[1][0] / Determinant, + m[0][0] / Determinant);
+
+		return Inverse;
+	}
+
 	//////////////////////////////////////////////////////////////
 	//////////////////////////////////////////////////////////////
 	// Binary operators
 	// Binary operators
 
 
@@ -608,7 +607,7 @@ namespace detail
 		typename tmat2x2<T, P>::row_type & v
 		typename tmat2x2<T, P>::row_type & v
 	)
 	)
 	{
 	{
-		return m._inverse() * v;
+		return detail::compute_inverse_mat2(m) * v;
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -618,7 +617,7 @@ namespace detail
 		tmat2x2<T, P> const & m
 		tmat2x2<T, P> const & m
 	)
 	)
 	{
 	{
-		return v * m._inverse();
+		return v * detail::compute_inverse_mat2(m);
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>

+ 3 - 4
glm/detail/type_mat3x3.hpp

@@ -50,8 +50,6 @@ namespace detail
 
 
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 
 
-		template <typename U, precision Q>
-		friend tmat3x3<U, Q> inverse(tmat3x3<U, Q> const & m);
 		template <typename U, precision Q>
 		template <typename U, precision Q>
 		friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
 		friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
 		template <typename U, precision Q>
 		template <typename U, precision Q>
@@ -60,8 +58,6 @@ namespace detail
 	private:
 	private:
 		/// @cond DETAIL
 		/// @cond DETAIL
 		col_type value[3];
 		col_type value[3];
-
-		GLM_FUNC_DECL tmat3x3<T, P> _inverse() const;
 		/// @endcond
 		/// @endcond
 		
 		
 	public:
 	public:
@@ -155,6 +151,9 @@ namespace detail
 		GLM_FUNC_DECL tmat3x3<T, P> operator--(int);
 		GLM_FUNC_DECL tmat3x3<T, P> operator--(int);
 	};
 	};
 
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tmat3x3<T, P> compute_inverse_mat3(tmat3x3<T, P> const & m);
+
 	// Binary operators
 	// Binary operators
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_DECL tmat3x3<T, P> operator+ (
 	GLM_FUNC_DECL tmat3x3<T, P> operator+ (

+ 17 - 16
glm/detail/type_mat3x3.inl

@@ -393,7 +393,7 @@ namespace detail
 	template <typename U>
 	template <typename U>
 	GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/= (tmat3x3<U, P> const & m)
 	GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/= (tmat3x3<U, P> const & m)
 	{
 	{
-		return (*this = *this * m._inverse());
+		return (*this = *this * detail::compute_inverse_mat3(m));
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -431,19 +431,19 @@ namespace detail
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tmat3x3<T, P> tmat3x3<T, P>::_inverse() const
+	GLM_FUNC_QUALIFIER tmat3x3<T, P> compute_inverse_mat3(tmat3x3<T, P> const & m)
 	{
 	{
-		T S00 = value[0][0];
-		T S01 = value[0][1];
-		T S02 = value[0][2];
+		T S00 = m[0][0];
+		T S01 = m[0][1];
+		T S02 = m[0][2];
 
 
-		T S10 = value[1][0];
-		T S11 = value[1][1];
-		T S12 = value[1][2];
+		T S10 = m[1][0];
+		T S11 = m[1][1];
+		T S12 = m[1][2];
 
 
-		T S20 = value[2][0];
-		T S21 = value[2][1];
-		T S22 = value[2][2];
+		T S20 = m[2][0];
+		T S21 = m[2][1];
+		T S22 = m[2][2];
 /*
 /*
 		tmat3x3<T, P> Inverse(
 		tmat3x3<T, P> Inverse(
 			+ (S11 * S22 - S21 * S12),
 			+ (S11 * S22 - S21 * S12),
@@ -467,9 +467,10 @@ namespace detail
 			S10 * S02 - S12 * S00,
 			S10 * S02 - S12 * S00,
 			S11 * S00 - S10 * S01);
 			S11 * S00 - S10 * S01);
 
 
-		T Determinant = S00 * (S11 * S22 - S21 * S12)
-						- S10 * (S01 * S22 - S21 * S02)
-						+ S20 * (S01 * S12 - S11 * S02);
+		T Determinant = 
+			+ S00 * (S11 * S22 - S21 * S12)
+			- S10 * (S01 * S22 - S21 * S02)
+			+ S20 * (S01 * S12 - S11 * S02);
 
 
 		Inverse /= Determinant;
 		Inverse /= Determinant;
 		return Inverse;
 		return Inverse;
@@ -719,7 +720,7 @@ namespace detail
 		typename tmat3x3<T, P>::row_type const & v
 		typename tmat3x3<T, P>::row_type const & v
 	)
 	)
 	{
 	{
-		return m._inverse() * v;
+		return detail::compute_inverse_mat3(m) * v;
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -729,7 +730,7 @@ namespace detail
 		tmat3x3<T, P> const & m
 		tmat3x3<T, P> const & m
 	)
 	)
 	{
 	{
-		return v * m._inverse();
+		return v * detail::compute_inverse_mat3(m);
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>

+ 3 - 5
glm/detail/type_mat4x4.hpp

@@ -54,8 +54,6 @@ namespace detail
 
 
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 
 
-		template <typename U, precision Q>
-		friend tmat4x4<U, Q> inverse(tmat4x4<U, Q> const & m);
 		template <typename U, precision Q>
 		template <typename U, precision Q>
 		friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
 		friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
 		template <typename U, precision Q>
 		template <typename U, precision Q>
@@ -64,9 +62,6 @@ namespace detail
 	private:
 	private:
 		/// @cond DETAIL
 		/// @cond DETAIL
 		col_type value[4];
 		col_type value[4];
-		
-		GLM_FUNC_DECL tmat4x4<T, P> _inverse() const;
-		/// @endcond
 
 
 	public:
 	public:
 		// Constructors
 		// Constructors
@@ -165,6 +160,9 @@ namespace detail
 		GLM_FUNC_DECL tmat4x4<T, P> operator--(int);
 		GLM_FUNC_DECL tmat4x4<T, P> operator--(int);
 	};
 	};
 
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tmat4x4<T, P> compute_inverse_mat4(tmat4x4<T, P> const & m);
+
 	// Binary operators
 	// Binary operators
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_DECL tmat4x4<T, P> operator+ (
 	GLM_FUNC_DECL tmat4x4<T, P> operator+ (

+ 44 - 72
glm/detail/type_mat4x4.inl

@@ -66,8 +66,8 @@ namespace detail
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4()
 	GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4()
 	{
 	{
-		value_type Zero(0);
-		value_type One(1);
+		T Zero(0);
+		T One(1);
 		this->value[0] = col_type(One, Zero, Zero, Zero);
 		this->value[0] = col_type(One, Zero, Zero, Zero);
 		this->value[1] = col_type(Zero, One, Zero, Zero);
 		this->value[1] = col_type(Zero, One, Zero, Zero);
 		this->value[2] = col_type(Zero, Zero, One, Zero);
 		this->value[2] = col_type(Zero, Zero, One, Zero);
@@ -461,7 +461,7 @@ namespace detail
 	template <typename U>
 	template <typename U>
 	GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/= (tmat4x4<U, P> const & m)
 	GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/= (tmat4x4<U, P> const & m)
 	{
 	{
-		return (*this = *this * m._inverse());
+		return (*this = *this * detail::compute_inverse_mat4(m));
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -501,76 +501,48 @@ namespace detail
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tmat4x4<T, P> tmat4x4<T, P>::_inverse() const
+	GLM_FUNC_QUALIFIER tmat4x4<T, P> compute_inverse_mat4(tmat4x4<T, P> const & m)
 	{
 	{
 		// Calculate all mat2 determinants
 		// Calculate all mat2 determinants
-		value_type SubFactor00 = this->value[2][2] * this->value[3][3] - this->value[3][2] * this->value[2][3];
-		value_type SubFactor01 = this->value[2][1] * this->value[3][3] - this->value[3][1] * this->value[2][3];
-		value_type SubFactor02 = this->value[2][1] * this->value[3][2] - this->value[3][1] * this->value[2][2];
-		value_type SubFactor03 = this->value[2][0] * this->value[3][3] - this->value[3][0] * this->value[2][3];
-		value_type SubFactor04 = this->value[2][0] * this->value[3][2] - this->value[3][0] * this->value[2][2];
-		value_type SubFactor05 = this->value[2][0] * this->value[3][1] - this->value[3][0] * this->value[2][1];
-		value_type SubFactor06 = this->value[1][2] * this->value[3][3] - this->value[3][2] * this->value[1][3];
-		value_type SubFactor07 = this->value[1][1] * this->value[3][3] - this->value[3][1] * this->value[1][3];
-		value_type SubFactor08 = this->value[1][1] * this->value[3][2] - this->value[3][1] * this->value[1][2];
-		value_type SubFactor09 = this->value[1][0] * this->value[3][3] - this->value[3][0] * this->value[1][3];
-		value_type SubFactor10 = this->value[1][0] * this->value[3][2] - this->value[3][0] * this->value[1][2];
-		value_type SubFactor11 = this->value[1][1] * this->value[3][3] - this->value[3][1] * this->value[1][3];
-		value_type SubFactor12 = this->value[1][0] * this->value[3][1] - this->value[3][0] * this->value[1][1];
-		value_type SubFactor13 = this->value[1][2] * this->value[2][3] - this->value[2][2] * this->value[1][3];
-		value_type SubFactor14 = this->value[1][1] * this->value[2][3] - this->value[2][1] * this->value[1][3];
-		value_type SubFactor15 = this->value[1][1] * this->value[2][2] - this->value[2][1] * this->value[1][2];
-		value_type SubFactor16 = this->value[1][0] * this->value[2][3] - this->value[2][0] * this->value[1][3];
-		value_type SubFactor17 = this->value[1][0] * this->value[2][2] - this->value[2][0] * this->value[1][2];
-		value_type SubFactor18 = this->value[1][0] * this->value[2][1] - this->value[2][0] * this->value[1][1];
-/*
-		tmat4x4<T, P> Inverse(
-			+ (this->value[1][1] * SubFactor00 - this->value[1][2] * SubFactor01 + this->value[1][3] * SubFactor02),
-			- (this->value[1][0] * SubFactor00 - this->value[1][2] * SubFactor03 + this->value[1][3] * SubFactor04),
-			+ (this->value[1][0] * SubFactor01 - this->value[1][1] * SubFactor03 + this->value[1][3] * SubFactor05),
-			- (this->value[1][0] * SubFactor02 - this->value[1][1] * SubFactor04 + this->value[1][2] * SubFactor05),
-
-			- (this->value[0][1] * SubFactor00 - this->value[0][2] * SubFactor01 + this->value[0][3] * SubFactor02),
-			+ (this->value[0][0] * SubFactor00 - this->value[0][2] * SubFactor03 + this->value[0][3] * SubFactor04),
-			- (this->value[0][0] * SubFactor01 - this->value[0][1] * SubFactor03 + this->value[0][3] * SubFactor05),
-			+ (this->value[0][0] * SubFactor02 - this->value[0][1] * SubFactor04 + this->value[0][2] * SubFactor05),
-
-			+ (this->value[0][1] * SubFactor06 - this->value[0][2] * SubFactor07 + this->value[0][3] * SubFactor08),
-			- (this->value[0][0] * SubFactor06 - this->value[0][2] * SubFactor09 + this->value[0][3] * SubFactor10),
-			+ (this->value[0][0] * SubFactor11 - this->value[0][1] * SubFactor09 + this->value[0][3] * SubFactor12),
-			- (this->value[0][0] * SubFactor08 - this->value[0][1] * SubFactor10 + this->value[0][2] * SubFactor12),
-
-			- (this->value[0][1] * SubFactor13 - this->value[0][2] * SubFactor14 + this->value[0][3] * SubFactor15),
-			+ (this->value[0][0] * SubFactor13 - this->value[0][2] * SubFactor16 + this->value[0][3] * SubFactor17),
-			- (this->value[0][0] * SubFactor14 - this->value[0][1] * SubFactor16 + this->value[0][3] * SubFactor18),
-			+ (this->value[0][0] * SubFactor15 - this->value[0][1] * SubFactor17 + this->value[0][2] * SubFactor18));
-*/
+		T const SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
+		T const SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
+		T const SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
+		T const SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
+		T const SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
+		T const SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
+		T const SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
+		T const SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
+		T const SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
+		T const SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
+		T const SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
+		T const SubFactor11 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
+		T const SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
+		T const SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
+		T const SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
+		T const SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
+		T const SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
+		T const SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
+		T const SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
+
 		tmat4x4<T, P> Inverse(
 		tmat4x4<T, P> Inverse(
-			+ this->value[1][1] * SubFactor00 - this->value[1][2] * SubFactor01 + this->value[1][3] * SubFactor02,
-			- this->value[1][0] * SubFactor00 + this->value[1][2] * SubFactor03 - this->value[1][3] * SubFactor04,
-			+ this->value[1][0] * SubFactor01 - this->value[1][1] * SubFactor03 + this->value[1][3] * SubFactor05,
-			- this->value[1][0] * SubFactor02 + this->value[1][1] * SubFactor04 - this->value[1][2] * SubFactor05,
-
-			- this->value[0][1] * SubFactor00 + this->value[0][2] * SubFactor01 - this->value[0][3] * SubFactor02,
-			+ this->value[0][0] * SubFactor00 - this->value[0][2] * SubFactor03 + this->value[0][3] * SubFactor04,
-			- this->value[0][0] * SubFactor01 + this->value[0][1] * SubFactor03 - this->value[0][3] * SubFactor05,
-			+ this->value[0][0] * SubFactor02 - this->value[0][1] * SubFactor04 + this->value[0][2] * SubFactor05,
-
-			+ this->value[0][1] * SubFactor06 - this->value[0][2] * SubFactor07 + this->value[0][3] * SubFactor08,
-			- this->value[0][0] * SubFactor06 + this->value[0][2] * SubFactor09 - this->value[0][3] * SubFactor10,
-			+ this->value[0][0] * SubFactor11 - this->value[0][1] * SubFactor09 + this->value[0][3] * SubFactor12,
-			- this->value[0][0] * SubFactor08 + this->value[0][1] * SubFactor10 - this->value[0][2] * SubFactor12,
-
-			- this->value[0][1] * SubFactor13 + this->value[0][2] * SubFactor14 - this->value[0][3] * SubFactor15,
-			+ this->value[0][0] * SubFactor13 - this->value[0][2] * SubFactor16 + this->value[0][3] * SubFactor17,
-			- this->value[0][0] * SubFactor14 + this->value[0][1] * SubFactor16 - this->value[0][3] * SubFactor18,
-			+ this->value[0][0] * SubFactor15 - this->value[0][1] * SubFactor17 + this->value[0][2] * SubFactor18);
-
-		T Determinant = static_cast<T>(
-			+ this->value[0][0] * Inverse[0][0]
-			+ this->value[0][1] * Inverse[1][0]
-			+ this->value[0][2] * Inverse[2][0]
-			+ this->value[0][3] * Inverse[3][0]);
+			+ m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02,
+			- m[1][0] * SubFactor00 + m[1][2] * SubFactor03 - m[1][3] * SubFactor04,
+			+ m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05,
+			- m[1][0] * SubFactor02 + m[1][1] * SubFactor04 - m[1][2] * SubFactor05,
+			- m[0][1] * SubFactor00 + m[0][2] * SubFactor01 - m[0][3] * SubFactor02,
+			+ m[0][0] * SubFactor00 - m[0][2] * SubFactor03 + m[0][3] * SubFactor04,
+			- m[0][0] * SubFactor01 + m[0][1] * SubFactor03 - m[0][3] * SubFactor05,
+			+ m[0][0] * SubFactor02 - m[0][1] * SubFactor04 + m[0][2] * SubFactor05,
+			+ m[0][1] * SubFactor06 - m[0][2] * SubFactor07 + m[0][3] * SubFactor08,
+			- m[0][0] * SubFactor06 + m[0][2] * SubFactor09 - m[0][3] * SubFactor10,
+			+ m[0][0] * SubFactor11 - m[0][1] * SubFactor09 + m[0][3] * SubFactor12,
+			- m[0][0] * SubFactor08 + m[0][1] * SubFactor10 - m[0][2] * SubFactor12,
+			- m[0][1] * SubFactor13 + m[0][2] * SubFactor14 - m[0][3] * SubFactor15,
+			+ m[0][0] * SubFactor13 - m[0][2] * SubFactor16 + m[0][3] * SubFactor17,
+			- m[0][0] * SubFactor14 + m[0][1] * SubFactor16 - m[0][3] * SubFactor18,
+			+ m[0][0] * SubFactor15 - m[0][1] * SubFactor17 + m[0][2] * SubFactor18);
+		
+		T Determinant = static_cast<T>(+ m[0][0] * Inverse[0][0] + m[0][1] * Inverse[1][0] + m[0][2] * Inverse[2][0] + m[0][3] * Inverse[3][0]);
 
 
 		Inverse /= Determinant;
 		Inverse /= Determinant;
 		return Inverse;
 		return Inverse;
@@ -851,7 +823,7 @@ namespace detail
 		typename tmat4x4<T, P>::row_type const & v
 		typename tmat4x4<T, P>::row_type const & v
 	)
 	)
 	{
 	{
-		return m._inverse() * v;
+		return detail::compute_inverse_mat4(m) * v;
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -861,7 +833,7 @@ namespace detail
 		tmat4x4<T, P> const & m
 		tmat4x4<T, P> const & m
 	)
 	)
 	{
 	{
-		return v * m._inverse();
+		return v * detail::compute_inverse_mat4(m);
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>

+ 1 - 0
readme.txt

@@ -44,6 +44,7 @@ GLM 0.9.5.1: 2014-XX-XX
 - Added possible static_cast conversion of GLM types (#72)
 - Added possible static_cast conversion of GLM types (#72)
 - Fixed error 'inverse' is not a member of 'glm' from glm::unProject (#146)
 - Fixed error 'inverse' is not a member of 'glm' from glm::unProject (#146)
 - Fixed mismatch between some declarations and definitions
 - Fixed mismatch between some declarations and definitions
+- Fixed inverse link error when using namespace glm; (#147)
 
 
 ================================================================================
 ================================================================================
 GLM 0.9.5.0: 2013-12-25
 GLM 0.9.5.0: 2013-12-25

+ 6 - 6
test/gtc/gtc_packing.cpp

@@ -208,12 +208,12 @@ int test_Unorm3x10_1x2()
 	int Error = 0;
 	int Error = 0;
 
 
 	std::vector<glm::vec4> Tests;
 	std::vector<glm::vec4> Tests;
-	Tests.push_back(glm::vec4(1.0));
-	Tests.push_back(glm::vec4(0.0));
-	Tests.push_back(glm::vec4(2.0));
-	Tests.push_back(glm::vec4(0.1));
-	Tests.push_back(glm::vec4(0.5));
-	Tests.push_back(glm::vec4(0.9));
+	Tests.push_back(glm::vec4(1.0f));
+	Tests.push_back(glm::vec4(0.0f));
+	Tests.push_back(glm::vec4(2.0f));
+	Tests.push_back(glm::vec4(0.1f));
+	Tests.push_back(glm::vec4(0.5f));
+	Tests.push_back(glm::vec4(0.9f));
 
 
 	for(std::size_t i = 0; i < Tests.size(); ++i)
 	for(std::size_t i = 0; i < Tests.size(); ++i)
 	{
 	{