Browse Source

_inverse is now private

Christophe Riccio 12 years ago
parent
commit
dc2b2cd5f6

+ 8 - 7
glm/core/type_mat2x2.hpp

@@ -40,7 +40,6 @@ namespace detail
 	template <typename T, precision P>
 	template <typename T, precision P>
 	struct tmat2x2
 	struct tmat2x2
 	{
 	{
-		// Implementation detail
 		enum ctor{_null};
 		enum ctor{_null};
 		typedef T value_type;
 		typedef T value_type;
 		typedef std::size_t size_type;
 		typedef std::size_t size_type;
@@ -54,15 +53,17 @@ namespace detail
 
 
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 
 
-	public:
-		// Implementation detail
-		GLM_FUNC_DECL tmat2x2<T, P> _inverse() const;
-
+		friend tmat2x2<T, P> inverse(tmat2x2<T, P> const & m);
+		friend col_type operator/(tmat2x2<T, P> const & m, row_type const & v);
+		friend row_type operator/(row_type const & v, tmat2x2<T, P> const & m);
+		
 	private:
 	private:
-		//////////////////////////////////////
-		// Implementation detail
+		/// @cond DETAIL
 		col_type value[2];
 		col_type value[2];
 
 
+		GLM_FUNC_DECL tmat2x2<T, P> _inverse() const;
+		/// @endcond
+		
 	public:
 	public:
 		//////////////////////////////////////
 		//////////////////////////////////////
 		// Constructors
 		// Constructors

+ 5 - 4
glm/core/type_mat2x2.inl

@@ -395,7 +395,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);
+		return (*this = *this * m._inverse());
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -648,11 +648,12 @@ namespace detail
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/
 	GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/
 	(
 	(
-		tmat2x2<T, P> const & m1, 
+		tmat2x2<T, P> const & m1,
 		tmat2x2<T, P> const & m2
 		tmat2x2<T, P> const & m2
 	)
 	)
-	{
-		return m1 * m2._inverse();
+	{	
+		tmat2x2<T, P> m1_copy(m1);
+		return m1_copy /= m2;
 	}
 	}
 
 
 	// Unary constant operators
 	// Unary constant operators

+ 8 - 7
glm/core/type_mat3x3.hpp

@@ -53,16 +53,17 @@ namespace detail
 
 
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 
 
-	public:
-		/// Implementation detail
-		/// @cond DETAIL
-		GLM_FUNC_DECL tmat3x3<T, P> _inverse() const;
-		/// @endcond
-
+		friend tmat3x3<T, P> inverse(tmat3x3<T, P> const & m);
+		friend col_type operator/(tmat3x3<T, P> const & m, row_type const & v);
+		friend row_type operator/(row_type const & v, tmat3x3<T, P> const & m);
+		
 	private:
 	private:
-		// Data
+		/// @cond DETAIL
 		col_type value[3];
 		col_type value[3];
 
 
+		GLM_FUNC_DECL tmat3x3<T, P> _inverse() const;
+		/// @endcond
+		
 	public:
 	public:
 		// Constructors
 		// Constructors
 		GLM_FUNC_DECL tmat3x3();
 		GLM_FUNC_DECL tmat3x3();

+ 3 - 2
glm/core/type_mat3x3.inl

@@ -418,7 +418,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);
+		return (*this = *this * m._inverse());
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -764,7 +764,8 @@ namespace detail
 		tmat3x3<T, P> const & m2
 		tmat3x3<T, P> const & m2
 	)
 	)
 	{
 	{
-		return m1 * m2._inverse();
+		tmat3x3<T, P> m1_copy(m1);
+		return m1_copy /= m2;
 	}
 	}
 
 
 	// Unary constant operators
 	// Unary constant operators

+ 7 - 6
glm/core/type_mat4x4.hpp

@@ -57,16 +57,17 @@ namespace detail
 
 
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 
 
-	public:
-		/// Implementation detail
+		friend tmat4x4<T, P> inverse(tmat4x4<T, P> const & m);
+		friend col_type operator/(tmat4x4<T, P> const & m, row_type const & v);
+		friend row_type operator/(row_type const & v, tmat4x4<T, P> const & m);
+		
+	private:
 		/// @cond DETAIL
 		/// @cond DETAIL
+		col_type value[4];
+		
 		GLM_FUNC_DECL tmat4x4<T, P> _inverse() const;
 		GLM_FUNC_DECL tmat4x4<T, P> _inverse() const;
 		/// @endcond
 		/// @endcond
 
 
-	private:
-		// Data 
-		col_type value[4];
-
 	public:
 	public:
 		// Constructors
 		// Constructors
 		GLM_FUNC_DECL tmat4x4();
 		GLM_FUNC_DECL tmat4x4();

+ 4 - 3
glm/core/type_mat4x4.inl

@@ -489,7 +489,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);
+		return (*this = *this * m._inverse());
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -891,7 +891,7 @@ namespace detail
 	{
 	{
 		return v * m._inverse();
 		return v * m._inverse();
 	}
 	}
- 
+
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/
 	GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/
 	(
 	(
@@ -899,7 +899,8 @@ namespace detail
 		tmat4x4<T, P> const & m2
 		tmat4x4<T, P> const & m2
 	)
 	)
 	{
 	{
-		return m1 * m2._inverse();
+		tmat4x4<T, P> m1_copy(m1);
+		return m1_copy /= m2;
 	}
 	}
 
 
 	// Unary constant operators
 	// Unary constant operators

+ 2 - 2
glm/gtc/matrix_access.inl

@@ -31,8 +31,8 @@ namespace glm
 	template <typename genType>
 	template <typename genType>
 	GLM_FUNC_QUALIFIER genType row
 	GLM_FUNC_QUALIFIER genType row
 	(
 	(
-		genType const & m, 
-		int const & index, 
+		genType const & m,
+		int const & index,
 		typename genType::row_type const & x
 		typename genType::row_type const & x
 	)
 	)
 	{
 	{

+ 1 - 0
readme.txt

@@ -73,6 +73,7 @@ GLM 0.9.5.0: 2013-12-25
 - Fixed CUDA coverage for GTC extensions
 - Fixed CUDA coverage for GTC extensions
 - Added GTX_io extension
 - Added GTX_io extension
 - Improved GLM messages enabled when defining GLM_MESSAGES
 - Improved GLM messages enabled when defining GLM_MESSAGES
+- Implementation detail _inverse is now private
 
 
 ================================================================================
 ================================================================================
 GLM 0.9.4.6: 2013-09-20
 GLM 0.9.4.6: 2013-09-20