mirror of
https://github.com/g-truc/glm.git
synced 2025-04-06 22:15:00 +00:00
Added glm::length and removed col_size and row_size
This commit is contained in:
parent
dc2b2cd5f6
commit
510abedf2b
23 changed files with 107 additions and 258 deletions
|
@ -41,7 +41,7 @@ namespace glm
|
|||
GLM_STATIC_ASSERT(std::numeric_limits<typename matType::value_type>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
|
||||
|
||||
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];
|
||||
return result;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ namespace glm
|
|||
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);
|
||||
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];
|
||||
return m;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ namespace glm
|
|||
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);
|
||||
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];
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -48,9 +48,6 @@ namespace detail
|
|||
typedef tmat2x2<T, P> 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;
|
||||
|
||||
friend tmat2x2<T, P> inverse(tmat2x2<T, P> const & m);
|
||||
|
@ -123,8 +120,8 @@ namespace detail
|
|||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & m);
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace detail
|
|||
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
|
||||
|
||||
|
@ -54,7 +42,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type &
|
||||
tmat2x2<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
@ -65,7 +53,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const &
|
||||
tmat2x2<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
|
|
@ -49,9 +49,6 @@ namespace detail
|
|||
typedef tmat2x3<T, P> 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;
|
||||
|
||||
private:
|
||||
|
@ -114,8 +111,8 @@ namespace detail
|
|||
GLM_FUNC_DECL explicit tmat2x3(tmat4x3<T, P> const & x);
|
||||
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator= (tmat2x3<T, P> const & m);
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace detail
|
|||
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
|
||||
|
||||
|
@ -54,7 +42,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type &
|
||||
tmat2x3<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
@ -65,7 +53,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const &
|
||||
tmat2x3<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
|
|
@ -49,9 +49,6 @@ namespace detail
|
|||
typedef tmat2x4<T, P> 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;
|
||||
|
||||
private:
|
||||
|
@ -116,8 +113,8 @@ namespace detail
|
|||
GLM_FUNC_DECL explicit tmat2x4(tmat4x3<T, P> const & x);
|
||||
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<T, P> const & m);
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace detail
|
|||
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
|
||||
|
||||
|
@ -54,7 +42,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type &
|
||||
tmat2x4<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
@ -65,7 +53,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const &
|
||||
tmat2x4<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
|
|
@ -49,9 +49,6 @@ namespace detail
|
|||
typedef tmat3x2<T, P> 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;
|
||||
|
||||
private:
|
||||
|
@ -120,8 +117,8 @@ namespace detail
|
|||
GLM_FUNC_DECL explicit tmat3x2(tmat4x3<T, P> const & x);
|
||||
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator= (tmat3x2<T, P> const & m);
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace detail
|
|||
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
|
||||
|
||||
|
@ -54,7 +42,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type &
|
||||
tmat3x2<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
@ -65,7 +53,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const &
|
||||
tmat3x2<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
|
|
@ -48,9 +48,6 @@ namespace detail
|
|||
typedef tmat3x3<T, P> 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;
|
||||
|
||||
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);
|
||||
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat3x3<T, P>& operator= (tmat3x3<T, P> const & m);
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace detail
|
|||
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
|
||||
|
||||
|
@ -54,7 +42,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type &
|
||||
tmat3x3<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
@ -65,7 +53,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const &
|
||||
tmat3x3<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
|
|
@ -49,9 +49,6 @@ namespace detail
|
|||
typedef tmat3x4<T, P> 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;
|
||||
|
||||
private:
|
||||
|
@ -120,8 +117,8 @@ namespace detail
|
|||
GLM_FUNC_DECL explicit tmat3x4(tmat4x3<T, P> const & x);
|
||||
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator= (tmat3x4<T, P> const & m);
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace detail
|
|||
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
|
||||
|
||||
|
@ -54,7 +42,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type &
|
||||
tmat3x4<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
@ -65,7 +53,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const &
|
||||
tmat3x4<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
|
|
@ -49,9 +49,6 @@ namespace detail
|
|||
typedef tmat4x2<T, P> 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;
|
||||
|
||||
private:
|
||||
|
@ -125,8 +122,8 @@ namespace detail
|
|||
GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x);
|
||||
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<T, P> const & m);
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace detail
|
|||
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
|
||||
|
||||
|
@ -54,7 +42,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type &
|
||||
tmat4x2<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
@ -65,7 +53,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const &
|
||||
tmat4x2<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
|
|
@ -49,9 +49,6 @@ namespace detail
|
|||
typedef tmat4x3<T, P> 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;
|
||||
|
||||
private:
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace detail
|
|||
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
|
||||
|
||||
|
|
|
@ -52,9 +52,6 @@ namespace detail
|
|||
typedef tmat4x4<T, P> 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;
|
||||
|
||||
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);
|
||||
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<T, P> const & m);
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace detail
|
|||
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
|
||||
|
||||
|
@ -54,7 +42,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type &
|
||||
tmat4x4<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
@ -65,7 +53,7 @@ namespace detail
|
|||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const &
|
||||
tmat4x4<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
|
|
|
@ -32,14 +32,14 @@ namespace glm
|
|||
GLM_FUNC_QUALIFIER genType row
|
||||
(
|
||||
genType const & m,
|
||||
int const & index,
|
||||
length_t const & index,
|
||||
typename genType::row_type const & x
|
||||
)
|
||||
{
|
||||
assert(index >= 0 && index < m.col_size());
|
||||
assert(index >= 0 && index < m[0].length());
|
||||
|
||||
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];
|
||||
return Result;
|
||||
}
|
||||
|
@ -48,13 +48,13 @@ namespace glm
|
|||
GLM_FUNC_QUALIFIER typename genType::row_type row
|
||||
(
|
||||
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;
|
||||
for(int i = 0; i < genType::row_size(); ++i)
|
||||
for(length_t i = 0; i < m.length(); ++i)
|
||||
Result[i] = m[i][index];
|
||||
return Result;
|
||||
}
|
||||
|
@ -63,11 +63,11 @@ namespace glm
|
|||
GLM_FUNC_QUALIFIER genType column
|
||||
(
|
||||
genType const & m,
|
||||
int const & index,
|
||||
length_t const & index,
|
||||
typename genType::col_type const & x
|
||||
)
|
||||
{
|
||||
assert(index >= 0 && index < m.row_size());
|
||||
assert(index >= 0 && index < m.length());
|
||||
|
||||
genType Result = m;
|
||||
Result[index] = x;
|
||||
|
@ -78,10 +78,10 @@ namespace glm
|
|||
GLM_FUNC_QUALIFIER typename genType::col_type column
|
||||
(
|
||||
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];
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace glm
|
|||
T const & epsilon)
|
||||
{
|
||||
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);
|
||||
return result;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace glm
|
|||
)
|
||||
{
|
||||
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);
|
||||
return result;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace glm
|
|||
)
|
||||
{
|
||||
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);
|
||||
return result;
|
||||
}
|
||||
|
@ -58,13 +58,13 @@ namespace glm
|
|||
)
|
||||
{
|
||||
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;
|
||||
if(result)
|
||||
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;
|
||||
}
|
||||
return result;
|
||||
|
@ -78,12 +78,12 @@ namespace glm
|
|||
)
|
||||
{
|
||||
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);
|
||||
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;
|
||||
for(int j(0); j < m.length(); ++j)
|
||||
for(length_t j(0); j < m.length(); ++j)
|
||||
v[j] = m[j][i];
|
||||
result = isNormalized(v, epsilon);
|
||||
}
|
||||
|
@ -98,12 +98,12 @@ namespace glm
|
|||
)
|
||||
{
|
||||
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);
|
||||
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;
|
||||
for(int j(0); j < m.length(); ++j)
|
||||
for(length_t j(0); j < m.length(); ++j)
|
||||
v[j] = m[j][i];
|
||||
result = isNormalized(v, epsilon);
|
||||
}
|
||||
|
@ -118,12 +118,12 @@ namespace glm
|
|||
)
|
||||
{
|
||||
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);
|
||||
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;
|
||||
for(int j(0); j < m.length(); ++j)
|
||||
for(length_t j(0); j < m.length(); ++j)
|
||||
v[j] = m[j][i];
|
||||
result = isNormalized(v, epsilon);
|
||||
}
|
||||
|
@ -138,15 +138,15 @@ namespace glm
|
|||
)
|
||||
{
|
||||
bool result(true);
|
||||
for(int i(0); result && i < m.length() - 1; ++i)
|
||||
for(int j(i + 1); result && j < m.length(); ++j)
|
||||
for(length_t i(0); result && i < m.length() - 1; ++i)
|
||||
for(length_t j(i + 1); result && j < m.length(); ++j)
|
||||
result = areOrthogonal(m[i], m[j], epsilon);
|
||||
|
||||
if(result)
|
||||
{
|
||||
matType<T, P> tmp = transpose(m);
|
||||
for(int i(0); result && i < m.length() - 1 ; ++i)
|
||||
for(int j(i + 1); result && j < m.length(); ++j)
|
||||
for(length_t i(0); result && i < m.length() - 1 ; ++i)
|
||||
for(length_t j(i + 1); result && j < m.length(); ++j)
|
||||
result = areOrthogonal(tmp[i], tmp[j], epsilon);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -68,8 +68,6 @@ namespace detail
|
|||
typedef fvec4SIMD row_type;
|
||||
typedef std::size_t size_type;
|
||||
static size_type value_size();
|
||||
static size_type col_size();
|
||||
static size_type row_size();
|
||||
static bool is_matrix();
|
||||
|
||||
fvec4SIMD Data[4];
|
||||
|
@ -91,8 +89,8 @@ namespace detail
|
|||
fvec4SIMD const & v3);
|
||||
explicit fmat4x4SIMD(
|
||||
mat4x4 const & m);
|
||||
explicit fmat4x4SIMD(
|
||||
__m128 const in[4]);
|
||||
explicit fmat4x4SIMD(
|
||||
__m128 const in[4]);
|
||||
|
||||
// Conversions
|
||||
//template <typename U>
|
||||
|
@ -108,8 +106,8 @@ namespace detail
|
|||
//explicit tmat4x4(tmat4x3<T> const & x);
|
||||
|
||||
// Accesses
|
||||
fvec4SIMD & operator[](size_type i);
|
||||
fvec4SIMD const & operator[](size_type i) const;
|
||||
fvec4SIMD & operator[](length_t i);
|
||||
fvec4SIMD const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
fmat4x4SIMD & operator= (fmat4x4SIMD const & m);
|
||||
|
|
|
@ -15,20 +15,10 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD::size_type fmat4x4SIMD::value_size()
|
|||
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()
|
||||
{
|
||||
#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[2] = fvec4SIMD(0, 0, 1.0f, 0);
|
||||
this->Data[3] = fvec4SIMD(0, 0, 0, 1.0f);
|
||||
|
@ -84,13 +74,13 @@ 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[1] = in[1];
|
||||
this->Data[2] = in[2];
|
||||
this->Data[3] = in[3];
|
||||
this->Data[0] = in[0];
|
||||
this->Data[1] = in[1];
|
||||
this->Data[2] = in[2];
|
||||
this->Data[3] = in[3];
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
@ -98,24 +88,20 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
|
|||
|
||||
GLM_FUNC_QUALIFIER fvec4SIMD & fmat4x4SIMD::operator[]
|
||||
(
|
||||
fmat4x4SIMD::size_type i
|
||||
length i
|
||||
)
|
||||
{
|
||||
assert(
|
||||
//i >= fmat4x4SIMD::size_type(0) &&
|
||||
i < fmat4x4SIMD::col_size());
|
||||
assert(i < this->length());
|
||||
|
||||
return this->Data[i];
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[]
|
||||
(
|
||||
fmat4x4SIMD::size_type i
|
||||
length i
|
||||
) const
|
||||
{
|
||||
assert(
|
||||
//i >= fmat4x4SIMD::size_type(0) &&
|
||||
i < fmat4x4SIMD::col_size());
|
||||
assert(i < this->length());
|
||||
|
||||
return this->Data[i];
|
||||
}
|
||||
|
@ -132,7 +118,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD& fmat4x4SIMD::operator=
|
|||
this->Data[1] = m[1];
|
||||
this->Data[2] = m[2];
|
||||
this->Data[3] = m[3];
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
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[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);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
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[3].Data = _mm_sub_ps(this->Data[3].Data, m[3].Data);
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
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);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/=
|
||||
|
@ -177,7 +163,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD & fmat4x4SIMD::operator/=
|
|||
__m128 Inv[4];
|
||||
sse_inverse_ps(&m.Data[0].Data, Inv);
|
||||
sse_mul_ps(&this->Data[0].Data, Inv, &this->Data[0].Data);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
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[2].Data = _mm_add_ps(this->Data[2].Data, Operand);
|
||||
this->Data[3].Data = _mm_add_ps(this->Data[3].Data, Operand);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
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[2].Data = _mm_sub_ps(this->Data[2].Data, Operand);
|
||||
this->Data[3].Data = _mm_sub_ps(this->Data[3].Data, Operand);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
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[2].Data = _mm_mul_ps(this->Data[2].Data, Operand);
|
||||
this->Data[3].Data = _mm_mul_ps(this->Data[3].Data, Operand);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
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[2].Data = _mm_mul_ps(this->Data[2].Data, Operand);
|
||||
this->Data[3].Data = _mm_mul_ps(this->Data[3].Data, Operand);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
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[2].Data = _mm_add_ps(this->Data[2].Data, one);
|
||||
this->Data[3].Data = _mm_add_ps(this->Data[3].Data, one);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
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[2].Data = _mm_sub_ps(this->Data[2].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+
|
||||
(
|
||||
const fmat4x4SIMD &m,
|
||||
float const & s
|
||||
const fmat4x4SIMD &m,
|
||||
float const & s
|
||||
)
|
||||
{
|
||||
return detail::fmat4x4SIMD
|
||||
(
|
||||
m[0] + s,
|
||||
m[1] + s,
|
||||
m[2] + s,
|
||||
m[3] + s
|
||||
);
|
||||
return detail::fmat4x4SIMD
|
||||
(
|
||||
m[0] + s,
|
||||
m[1] + s,
|
||||
m[2] + s,
|
||||
m[3] + s
|
||||
);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER fmat4x4SIMD operator+
|
||||
(
|
||||
float const & s,
|
||||
const fmat4x4SIMD &m
|
||||
float const & s,
|
||||
const fmat4x4SIMD &m
|
||||
)
|
||||
{
|
||||
return detail::fmat4x4SIMD
|
||||
(
|
||||
m[0] + s,
|
||||
m[1] + s,
|
||||
m[2] + s,
|
||||
m[3] + s
|
||||
);
|
||||
return detail::fmat4x4SIMD
|
||||
(
|
||||
m[0] + s,
|
||||
m[1] + s,
|
||||
m[2] + s,
|
||||
m[3] + s
|
||||
);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER fmat4x4SIMD operator+
|
||||
|
|
Loading…
Add table
Reference in a new issue