size_type and length_type for all types

This commit is contained in:
Christophe Riccio 2014-11-29 00:53:47 +01:00
parent 3ad3dbcd93
commit be0c5da488
30 changed files with 948 additions and 641 deletions

View File

@ -43,18 +43,11 @@ namespace glm
template <typename T, precision P = defaultp>
struct tmat2x2
{
typedef T value_type;
typedef std::size_t size_type;
typedef tvec2<T, P> col_type;
typedef tvec2<T, P> row_type;
typedef tmat2x2<T, P> type;
typedef tmat2x2<T, P> transpose_type;
# ifdef GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
typedef T value_type;
template <typename U, precision Q>
friend tvec2<U, Q> operator/(tmat2x2<U, Q> const & m, tvec2<U, Q> const & v);
@ -117,8 +110,22 @@ namespace glm
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<U, P> const & m);

View File

@ -50,37 +50,6 @@ namespace detail
}
}//namespace detail
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x2<T, P>::size() const
{
return 2;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x2<T, P>::length() const
{
return 2;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type & tmat2x2<T, P>::operator[](length_t i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const & tmat2x2<T, P>::operator[](length_t i) const
{
assert(i < this->length());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
@ -219,8 +188,53 @@ namespace detail
this->value[1] = col_type(m[1]);
}
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T, P>::size_type tmat2x2<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T, P>::length_type tmat2x2<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////////////////////////////
// mat2x2 operators
// Unary updatable operators
template <typename T, precision P>
template <typename U>

View File

@ -44,18 +44,11 @@ namespace glm
template <typename T, precision P = defaultp>
struct tmat2x3
{
typedef T value_type;
typedef std::size_t size_type;
typedef tvec3<T, P> col_type;
typedef tvec2<T, P> row_type;
typedef tmat2x3<T, P> type;
typedef tmat3x2<T, P> transpose_type;
# ifdef GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
typedef T value_type;
private:
/// @cond DETAIL
@ -110,9 +103,25 @@ namespace glm
GLM_FUNC_DECL explicit tmat2x3(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat4x3<T, P> const & x);
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator= (tmat2x3<U, P> const & m);

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x3<T, P>::size() const
{
return 2;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x3<T, P>::length() const
{
return 2;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type & tmat2x3<T, P>::operator[](length_t i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const & tmat2x3<T, P>::operator[](length_t i) const
{
assert(i < this->length());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
@ -203,6 +172,51 @@ namespace glm
this->value[1] = m[1];
}
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T, P>::size_type tmat2x3<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T, P>::length_type tmat2x3<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////////////////////////////
// Unary updatable operators

View File

@ -44,18 +44,11 @@ namespace glm
template <typename T, precision P = defaultp>
struct tmat2x4
{
typedef T value_type;
typedef std::size_t size_type;
typedef tvec4<T, P> col_type;
typedef tvec2<T, P> row_type;
typedef tmat2x4<T, P> type;
typedef tmat4x2<T, P> transpose_type;
# ifdef GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
typedef T value_type;
private:
/// @cond DETAIL
@ -111,9 +104,25 @@ namespace glm
GLM_FUNC_DECL explicit tmat2x4(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x4(tmat4x3<T, P> const & x);
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<U, P> const & m);

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x4<T, P>::size() const
{
return 2;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x4<T, P>::length() const
{
return 2;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type & tmat2x4<T, P>::operator[](length_t i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const & tmat2x4<T, P>::operator[](length_t i) const
{
assert(i < this->length());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
@ -204,6 +173,51 @@ namespace glm
this->value[1] = col_type(m[1], 0);
}
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T, P>::size_type tmat2x4<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T, P>::length_type tmat2x4<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////////////////////////////
// Unary updatable operators

View File

@ -44,18 +44,11 @@ namespace glm
template <typename T, precision P = defaultp>
struct tmat3x2
{
typedef T value_type;
typedef std::size_t size_type;
typedef tvec2<T, P> col_type;
typedef tvec3<T, P> row_type;
typedef tmat3x2<T, P> type;
typedef tmat2x3<T, P> transpose_type;
# ifdef GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
typedef T value_type;
private:
/// @cond DETAIL
@ -117,9 +110,25 @@ namespace glm
GLM_FUNC_DECL explicit tmat3x2(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x2(tmat4x3<T, P> const & x);
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator= (tmat3x2<U, P> const & m);

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x2<T, P>::size() const
{
return 3;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x2<T, P>::length() const
{
return 3;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type & tmat3x2<T, P>::operator[](length_t i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const & tmat3x2<T, P>::operator[](length_t i) const
{
assert(i < this->length());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
@ -232,6 +201,51 @@ namespace glm
this->value[2] = col_type(m[2]);
}
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T, P>::size_type tmat3x2<T, P>::size() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T, P>::length_type tmat3x2<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////////////////////////////
// Unary updatable operators

View File

@ -43,18 +43,11 @@ namespace glm
template <typename T, precision P = defaultp>
struct tmat3x3
{
typedef T value_type;
typedef std::size_t size_type;
typedef tvec3<T, P> col_type;
typedef tvec3<T, P> row_type;
typedef tmat3x3<T, P> type;
typedef tmat3x3<T, P> transpose_type;
# ifdef GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
typedef T value_type;
template <typename U, precision Q>
friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
@ -121,9 +114,25 @@ namespace glm
GLM_FUNC_DECL explicit tmat3x3(tmat3x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x3(tmat4x3<T, P> const & x);
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator= (tmat3x3<U, P> const & m);

View File

@ -56,37 +56,6 @@ namespace detail
}
}//namespace detail
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x3<T, P>::size() const
{
return 3;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x3<T, P>::length() const
{
return 3;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type & tmat3x3<T, P>::operator[](length_t i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const & tmat3x3<T, P>::operator[](length_t i) const
{
assert(i < this->length());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
@ -256,6 +225,51 @@ namespace detail
this->value[2] = m[2];
}
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3<T, P>::size_type tmat3x3<T, P>::size() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3<T, P>::length_type tmat3x3<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////////////////////////////
// Operators

View File

@ -44,18 +44,11 @@ namespace glm
template <typename T, precision P = defaultp>
struct tmat3x4
{
typedef T value_type;
typedef size_t size_type;
typedef tvec4<T, P> col_type;
typedef tvec3<T, P> row_type;
typedef tmat3x4<T, P> type;
typedef tmat4x3<T, P> transpose_type;
# ifdef GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
typedef T value_type;
private:
/// @cond DETAIL
@ -116,9 +109,25 @@ namespace glm
GLM_FUNC_DECL explicit tmat3x4(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x4(tmat4x3<T, P> const & x);
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P> & operator=(tmat3x4<U, P> const & m);

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x4<T, P>::size() const
{
return 3;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x4<T, P>::length() const
{
return 3;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type & tmat3x4<T, P>::operator[](length_t i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const & tmat3x4<T, P>::operator[](length_t i) const
{
assert(i < this->length());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
@ -231,6 +200,51 @@ namespace glm
this->value[2] = col_type(m[2], 0);
}
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T, P>::size_type tmat3x4<T, P>::size() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T, P>::length_type tmat3x4<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////////////////////////////
// Unary updatable operators

View File

@ -44,18 +44,11 @@ namespace glm
template <typename T, precision P = defaultp>
struct tmat4x2
{
typedef T value_type;
typedef std::size_t size_type;
typedef tvec2<T, P> col_type;
typedef tvec4<T, P> row_type;
typedef tmat4x2<T, P> type;
typedef tmat2x4<T, P> transpose_type;
# ifdef GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
typedef T value_type;
private:
/// @cond DETAIL
@ -122,9 +115,25 @@ namespace glm
GLM_FUNC_DECL explicit tmat4x2(tmat4x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x);
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>& operator=(tmat4x2<U, P> const & m);

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x2<T, P>::size() const
{
return 4;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x2<T, P>::length() const
{
return 4;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type & tmat4x2<T, P>::operator[](length_t i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const & tmat4x2<T, P>::operator[](length_t i) const
{
assert(i < this->length());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
@ -254,6 +223,51 @@ namespace glm
this->value[3] = col_type(0);
}
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T, P>::size_type tmat4x2<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T, P>::length_type tmat4x2<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////////////////////////////
// Unary updatable operators

View File

@ -44,18 +44,11 @@ namespace glm
template <typename T, precision P = defaultp>
struct tmat4x3
{
typedef T value_type;
typedef std::size_t size_type;
typedef tvec3<T, P> col_type;
typedef tvec4<T, P> row_type;
typedef tmat4x3<T, P> type;
typedef tmat3x4<T, P> transpose_type;
# ifdef GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
typedef T value_type;
private:
// Data
@ -121,9 +114,25 @@ namespace glm
GLM_FUNC_DECL explicit tmat4x3(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x3(tmat3x4<T, P> const & x);
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P> & operator=(tmat4x3<U, P> const & m);

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x3<T, P>::size() const
{
return 4;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x3<T, P>::length() const
{
return 4;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type & tmat4x3<T, P>::operator[](size_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type const & tmat4x3<T, P>::operator[](size_type i) const
{
assert(i < this->length());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
@ -254,6 +223,51 @@ namespace glm
this->value[3] = col_type(0);
}
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3<T, P>::size_type tmat4x3<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type const & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3<T, P>::length_type tmat4x3<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type const & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////////////////////////////
// Unary updatable operators

View File

@ -43,18 +43,11 @@ namespace glm
template <typename T, precision P = defaultp>
struct tmat4x4
{
typedef T value_type;
typedef std::size_t size_type;
typedef tvec4<T, P> col_type;
typedef tvec4<T, P> row_type;
typedef tmat4x4<T, P> type;
typedef tmat4x4<T, P> transpose_type;
# ifdef GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
typedef T value_type;
template <typename U, precision Q>
friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
@ -69,7 +62,6 @@ namespace glm
public:
// Constructors
GLM_FUNC_DECL tmat4x4();
//GLM_FUNC_DECL tmat4x4(tmat4x4<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat4x4(tmat4x4<T, Q> const & m);
@ -127,11 +119,26 @@ namespace glm
GLM_FUNC_DECL explicit tmat4x4(tmat3x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T, P> const & x);
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
//GLM_FUNC_DECL tmat4x4<T, P> & operator=(tmat4x4<T, P> const & m);
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator=(tmat4x4<U, P> const & m);
template <typename U>

View File

@ -92,37 +92,6 @@ namespace detail
}
}//namespace detail
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x4<T, P>::size() const
{
return 4;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x4<T, P>::length() const
{
return 4;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type & tmat4x4<T, P>::operator[](length_t i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const & tmat4x4<T, P>::operator[](length_t i) const
{
assert(i < this->length());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
@ -340,6 +309,51 @@ namespace detail
this->value[3] = col_type(m[3], 1);
}
//////////////////////////////////////
// Accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4<T, P>::size_type tmat4x4<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4<T, P>::length_type tmat4x4<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////////////////////////////
// Operators

View File

@ -55,17 +55,6 @@ namespace glm
typedef tvec1<bool, P> bool_type;
typedef T value_type;
//////////////////////////////////////
// Helper
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
/// Return the count of components of the vector
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Data
@ -99,8 +88,21 @@ namespace glm
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Implicit basic constructors

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec1<T, P>::size() const
{
return 1;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec1<T, P>::length() const
{
return 1;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](length_t i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](length_t i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
//////////////////////////////////////
// Implicit basic constructors
@ -118,6 +87,51 @@ namespace glm
: x(static_cast<T>(v.x))
{}
//////////////////////////////////////
// Component accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::size_type tvec1<T, P>::size() const
{
return 1;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](typename tvec1<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](typename tvec1<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::length_type tvec1<T, P>::length() const
{
return 1;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators

View File

@ -54,18 +54,6 @@ namespace glm
typedef tvec2<T, P> type;
typedef tvec2<bool, P> bool_type;
typedef T value_type;
typedef int size_type;
//////////////////////////////////////
// Helper
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
/// Return the count of components of the vector
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Data
@ -99,10 +87,23 @@ namespace glm
# endif
//////////////////////////////////////
// Accesses
// Component accesses
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Implicit basic constructors

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec2<T, P>::size() const
{
return 2;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec2<T, P>::length() const
{
return 2;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](length_t i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](length_t i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
//////////////////////////////////////
// Implicit basic constructors
@ -92,8 +61,8 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(T const & s1, T const & s2)
: x(s1), y(s2)
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(T const & a, T const & b)
: x(a), y(b)
{}
//////////////////////////////////////
@ -137,6 +106,51 @@ namespace glm
, y(static_cast<T>(v.y))
{}
//////////////////////////////////////
// Component accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::size_type tvec2<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](typename tvec2<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](typename tvec2<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::length_type tvec2<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators

View File

@ -54,18 +54,6 @@ namespace glm
typedef tvec3<T, P> type;
typedef tvec3<bool, P> bool_type;
typedef T value_type;
typedef int size_type;
//////////////////////////////////////
// Helper
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
/// Return the count of components of the vector
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Data
@ -100,10 +88,23 @@ namespace glm
# endif//GLM_LANG
//////////////////////////////////////
// Accesses
// Component accesses
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Implicit basic constructors

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec3<T, P>::size() const
{
return 3;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec3<T, P>::length() const
{
return 3;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](length_t i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](length_t i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
//////////////////////////////////////
// Implicit basic constructors
@ -166,6 +135,51 @@ namespace glm
z(static_cast<T>(v.z))
{}
//////////////////////////////////////
// Component accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T, P>::size_type tvec3<T, P>::size() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](typename tvec3<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](typename tvec3<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T, P>::length_type tvec3<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](typename tvec3<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](typename tvec3<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators

View File

@ -106,18 +106,6 @@ namespace detail
typedef tvec4<T, P> type;
typedef tvec4<bool, P> bool_type;
typedef T value_type;
typedef int size_type;
//////////////////////////////////////
// Helper
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
# else
/// Return the count of components of the vector
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Data
@ -154,10 +142,23 @@ namespace detail
# endif//GLM_LANG
//////////////////////////////////////
// Accesses
// Component accesses
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Implicit basic constructors

View File

@ -32,37 +32,6 @@
namespace glm
{
#ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec4<T, P>::size() const
{
return 4;
}
#else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec4<T, P>::length() const
{
return 4;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](length_t i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](length_t i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
//////////////////////////////////////
// Implicit basic constructors
@ -268,6 +237,51 @@ namespace glm
w(static_cast<T>(v.w))
{}
//////////////////////////////////////
// Component accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::size_type tvec4<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](typename tvec4<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](typename tvec4<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::length_type tvec4<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Unary arithmetic operators

View File

@ -62,25 +62,30 @@ namespace glm
template <typename T, precision P>
struct tquat
{
typedef tquat<T, P> type;
typedef T value_type;
typedef tvec4<bool, P> bool_type;
public:
T x, y, z, w;
#if GLM_FORCE_SIZE_FUNC
/// Return the count of components of a quaternion
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
#else
/// Return the count of components of a quaternion
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
#endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Accesses
// Component accesses
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
/// Return the count of components of a quaternion
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
typedef length_t length_type;
/// Return the count of components of a quaternion
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Implicit basic constructors

View File

@ -49,36 +49,50 @@ namespace detail
};
}//namespace detail
#if GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Component accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tquat<T, P>::size() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat<T, P>::size_type tquat<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tquat<T, P>::length() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat<T, P>::length_type tquat<T, P>::length() const
{
return 4;
}
#endif
//////////////////////////////////////
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[] (length_t i)
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[] (length_t i) const
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Implicit basic constructors

View File

@ -67,12 +67,23 @@ namespace glm
public:
glm::tquat<T, P> real, dual;
#if GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Component accesses
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
/// Return the count of components of a dual quaternion
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL part_type & operator[](size_type i);
GLM_FUNC_DECL part_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
/// Return the count of components of a dual quaternion
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL part_type & operator[](length_type i);
GLM_FUNC_DECL part_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
@ -104,10 +115,6 @@ namespace glm
GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);
// Accesses
GLM_FUNC_DECL part_type & operator[](int i);
GLM_FUNC_DECL part_type const & operator[](int i) const;
// Operators
GLM_FUNC_DECL tdualquat<T, P> & operator*=(T const & s);
GLM_FUNC_DECL tdualquat<T, P> & operator/=(T const & s);

View File

@ -35,19 +35,53 @@
namespace glm
{
#if GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Component accesses
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tdualquat<T, P>::size() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tdualquat<T, P>::size_type tdualquat<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type & tdualquat<T, P>::operator[](typename tdualquat<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type const & tdualquat<T, P>::operator[](typename tdualquat<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tdualquat<T, P>::length() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tdualquat<T, P>::length_type tdualquat<T, P>::length() const
{
return 2;
}
#endif
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type & tdualquat<T, P>::operator[](typename tdualquat<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type const & tdualquat<T, P>::operator[](typename tdualquat<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
//////////////////////////////////////
// Implicit basic constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat()
@ -113,24 +147,7 @@ namespace glm
}
//////////////////////////////////////////////////////////////
// tdualquat<T, P> accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type & tdualquat<T, P>::operator[](length_t i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type const & tdualquat<T, P>::operator[](length_t i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
//////////////////////////////////////////////////////////////
// tdualquat<valType> operators
// tdualquat operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tdualquat<T, P> & tdualquat<T, P>::operator*=(T const & s)