Added glm::length and removed col_size and row_size

master
Christophe Riccio ago%!(EXTRA string=12 years)
parent dc2b2cd5f6
commit 510abedf2b
  1. 6
      glm/core/func_matrix.inl
  2. 7
      glm/core/type_mat2x2.hpp
  3. 16
      glm/core/type_mat2x2.inl
  4. 7
      glm/core/type_mat2x3.hpp
  5. 16
      glm/core/type_mat2x3.inl
  6. 7
      glm/core/type_mat2x4.hpp
  7. 16
      glm/core/type_mat2x4.inl
  8. 7
      glm/core/type_mat3x2.hpp
  9. 16
      glm/core/type_mat3x2.inl
  10. 7
      glm/core/type_mat3x3.hpp
  11. 16
      glm/core/type_mat3x3.inl
  12. 7
      glm/core/type_mat3x4.hpp
  13. 16
      glm/core/type_mat3x4.inl
  14. 7
      glm/core/type_mat4x2.hpp
  15. 16
      glm/core/type_mat4x2.inl
  16. 3
      glm/core/type_mat4x3.hpp
  17. 12
      glm/core/type_mat4x3.inl
  18. 7
      glm/core/type_mat4x4.hpp
  19. 16
      glm/core/type_mat4x4.inl
  20. 20
      glm/gtc/matrix_access.inl
  21. 38
      glm/gtx/matrix_query.inl
  22. 10
      glm/gtx/simd_mat4.hpp
  23. 92
      glm/gtx/simd_mat4.inl

@ -41,7 +41,7 @@ namespace glm
GLM_STATIC_ASSERT(std::numeric_limits<typename matType::value_type>::is_iec559, "'matrixCompMult' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<typename matType::value_type>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
matType result(matType::_null); matType result(matType::_null);
for(typename matType::size_type i = 0; i < matType::row_size(); ++i) for(length_t i = 0; i < result.length(); ++i)
result[i] = x[i] * y[i]; result[i] = x[i] * y[i];
return result; return result;
} }
@ -74,7 +74,7 @@ namespace glm
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
detail::tmat3x3<T, P> m(detail::tmat3x3<T, P>::null); detail::tmat3x3<T, P> m(detail::tmat3x3<T, P>::null);
for(typename detail::tmat3x3<T, P>::size_type i(0); i < m.length(); ++i) for(length_t i(0); i < m.length(); ++i)
m[i] = c * r[i]; m[i] = c * r[i];
return m; return m;
} }
@ -89,7 +89,7 @@ namespace glm
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
detail::tmat4x4<T, P> m(detail::tmat4x4<T, P>::null); detail::tmat4x4<T, P> m(detail::tmat4x4<T, P>::null);
for(typename detail::tmat4x4<T, P>::size_type i(0); i < m.length(); ++i) for(length_t i(0); i < m.length(); ++i)
m[i] = c * r[i]; m[i] = c * r[i];
return m; return m;
} }

@ -48,9 +48,6 @@ namespace detail
typedef tmat2x2<T, P> type; typedef tmat2x2<T, P> type;
typedef tmat2x2<T, P> transpose_type; typedef tmat2x2<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
friend tmat2x2<T, P> inverse(tmat2x2<T, P> const & m); friend tmat2x2<T, P> inverse(tmat2x2<T, P> const & m);
@ -123,8 +120,8 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses
GLM_FUNC_DECL col_type & operator[](size_type i); GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const; GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators // Unary updatable operators
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & m); GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & m);

@ -35,18 +35,6 @@ namespace detail
return 2; return 2;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::size_type tmat2x2<T, P>::col_size()
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::size_type tmat2x2<T, P>::row_size()
{
return 2;
}
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type & GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type &
tmat2x2<T, P>::operator[] tmat2x2<T, P>::operator[]
( (
size_type i length_t i
) )
{ {
assert(i < this->length()); assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const & GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const &
tmat2x2<T, P>::operator[] tmat2x2<T, P>::operator[]
( (
size_type i length_t i
) const ) const
{ {
assert(i < this->length()); assert(i < this->length());

@ -49,9 +49,6 @@ namespace detail
typedef tmat2x3<T, P> type; typedef tmat2x3<T, P> type;
typedef tmat3x2<T, P> transpose_type; typedef tmat3x2<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private: private:
@ -114,8 +111,8 @@ namespace detail
GLM_FUNC_DECL explicit tmat2x3(tmat4x3<T, P> const & x); GLM_FUNC_DECL explicit tmat2x3(tmat4x3<T, P> const & x);
// Accesses // Accesses
GLM_FUNC_DECL col_type & operator[](size_type i); GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const; GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators // Unary updatable operators
GLM_FUNC_DECL tmat2x3<T, P> & operator= (tmat2x3<T, P> const & m); GLM_FUNC_DECL tmat2x3<T, P> & operator= (tmat2x3<T, P> const & m);

@ -35,18 +35,6 @@ namespace detail
return 2; return 2;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::size_type tmat2x3<T, P>::col_size()
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::size_type tmat2x3<T, P>::row_size()
{
return 2;
}
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type & GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type &
tmat2x3<T, P>::operator[] tmat2x3<T, P>::operator[]
( (
size_type i length_t i
) )
{ {
assert(i < this->length()); assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const & GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const &
tmat2x3<T, P>::operator[] tmat2x3<T, P>::operator[]
( (
size_type i length_t i
) const ) const
{ {
assert(i < this->length()); assert(i < this->length());

@ -49,9 +49,6 @@ namespace detail
typedef tmat2x4<T, P> type; typedef tmat2x4<T, P> type;
typedef tmat4x2<T, P> transpose_type; typedef tmat4x2<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private: private:
@ -116,8 +113,8 @@ namespace detail
GLM_FUNC_DECL explicit tmat2x4(tmat4x3<T, P> const & x); GLM_FUNC_DECL explicit tmat2x4(tmat4x3<T, P> const & x);
// Accesses // Accesses
GLM_FUNC_DECL col_type & operator[](size_type i); GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const; GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators // Unary updatable operators
GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<T, P> const & m); GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<T, P> const & m);

@ -35,18 +35,6 @@ namespace detail
return 2; return 2;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::size_type tmat2x4<T, P>::col_size()
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::size_type tmat2x4<T, P>::row_size()
{
return 2;
}
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type & GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type &
tmat2x4<T, P>::operator[] tmat2x4<T, P>::operator[]
( (
size_type i length_t i
) )
{ {
assert(i < this->length()); assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const & GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const &
tmat2x4<T, P>::operator[] tmat2x4<T, P>::operator[]
( (
size_type i length_t i
) const ) const
{ {
assert(i < this->length()); assert(i < this->length());

@ -49,9 +49,6 @@ namespace detail
typedef tmat3x2<T, P> type; typedef tmat3x2<T, P> type;
typedef tmat2x3<T, P> transpose_type; typedef tmat2x3<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private: private:
@ -120,8 +117,8 @@ namespace detail
GLM_FUNC_DECL explicit tmat3x2(tmat4x3<T, P> const & x); GLM_FUNC_DECL explicit tmat3x2(tmat4x3<T, P> const & x);
// Accesses // Accesses
GLM_FUNC_DECL col_type & operator[](size_type i); GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const; GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators // Unary updatable operators
GLM_FUNC_DECL tmat3x2<T, P> & operator= (tmat3x2<T, P> const & m); GLM_FUNC_DECL tmat3x2<T, P> & operator= (tmat3x2<T, P> const & m);

@ -35,18 +35,6 @@ namespace detail
return 3; return 3;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::size_type tmat3x2<T, P>::col_size()
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::size_type tmat3x2<T, P>::row_size()
{
return 3;
}
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type & GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type &
tmat3x2<T, P>::operator[] tmat3x2<T, P>::operator[]
( (
size_type i length_t i
) )
{ {
assert(i < this->length()); assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const & GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const &
tmat3x2<T, P>::operator[] tmat3x2<T, P>::operator[]
( (
size_type i length_t i
) const ) const
{ {
assert(i < this->length()); assert(i < this->length());

@ -48,9 +48,6 @@ namespace detail
typedef tmat3x3<T, P> type; typedef tmat3x3<T, P> type;
typedef tmat3x3<T, P> transpose_type; typedef tmat3x3<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
friend tmat3x3<T, P> inverse(tmat3x3<T, P> const & m); friend tmat3x3<T, P> inverse(tmat3x3<T, P> const & m);
@ -126,8 +123,8 @@ namespace detail
GLM_FUNC_DECL explicit tmat3x3(tmat4x3<T, P> const & x); GLM_FUNC_DECL explicit tmat3x3(tmat4x3<T, P> const & x);
// Accesses // Accesses
GLM_FUNC_DECL col_type & operator[](size_type i); GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const; GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators // Unary updatable operators
GLM_FUNC_DECL tmat3x3<T, P>& operator= (tmat3x3<T, P> const & m); GLM_FUNC_DECL tmat3x3<T, P>& operator= (tmat3x3<T, P> const & m);

@ -35,18 +35,6 @@ namespace detail
return 3; return 3;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::size_type tmat3x3<T, P>::col_size()
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::size_type tmat3x3<T, P>::row_size()
{
return 3;
}
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type & GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type &
tmat3x3<T, P>::operator[] tmat3x3<T, P>::operator[]
( (
size_type i length_t i
) )
{ {
assert(i < this->length()); assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const & GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const &
tmat3x3<T, P>::operator[] tmat3x3<T, P>::operator[]
( (
size_type i length_t i
) const ) const
{ {
assert(i < this->length()); assert(i < this->length());

@ -49,9 +49,6 @@ namespace detail
typedef tmat3x4<T, P> type; typedef tmat3x4<T, P> type;
typedef tmat4x3<T, P> transpose_type; typedef tmat4x3<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private: private:
@ -120,8 +117,8 @@ namespace detail
GLM_FUNC_DECL explicit tmat3x4(tmat4x3<T, P> const & x); GLM_FUNC_DECL explicit tmat3x4(tmat4x3<T, P> const & x);
// Accesses // Accesses
GLM_FUNC_DECL col_type & operator[](size_type i); GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const; GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators // Unary updatable operators
GLM_FUNC_DECL tmat3x4<T, P> & operator= (tmat3x4<T, P> const & m); GLM_FUNC_DECL tmat3x4<T, P> & operator= (tmat3x4<T, P> const & m);

@ -35,18 +35,6 @@ namespace detail
return 3; return 3;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::size_type tmat3x4<T, P>::col_size()
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::size_type tmat3x4<T, P>::row_size()
{
return 3;
}
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type & GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type &
tmat3x4<T, P>::operator[] tmat3x4<T, P>::operator[]
( (
size_type i length_t i
) )
{ {
assert(i < this->length()); assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const & GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const &
tmat3x4<T, P>::operator[] tmat3x4<T, P>::operator[]
( (
size_type i length_t i
) const ) const
{ {
assert(i < this->length()); assert(i < this->length());

@ -49,9 +49,6 @@ namespace detail
typedef tmat4x2<T, P> type; typedef tmat4x2<T, P> type;
typedef tmat2x4<T, P> transpose_type; typedef tmat2x4<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private: private:
@ -125,8 +122,8 @@ namespace detail
GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x); GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x);
// Accesses // Accesses
GLM_FUNC_DECL col_type & operator[](size_type i); GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const; GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators // Unary updatable operators
GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<T, P> const & m); GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<T, P> const & m);

@ -35,18 +35,6 @@ namespace detail
return 4; return 4;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::size_type tmat4x2<T, P>::col_size()
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::size_type tmat4x2<T, P>::row_size()
{
return 4;
}
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type & GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type &
tmat4x2<T, P>::operator[] tmat4x2<T, P>::operator[]
( (
size_type i length_t i
) )
{ {
assert(i < this->length()); assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const & GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const &
tmat4x2<T, P>::operator[] tmat4x2<T, P>::operator[]
( (
size_type i length_t i
) const ) const
{ {
assert(i < this->length()); assert(i < this->length());

@ -49,9 +49,6 @@ namespace detail
typedef tmat4x3<T, P> type; typedef tmat4x3<T, P> type;
typedef tmat3x4<T, P> transpose_type; typedef tmat3x4<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private: private:

@ -35,18 +35,6 @@ namespace detail
return 4; return 4;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::size_type tmat4x3<T, P>::col_size()
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::size_type tmat4x3<T, P>::row_size()
{
return 4;
}
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses

@ -52,9 +52,6 @@ namespace detail
typedef tmat4x4<T, P> type; typedef tmat4x4<T, P> type;
typedef tmat4x4<T, P> transpose_type; typedef tmat4x4<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
friend tmat4x4<T, P> inverse(tmat4x4<T, P> const & m); friend tmat4x4<T, P> inverse(tmat4x4<T, P> const & m);
@ -135,8 +132,8 @@ namespace detail
GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T, P> const & x); GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T, P> const & x);
// Accesses // Accesses
GLM_FUNC_DECL col_type & operator[](size_type i); GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const; GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators // Unary updatable operators
GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<T, P> const & m); GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<T, P> const & m);

@ -35,18 +35,6 @@ namespace detail
return 4; return 4;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::size_type tmat4x4<T, P>::col_size()
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::size_type tmat4x4<T, P>::row_size()
{
return 4;
}
////////////////////////////////////// //////////////////////////////////////
// Accesses // Accesses
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type & GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type &
tmat4x4<T, P>::operator[] tmat4x4<T, P>::operator[]
( (
size_type i length_t i
) )
{ {
assert(i < this->length()); assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const & GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const &
tmat4x4<T, P>::operator[] tmat4x4<T, P>::operator[]
( (
size_type i length_t i
) const ) const
{ {
assert(i < this->length()); assert(i < this->length());

@ -32,14 +32,14 @@ namespace glm
GLM_FUNC_QUALIFIER genType row GLM_FUNC_QUALIFIER genType row
( (
genType const & m, genType const & m,
int const & index, length_t const & index,
typename genType::row_type const & x typename genType::row_type const & x
) )
{ {
assert(index >= 0 && index < m.col_size()); assert(index >= 0 && index < m[0].length());
genType Result = m; genType Result = m;
for(int i = 0; i < genType::row_size(); ++i) for(length_t i = 0; i < m.length(); ++i)
Result[i][index] = x[i]; Result[i][index] = x[i];
return Result; return Result;
} }
@ -48,13 +48,13 @@ namespace glm
GLM_FUNC_QUALIFIER typename genType::row_type row GLM_FUNC_QUALIFIER typename genType::row_type row
( (
genType const & m, genType const & m,
int const & index length_t const & index
) )
{ {
assert(index >= 0 && index < m.col_size()); assert(index >= 0 && index < m[0].length());
typename genType::row_type Result; typename genType::row_type Result;
for(int i = 0; i < genType::row_size(); ++i) for(length_t i = 0; i < m.length(); ++i)
Result[i] = m[i][index]; Result[i] = m[i][index];
return Result; return Result;
} }
@ -63,11 +63,11 @@ namespace glm
GLM_FUNC_QUALIFIER genType column GLM_FUNC_QUALIFIER genType column
( (
genType const & m, genType const & m,
int const & index, length_t const & index,
typename genType::col_type const & x typename genType::col_type const & x
) )
{ {
assert(index >= 0 && index < m.row_size()); assert(index >= 0 && index < m.length());
genType Result = m; genType Result = m;
Result[index] = x; Result[index] = x;
@ -78,10 +78,10 @@ namespace glm
GLM_FUNC_QUALIFIER typename genType::col_type column GLM_FUNC_QUALIFIER typename genType::col_type column
( (
genType const & m, genType const & m,
int const & index length_t const & index
) )
{ {
assert(index >= 0 && index < m.row_size()); assert(index >= 0 && index < m.length());
return m[index]; return m[index];
} }

@ -19,7 +19,7 @@ namespace glm
T const & epsilon) T const & epsilon)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 2 ; ++i) for(length_t i = 0; result && i < 2 ; ++i)
result = isNull(m[i], epsilon); result = isNull(m[i], epsilon);
return result; return result;
} }
@ -32,7 +32,7 @@ namespace glm
) )
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 3 ; ++i) for(length_t i = 0; result && i < 3 ; ++i)
result = isNull(m[i], epsilon); result = isNull(m[i], epsilon);
return result; return result;
} }
@ -45,7 +45,7 @@ namespace glm
) )
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 4 ; ++i) for(length_t i = 0; result && i < 4 ; ++i)
result = isNull(m[i], epsilon); result = isNull(m[i], epsilon);
return result; return result;
} }
@ -58,13 +58,13 @@ namespace glm
) )
{ {
bool result = true; bool result = true;
for(int i(0); result && i < matType<T, P>::col_size(); ++i) for(length_t i(0); result && i < m[0].length(); ++i)
{ {
for(int j(0); result && j < i ; ++j) for(length_t j(0); result && j < i ; ++j)
result = abs(m[i][j]) <= epsilon; result = abs(m[i][j]) <= epsilon;
if(result) if(result)
result = abs(m[i][i] - 1) <= epsilon; result = abs(m[i][i] - 1) <= epsilon;
for(int j(i + 1); result && j < matType<T, P>::row_size(); ++j) for(length_t j(i + 1); result && j < m.length(); ++j)
result = abs(m[i][j]) <= epsilon; result = abs(m[i][j]) <= epsilon;
} }
return result; return result;
@ -78,12 +78,12 @@ namespace glm
) )
{ {
bool result(true); bool result(true);
for(int i(0); result && i < m.length(); ++i) for(length_t i(0); result && i < m.length(); ++i)
result = isNormalized(m[i], epsilon); result = isNormalized(m[i], epsilon);
for(int i(0); result && i < m.length(); ++i) for(length_t i(0); result && i < m.length(); ++i)
{ {
typename detail::tmat2x2<T, P>::col_type v; typename detail::tmat2x2<T, P>::col_type v;
for(int j(0); j < m.length(); ++j) for(length_t j(0); j < m.length(); ++j)
v[j] = m[j][i]; v[j] = m[j][i];
result = isNormalized(v, epsilon); result = isNormalized(v, epsilon);
} }
@ -98,12 +98,12 @@ namespace glm
) )
{ {
bool result(true); bool result(true);
for(int i(0); result && i < m.length(); ++i) for(length_t i(0); result && i < m.length(); ++i)
result = isNormalized(m[i], epsilon); result = isNormalized(m[i], epsilon);
for(int i(0); result && i < m.length(); ++i) for(length_t i(0); result && i < m.length(); ++i)
{ {
typename detail::tmat3x3<T, P>::col_type v; typename detail::tmat3x3<T, P>::col_type v;
for(int j(0); j < m.length(); ++j) for(length_t j(0); j < m.length(); ++j)
v[j] = m[j][i]; v[j] = m[j][i];
result = isNormalized(v, epsilon); result = isNormalized(v, epsilon);
} }
@ -118,12 +118,12 @@ namespace glm
) )
{ {
bool result(true); bool result(true);
for(int i(0); result && i < m.length(); ++i) for(length_t i(0); result && i < m.length(); ++i)
result = isNormalized(m[i], epsilon); result = isNormalized(m[i], epsilon);
for(int i(0); result && i < m.length(); ++i) for(length_t i(0); result && i < m.length(); ++i)
{ {
typename detail::tmat4x4<T, P>::col_type v; typename detail::tmat4x4<T, P>::col_type v;
for(int j(0); j < m.length(); ++j) for(length_t j(0); j < m.length(); ++j)
v[j] = m[j][i]; v[j] = m[j][i];
result = isNormalized(v, epsilon); result = isNormalized(v, epsilon);
} }
@ -138,15 +138,15 @@ namespace glm
) )
{ {
bool result(true); bool result(true);
for(int i(0); result && i < m.length() - 1; ++i) for(length_t i(0); result && i < m.length() - 1; ++i)
for(int j(i + 1); result && j < m.length(); ++j) for(length_t j(i + 1); result && j < m.length(); ++j)
result = areOrthogonal(m[i], m[j], epsilon); result = areOrthogonal(m[i], m[j], epsilon);
if(result) if(result)
{ {
matType<T, P> tmp = transpose(m); matType<T, P> tmp = transpose(m);
for(int i(0); result && i < m.length() - 1 ; ++i) for(length_t i(0); result && i < m.length() - 1 ; ++i)
for(int j(i + 1); result && j < m.length(); ++j) for(length_t j(i + 1); result && j < m.length(); ++j)
result = areOrthogonal(tmp[i], tmp[j], epsilon); result = areOrthogonal(tmp[i], tmp[j], epsilon);
} }
return result; return result;

@ -68,8 +68,6 @@ namespace detail
typedef fvec4SIMD row_type; typedef fvec4SIMD row_type;
typedef std::size_t size_type; typedef std::size_t size_type;
static size_type value_size(); static size_type value_size();
static size_type col_size();
static size_type row_size();
static bool is_matrix(); static bool is_matrix();
fvec4SIMD Data[4]; fvec4SIMD Data[4];
@ -91,8 +89,8 @@ namespace detail
fvec4SIMD const & v3); fvec4SIMD const & v3);
explicit fmat4x4SIMD( explicit fmat4x4SIMD(
mat4x4 const & m); mat4x4 const & m);
explicit fmat4x4SIMD( explicit fmat4x4SIMD(
__m128 const in[4]); __m128 const in[4]);
// Conversions // Conversions
//template <typename U> //template <typename U>
@ -108,8 +106,8 @@ namespace detail
//explicit tmat4x4(tmat4x3<T> const & x); //explicit tmat4x4(tmat4x3<T> const & x);
// Accesses // Accesses
fvec4SIMD & operator[](size_type i); fvec4SIMD & operator[](length_t i);
fvec4SIMD const & operator[](size_type i) const; fvec4SIMD const & operator[](length_t i) const;
// Unary updatable operators // Unary updatable operators
fmat4x4SIMD & operator= (fmat4x4SIMD const & m); fmat4x4SIMD & operator= (fmat4x4SIMD const & m);

@ -15,20 +15,10 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD::size_type fmat4x4SIMD::value_size()
return sizeof(value_type); return sizeof(value_type);
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD::size_type fmat4x4SIMD::col_size()
{
return 4;
}
GLM_FUNC_QUALIFIER fmat4x4SIMD::size_type fmat4x4SIMD::row_size()
{
return 4;
}
GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD() GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD()
{ {
#ifndef GLM_SIMD_ENABLE_DEFAULT_INIT #ifndef GLM_SIMD_ENABLE_DEFAULT_INIT
this->Data[0] = fvec4SIMD(1.0f, 0, 0, 0); this->Data[0] = fvec4SIMD(1.0f, 0, 0, 0);
this->Data[1] = fvec4SIMD(0, 1.0f, 0, 0); this->Data[1] = fvec4SIMD(0, 1.0f, 0, 0);
this->Data[2] = fvec4SIMD(0, 0, 1.0f, 0); this->Data[2] = fvec4SIMD(0, 0, 1.0f, 0);
this->Data[3] = fvec4SIMD(0, 0, 0, 1.0f); this->Data[3] = fvec4SIMD(0, 0, 0, 1.0f);
@ -84,13 +74,13 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
( (
__m128 const in[4] __m128 const in[4]
) )
{ {
this->Data[0] = in[0]; this->Data[0] = in[0];
this->Data[1] = in[1]; this->Data[1] = in[1];
this->Data[2] = in[2]; this->Data[2] = in[2];
this->Data[3] = in[3]; this->Data[3] = in[3];
} }
////////////////////////////////////// //////////////////////////////////////
@ -98,24 +88,20 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
GLM_FUNC_QUALIFIER fvec4SIMD & fmat4x4SIMD::operator[] GLM_FUNC_QUALIFIER fvec4SIMD & fmat4x4SIMD::operator[]
( (
fmat4x4SIMD::size_type i length i
) )
{ {
assert( assert(i < this->length());
//i >= fmat4x4SIMD::size_type(0) &&
i < fmat4x4SIMD::col_size());
return this->Data[i]; return this->Data[i];
} }
GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[] GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[]
( (
fmat4x4SIMD::size_type i length i
) const ) const
{ {
assert( assert(i < this->length());
//i >= fmat4x4SIMD::size_type(0) &&
i < fmat4x4SIMD::col_size());
return this->Data[i]; return this->Data[i];
} }
@ -132,7 +118,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD& fmat4x4SIMD::operator=
this->Data[1] = m[1]; this->Data[1] = m[1];
this->Data[2] = m[2]; this->Data[2] = m[2];
this->Data[3] = m[3]; this->Data[3] = m[3];
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator+= GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator+=
@ -144,7 +130,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator+=
this->Data[1].Data = _mm_add_ps(this->Data[1].Data, m[1].Data); this->Data[1].Data = _mm_add_ps(this->Data[1].Data, m[1].Data);
this->Data[2].Data = _mm_add_ps(this->Data[2].Data, m[2].Data); this->Data[2].Data = _mm_add_ps(this->Data[2].Data, m[2].Data);
this->Data[3].Data = _mm_add_ps(this->Data[3].Data, m[3].Data); this->Data[3].Data = _mm_add_ps(this->Data[3].Data, m[3].Data);
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-= GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-=
@ -157,7 +143,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-=
this->Data[2].Data = _mm_sub_ps(this->Data[2].Data, m[2].Data); this->Data[2].Data = _mm_sub_ps(this->Data[2].Data, m[2].Data);
this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, m[3].Data); this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, m[3].Data);
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator*= GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator*=
@ -166,7 +152,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator*=
) )
{ {
sse_mul_ps(&this->Data[0].Data, &m.Data[0].Data, &this->Data[0].Data); sse_mul_ps(&this->Data[0].Data, &m.Data[0].Data, &this->Data[0].Data);
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/= GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/=
@ -177,7 +163,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/=
__m128 Inv[4]; __m128 Inv[4];
sse_inverse_ps(&m.Data[0].Data, Inv); sse_inverse_ps(&m.Data[0].Data, Inv);
sse_mul_ps(&this->Data[0].Data, Inv, &this->Data[0].Data); sse_mul_ps(&this->Data[0].Data, Inv, &this->Data[0].Data);
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator+= GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator+=
@ -190,7 +176,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator+=
this->Data[1].Data = _mm_add_ps(this->Data[1].Data, Operand); this->Data[1].Data = _mm_add_ps(this->Data[1].Data, Operand);
this->Data[2].Data = _mm_add_ps(this->Data[2].Data, Operand); this->Data[2].Data = _mm_add_ps(this->Data[2].Data, Operand);
this->Data[3].Data = _mm_add_ps(this->Data[3].Data, Operand); this->Data[3].Data = _mm_add_ps(this->Data[3].Data, Operand);
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-= GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-=
@ -203,7 +189,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-=
this->Data[1].Data = _mm_sub_ps(this->Data[1].Data, Operand); this->Data[1].Data = _mm_sub_ps(this->Data[1].Data, Operand);
this->Data[2].Data = _mm_sub_ps(this->Data[2].Data, Operand); this->Data[2].Data = _mm_sub_ps(this->Data[2].Data, Operand);
this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, Operand); this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, Operand);
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator*= GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator*=
@ -216,7 +202,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator*=
this->Data[1].Data = _mm_mul_ps(this->Data[1].Data, Operand); this->Data[1].Data = _mm_mul_ps(this->Data[1].Data, Operand);
this->Data[2].Data = _mm_mul_ps(this->Data[2].Data, Operand); this->Data[2].Data = _mm_mul_ps(this->Data[2].Data, Operand);
this->Data[3].Data = _mm_mul_ps(this->Data[3].Data, Operand); this->Data[3].Data = _mm_mul_ps(this->Data[3].Data, Operand);
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/= GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/=
@ -229,7 +215,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/=
this->Data[1].Data = _mm_mul_ps(this->Data[1].Data, Operand); this->Data[1].Data = _mm_mul_ps(this->Data[1].Data, Operand);
this->Data[2].Data = _mm_mul_ps(this->Data[2].Data, Operand); this->Data[2].Data = _mm_mul_ps(this->Data[2].Data, Operand);
this->Data[3].Data = _mm_mul_ps(this->Data[3].Data, Operand); this->Data[3].Data = _mm_mul_ps(this->Data[3].Data, Operand);
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator++ () GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator++ ()
@ -238,7 +224,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator++ ()
this->Data[1].Data = _mm_add_ps(this->Data[1].Data, one); this->Data[1].Data = _mm_add_ps(this->Data[1].Data, one);
this->Data[2].Data = _mm_add_ps(this->Data[2].Data, one); this->Data[2].Data = _mm_add_ps(this->Data[2].Data, one);
this->Data[3].Data = _mm_add_ps(this->Data[3].Data, one); this->Data[3].Data = _mm_add_ps(this->Data[3].Data, one);
return *this; return *this;
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-- () GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-- ()
@ -247,7 +233,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-- ()
this->Data[1].Data = _mm_sub_ps(this->Data[1].Data, one); this->Data[1].Data = _mm_sub_ps(this->Data[1].Data, one);
this->Data[2].Data = _mm_sub_ps(this->Data[2].Data, one); this->Data[2].Data = _mm_sub_ps(this->Data[2].Data, one);
this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, one); this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, one);
return *this; return *this;
} }
@ -256,32 +242,32 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator-- ()
GLM_FUNC_QUALIFIER fmat4x4SIMD operator+ GLM_FUNC_QUALIFIER fmat4x4SIMD operator+
( (
const fmat4x4SIMD &m, const fmat4x4SIMD &m,
float const & s float const & s
) )
{ {
return detail::fmat4x4SIMD return detail::fmat4x4SIMD
( (
m[0] + s, m[0] + s,
m[1] + s, m[1] + s,
m[2] + s, m[2] + s,
m[3] + s m[3] + s
); );
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD operator+ GLM_FUNC_QUALIFIER fmat4x4SIMD operator+
( (
float const & s, float const & s,
const fmat4x4SIMD &m const fmat4x4SIMD &m
) )
{ {
return detail::fmat4x4SIMD return detail::fmat4x4SIMD
( (
m[0] + s, m[0] + s,
m[1] + s, m[1] + s,
m[2] + s, m[2] + s,
m[3] + s m[3] + s
); );
} }
GLM_FUNC_QUALIFIER fmat4x4SIMD operator+ GLM_FUNC_QUALIFIER fmat4x4SIMD operator+

Loading…
Cancel
Save