_inverse is now private

This commit is contained in:
Christophe Riccio 2013-12-24 07:22:02 +01:00
parent aab47b3587
commit dc2b2cd5f6
8 changed files with 38 additions and 31 deletions

View File

@ -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: friend tmat2x2<T, P> inverse(tmat2x2<T, P> const & m);
// Implementation detail friend col_type operator/(tmat2x2<T, P> const & m, row_type const & v);
GLM_FUNC_DECL tmat2x2<T, P> _inverse() const; friend row_type operator/(row_type const & v, tmat2x2<T, P> const & m);
private: private:
////////////////////////////////////// /// @cond DETAIL
// Implementation detail
col_type value[2]; col_type value[2];
GLM_FUNC_DECL tmat2x2<T, P> _inverse() const;
/// @endcond
public: public:
////////////////////////////////////// //////////////////////////////////////
// Constructors // Constructors

View File

@ -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

View File

@ -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: friend tmat3x3<T, P> inverse(tmat3x3<T, P> const & m);
/// Implementation detail friend col_type operator/(tmat3x3<T, P> const & m, row_type const & v);
/// @cond DETAIL friend row_type operator/(row_type const & v, tmat3x3<T, P> const & m);
GLM_FUNC_DECL tmat3x3<T, P> _inverse() const;
/// @endcond
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();

View File

@ -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

View File

@ -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: friend tmat4x4<T, P> inverse(tmat4x4<T, P> const & m);
/// Implementation detail 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();

View File

@ -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

View File

@ -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, genType const & m,
int const & index, int const & index,
typename genType::row_type const & x typename genType::row_type const & x
) )
{ {

View File

@ -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