From dc2b2cd5f6099affbf1d34e4a18f93fff16defde Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 24 Dec 2013 07:22:02 +0100 Subject: [PATCH] _inverse is now private --- glm/core/type_mat2x2.hpp | 15 ++++++++------- glm/core/type_mat2x2.inl | 9 +++++---- glm/core/type_mat3x3.hpp | 15 ++++++++------- glm/core/type_mat3x3.inl | 5 +++-- glm/core/type_mat4x4.hpp | 13 +++++++------ glm/core/type_mat4x4.inl | 7 ++++--- glm/gtc/matrix_access.inl | 4 ++-- readme.txt | 1 + 8 files changed, 38 insertions(+), 31 deletions(-) diff --git a/glm/core/type_mat2x2.hpp b/glm/core/type_mat2x2.hpp index 19d82004..ebac369c 100644 --- a/glm/core/type_mat2x2.hpp +++ b/glm/core/type_mat2x2.hpp @@ -40,7 +40,6 @@ namespace detail template struct tmat2x2 { - // Implementation detail enum ctor{_null}; typedef T value_type; typedef std::size_t size_type; @@ -54,15 +53,17 @@ namespace detail GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; - public: - // Implementation detail - GLM_FUNC_DECL tmat2x2 _inverse() const; - + friend tmat2x2 inverse(tmat2x2 const & m); + friend col_type operator/(tmat2x2 const & m, row_type const & v); + friend row_type operator/(row_type const & v, tmat2x2 const & m); + private: - ////////////////////////////////////// - // Implementation detail + /// @cond DETAIL col_type value[2]; + GLM_FUNC_DECL tmat2x2 _inverse() const; + /// @endcond + public: ////////////////////////////////////// // Constructors diff --git a/glm/core/type_mat2x2.inl b/glm/core/type_mat2x2.inl index 5044e444..e6a5ec2e 100644 --- a/glm/core/type_mat2x2.inl +++ b/glm/core/type_mat2x2.inl @@ -395,7 +395,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator/= (tmat2x2 const & m) { - return (*this = *this / m); + return (*this = *this * m._inverse()); } template @@ -648,11 +648,12 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x2 operator/ ( - tmat2x2 const & m1, + tmat2x2 const & m1, tmat2x2 const & m2 ) - { - return m1 * m2._inverse(); + { + tmat2x2 m1_copy(m1); + return m1_copy /= m2; } // Unary constant operators diff --git a/glm/core/type_mat3x3.hpp b/glm/core/type_mat3x3.hpp index 8e242713..38f339dc 100644 --- a/glm/core/type_mat3x3.hpp +++ b/glm/core/type_mat3x3.hpp @@ -53,16 +53,17 @@ namespace detail GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; - public: - /// Implementation detail - /// @cond DETAIL - GLM_FUNC_DECL tmat3x3 _inverse() const; - /// @endcond - + friend tmat3x3 inverse(tmat3x3 const & m); + friend col_type operator/(tmat3x3 const & m, row_type const & v); + friend row_type operator/(row_type const & v, tmat3x3 const & m); + private: - // Data + /// @cond DETAIL col_type value[3]; + GLM_FUNC_DECL tmat3x3 _inverse() const; + /// @endcond + public: // Constructors GLM_FUNC_DECL tmat3x3(); diff --git a/glm/core/type_mat3x3.inl b/glm/core/type_mat3x3.inl index df41547f..a1970e7e 100644 --- a/glm/core/type_mat3x3.inl +++ b/glm/core/type_mat3x3.inl @@ -418,7 +418,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat3x3 & tmat3x3::operator/= (tmat3x3 const & m) { - return (*this = *this / m); + return (*this = *this * m._inverse()); } template @@ -764,7 +764,8 @@ namespace detail tmat3x3 const & m2 ) { - return m1 * m2._inverse(); + tmat3x3 m1_copy(m1); + return m1_copy /= m2; } // Unary constant operators diff --git a/glm/core/type_mat4x4.hpp b/glm/core/type_mat4x4.hpp index 6036933c..509bd490 100644 --- a/glm/core/type_mat4x4.hpp +++ b/glm/core/type_mat4x4.hpp @@ -57,16 +57,17 @@ namespace detail GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; - public: - /// Implementation detail + friend tmat4x4 inverse(tmat4x4 const & m); + friend col_type operator/(tmat4x4 const & m, row_type const & v); + friend row_type operator/(row_type const & v, tmat4x4 const & m); + + private: /// @cond DETAIL + col_type value[4]; + GLM_FUNC_DECL tmat4x4 _inverse() const; /// @endcond - private: - // Data - col_type value[4]; - public: // Constructors GLM_FUNC_DECL tmat4x4(); diff --git a/glm/core/type_mat4x4.inl b/glm/core/type_mat4x4.inl index e4b3ac12..2d155193 100644 --- a/glm/core/type_mat4x4.inl +++ b/glm/core/type_mat4x4.inl @@ -489,7 +489,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x4 & tmat4x4::operator/= (tmat4x4 const & m) { - return (*this = *this / m); + return (*this = *this * m._inverse()); } template @@ -891,7 +891,7 @@ namespace detail { return v * m._inverse(); } - + template GLM_FUNC_QUALIFIER tmat4x4 operator/ ( @@ -899,7 +899,8 @@ namespace detail tmat4x4 const & m2 ) { - return m1 * m2._inverse(); + tmat4x4 m1_copy(m1); + return m1_copy /= m2; } // Unary constant operators diff --git a/glm/gtc/matrix_access.inl b/glm/gtc/matrix_access.inl index 763ecf52..e587a4a2 100644 --- a/glm/gtc/matrix_access.inl +++ b/glm/gtc/matrix_access.inl @@ -31,8 +31,8 @@ namespace glm template GLM_FUNC_QUALIFIER genType row ( - genType const & m, - int const & index, + genType const & m, + int const & index, typename genType::row_type const & x ) { diff --git a/readme.txt b/readme.txt index 0eda11ca..592ce3b9 100644 --- a/readme.txt +++ b/readme.txt @@ -73,6 +73,7 @@ GLM 0.9.5.0: 2013-12-25 - Fixed CUDA coverage for GTC extensions - Added GTX_io extension - Improved GLM messages enabled when defining GLM_MESSAGES +- Implementation detail _inverse is now private ================================================================================ GLM 0.9.4.6: 2013-09-20