diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index a3877ebd..008a1f0d 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -43,18 +43,11 @@ namespace glm template struct tmat2x2 { - typedef T value_type; - typedef std::size_t size_type; typedef tvec2 col_type; typedef tvec2 row_type; typedef tmat2x2 type; typedef tmat2x2 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 friend tvec2 operator/(tmat2x2 const & m, tvec2 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 GLM_FUNC_DECL tmat2x2 & operator=(tmat2x2 const & m); diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index b4700ebc..5d26395c 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -50,37 +50,6 @@ namespace detail } }//namespace detail -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x2::size() const - { - return 2; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x2::length() const - { - return 2; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER typename tmat2x2::col_type & tmat2x2::operator[](length_t i) - { - assert(i < this->length()); - return this->value[i]; - } - - template - GLM_FUNC_QUALIFIER typename tmat2x2::col_type const & tmat2x2::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 + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2::size_type tmat2x2::size() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x2::col_type & tmat2x2::operator[](typename tmat2x2::size_type i) + { + assert(i < this->size()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x2::col_type const & tmat2x2::operator[](typename tmat2x2::size_type i) const + { + assert(i < this->size()); + return this->value[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2::length_type tmat2x2::length() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x2::col_type & tmat2x2::operator[](typename tmat2x2::length_type i) + { + assert(i < this->length()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x2::col_type const & tmat2x2::operator[](typename tmat2x2::length_type i) const + { + assert(i < this->length()); + return this->value[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////////////////////////////// - // mat2x2 operators + // Unary updatable operators template template diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index f7e8a49b..6c05bbc4 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -44,18 +44,11 @@ namespace glm template struct tmat2x3 { - typedef T value_type; - typedef std::size_t size_type; typedef tvec3 col_type; typedef tvec2 row_type; typedef tmat2x3 type; typedef tmat3x2 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 const & x); GLM_FUNC_DECL explicit tmat2x3(tmat4x3 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 GLM_FUNC_DECL tmat2x3 & operator= (tmat2x3 const & m); diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index cbbbe4b0..20960e1f 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -32,37 +32,6 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x3::size() const - { - return 2; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x3::length() const - { - return 2; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER typename tmat2x3::col_type & tmat2x3::operator[](length_t i) - { - assert(i < this->length()); - return this->value[i]; - } - - template - GLM_FUNC_QUALIFIER typename tmat2x3::col_type const & tmat2x3::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 + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3::size_type tmat2x3::size() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x3::col_type & tmat2x3::operator[](typename tmat2x3::size_type i) + { + assert(i < this->size()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x3::col_type const & tmat2x3::operator[](typename tmat2x3::size_type i) const + { + assert(i < this->size()); + return this->value[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3::length_type tmat2x3::length() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x3::col_type & tmat2x3::operator[](typename tmat2x3::length_type i) + { + assert(i < this->length()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x3::col_type const & tmat2x3::operator[](typename tmat2x3::length_type i) const + { + assert(i < this->length()); + return this->value[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////////////////////////////// // Unary updatable operators diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 63b51389..bc26dac9 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -44,18 +44,11 @@ namespace glm template struct tmat2x4 { - typedef T value_type; - typedef std::size_t size_type; typedef tvec4 col_type; typedef tvec2 row_type; typedef tmat2x4 type; typedef tmat4x2 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 const & x); GLM_FUNC_DECL explicit tmat2x4(tmat4x3 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 GLM_FUNC_DECL tmat2x4& operator= (tmat2x4 const & m); diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index f68712ee..d7f63785 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -32,37 +32,6 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x4::size() const - { - return 2; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x4::length() const - { - return 2; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER typename tmat2x4::col_type & tmat2x4::operator[](length_t i) - { - assert(i < this->length()); - return this->value[i]; - } - - template - GLM_FUNC_QUALIFIER typename tmat2x4::col_type const & tmat2x4::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 + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4::size_type tmat2x4::size() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x4::col_type & tmat2x4::operator[](typename tmat2x4::size_type i) + { + assert(i < this->size()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x4::col_type const & tmat2x4::operator[](typename tmat2x4::size_type i) const + { + assert(i < this->size()); + return this->value[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4::length_type tmat2x4::length() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x4::col_type & tmat2x4::operator[](typename tmat2x4::length_type i) + { + assert(i < this->length()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat2x4::col_type const & tmat2x4::operator[](typename tmat2x4::length_type i) const + { + assert(i < this->length()); + return this->value[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////////////////////////////// // Unary updatable operators diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 2d5efc43..706f91fd 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -44,18 +44,11 @@ namespace glm template struct tmat3x2 { - typedef T value_type; - typedef std::size_t size_type; typedef tvec2 col_type; typedef tvec3 row_type; typedef tmat3x2 type; typedef tmat2x3 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 const & x); GLM_FUNC_DECL explicit tmat3x2(tmat4x3 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 GLM_FUNC_DECL tmat3x2 & operator= (tmat3x2 const & m); diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index 777c7589..2c299dea 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -32,37 +32,6 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x2::size() const - { - return 3; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x2::length() const - { - return 3; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER typename tmat3x2::col_type & tmat3x2::operator[](length_t i) - { - assert(i < this->length()); - return this->value[i]; - } - - template - GLM_FUNC_QUALIFIER typename tmat3x2::col_type const & tmat3x2::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 + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2::size_type tmat3x2::size() const + { + return 3; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x2::col_type & tmat3x2::operator[](typename tmat3x2::size_type i) + { + assert(i < this->size()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x2::col_type const & tmat3x2::operator[](typename tmat3x2::size_type i) const + { + assert(i < this->size()); + return this->value[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2::length_type tmat3x2::length() const + { + return 3; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x2::col_type & tmat3x2::operator[](typename tmat3x2::length_type i) + { + assert(i < this->length()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x2::col_type const & tmat3x2::operator[](typename tmat3x2::length_type i) const + { + assert(i < this->length()); + return this->value[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////////////////////////////// // Unary updatable operators diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 03c0ba6b..b11c1344 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -43,18 +43,11 @@ namespace glm template struct tmat3x3 { - typedef T value_type; - typedef std::size_t size_type; typedef tvec3 col_type; typedef tvec3 row_type; typedef tmat3x3 type; typedef tmat3x3 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 friend tvec3 operator/(tmat3x3 const & m, tvec3 const & v); @@ -121,9 +114,25 @@ namespace glm GLM_FUNC_DECL explicit tmat3x3(tmat3x4 const & x); GLM_FUNC_DECL explicit tmat3x3(tmat4x3 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 GLM_FUNC_DECL tmat3x3& operator= (tmat3x3 const & m); diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index 4115b8f9..b36634a4 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -56,37 +56,6 @@ namespace detail } }//namespace detail -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x3::size() const - { - return 3; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x3::length() const - { - return 3; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER typename tmat3x3::col_type & tmat3x3::operator[](length_t i) - { - assert(i < this->length()); - return this->value[i]; - } - - template - GLM_FUNC_QUALIFIER typename tmat3x3::col_type const & tmat3x3::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 + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3::size_type tmat3x3::size() const + { + return 3; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x3::col_type & tmat3x3::operator[](typename tmat3x3::size_type i) + { + assert(i < this->size()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x3::col_type const & tmat3x3::operator[](typename tmat3x3::size_type i) const + { + assert(i < this->size()); + return this->value[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3::length_type tmat3x3::length() const + { + return 3; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x3::col_type & tmat3x3::operator[](typename tmat3x3::length_type i) + { + assert(i < this->length()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x3::col_type const & tmat3x3::operator[](typename tmat3x3::length_type i) const + { + assert(i < this->length()); + return this->value[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////////////////////////////// // Operators diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 48913218..caa4f7f3 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -44,18 +44,11 @@ namespace glm template struct tmat3x4 { - typedef T value_type; - typedef size_t size_type; typedef tvec4 col_type; typedef tvec3 row_type; typedef tmat3x4 type; typedef tmat4x3 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 const & x); GLM_FUNC_DECL explicit tmat3x4(tmat4x3 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 GLM_FUNC_DECL tmat3x4 & operator=(tmat3x4 const & m); diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 46755fa6..37258c36 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -32,37 +32,6 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x4::size() const - { - return 3; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x4::length() const - { - return 3; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER typename tmat3x4::col_type & tmat3x4::operator[](length_t i) - { - assert(i < this->length()); - return this->value[i]; - } - - template - GLM_FUNC_QUALIFIER typename tmat3x4::col_type const & tmat3x4::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 + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4::size_type tmat3x4::size() const + { + return 3; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x4::col_type & tmat3x4::operator[](typename tmat3x4::size_type i) + { + assert(i < this->size()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x4::col_type const & tmat3x4::operator[](typename tmat3x4::size_type i) const + { + assert(i < this->size()); + return this->value[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4::length_type tmat3x4::length() const + { + return 3; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x4::col_type & tmat3x4::operator[](typename tmat3x4::length_type i) + { + assert(i < this->length()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat3x4::col_type const & tmat3x4::operator[](typename tmat3x4::length_type i) const + { + assert(i < this->length()); + return this->value[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////////////////////////////// // Unary updatable operators diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index d52f0461..d6c11af0 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -44,18 +44,11 @@ namespace glm template struct tmat4x2 { - typedef T value_type; - typedef std::size_t size_type; typedef tvec2 col_type; typedef tvec4 row_type; typedef tmat4x2 type; typedef tmat2x4 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 const & x); GLM_FUNC_DECL explicit tmat4x2(tmat3x4 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 GLM_FUNC_DECL tmat4x2& operator=(tmat4x2 const & m); diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index 470b2ed3..7e758222 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -32,37 +32,6 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x2::size() const - { - return 4; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x2::length() const - { - return 4; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER typename tmat4x2::col_type & tmat4x2::operator[](length_t i) - { - assert(i < this->length()); - return this->value[i]; - } - - template - GLM_FUNC_QUALIFIER typename tmat4x2::col_type const & tmat4x2::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 + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2::size_type tmat4x2::size() const + { + return 4; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x2::col_type & tmat4x2::operator[](typename tmat4x2::size_type i) + { + assert(i < this->size()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x2::col_type const & tmat4x2::operator[](typename tmat4x2::size_type i) const + { + assert(i < this->size()); + return this->value[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2::length_type tmat4x2::length() const + { + return 4; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x2::col_type & tmat4x2::operator[](typename tmat4x2::length_type i) + { + assert(i < this->length()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x2::col_type const & tmat4x2::operator[](typename tmat4x2::length_type i) const + { + assert(i < this->length()); + return this->value[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////////////////////////////// // Unary updatable operators diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 31db995a..dbd95fb5 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -44,18 +44,11 @@ namespace glm template struct tmat4x3 { - typedef T value_type; - typedef std::size_t size_type; typedef tvec3 col_type; typedef tvec4 row_type; typedef tmat4x3 type; typedef tmat3x4 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 const & x); GLM_FUNC_DECL explicit tmat4x3(tmat3x4 const & x); + ////////////////////////////////////// // Accesses - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type 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 GLM_FUNC_DECL tmat4x3 & operator=(tmat4x3 const & m); diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index fae25fed..77a69ae5 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -32,37 +32,6 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x3::size() const - { - return 4; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x3::length() const - { - return 4; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER typename tmat4x3::col_type & tmat4x3::operator[](size_type i) - { - assert(i < this->length()); - return this->value[i]; - } - - template - GLM_FUNC_QUALIFIER typename tmat4x3::col_type const & tmat4x3::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 + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3::size_type tmat4x3::size() const + { + return 4; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x3::col_type & tmat4x3::operator[](typename tmat4x3::size_type i) + { + assert(i < this->size()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x3::col_type const & tmat4x3::operator[](typename tmat4x3::size_type i) const + { + assert(i < this->size()); + return this->value[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3::length_type tmat4x3::length() const + { + return 4; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x3::col_type & tmat4x3::operator[](typename tmat4x3::length_type i) + { + assert(i < this->length()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x3::col_type const & tmat4x3::operator[](typename tmat4x3::length_type i) const + { + assert(i < this->length()); + return this->value[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////////////////////////////// // Unary updatable operators diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index 993846e9..bc8cefff 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -43,18 +43,11 @@ namespace glm template struct tmat4x4 { - typedef T value_type; - typedef std::size_t size_type; typedef tvec4 col_type; typedef tvec4 row_type; typedef tmat4x4 type; typedef tmat4x4 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 friend tvec4 operator/(tmat4x4 const & m, tvec4 const & v); @@ -69,7 +62,6 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat4x4(); - //GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); template GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); @@ -127,11 +119,26 @@ namespace glm GLM_FUNC_DECL explicit tmat4x4(tmat3x4 const & x); GLM_FUNC_DECL explicit tmat4x4(tmat4x3 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 & operator=(tmat4x4 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 GLM_FUNC_DECL tmat4x4 & operator=(tmat4x4 const & m); template diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index 7ae20451..cf37e090 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -92,37 +92,6 @@ namespace detail } }//namespace detail -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x4::size() const - { - return 4; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x4::length() const - { - return 4; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER typename tmat4x4::col_type & tmat4x4::operator[](length_t i) - { - assert(i < this->length()); - return this->value[i]; - } - - template - GLM_FUNC_QUALIFIER typename tmat4x4::col_type const & tmat4x4::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 + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4::size_type tmat4x4::size() const + { + return 4; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x4::col_type & tmat4x4::operator[](typename tmat4x4::size_type i) + { + assert(i < this->size()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x4::col_type const & tmat4x4::operator[](typename tmat4x4::size_type i) const + { + assert(i < this->size()); + return this->value[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4::length_type tmat4x4::length() const + { + return 4; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x4::col_type & tmat4x4::operator[](typename tmat4x4::length_type i) + { + assert(i < this->length()); + return this->value[i]; + } + + template + GLM_FUNC_QUALIFIER typename tmat4x4::col_type const & tmat4x4::operator[](typename tmat4x4::length_type i) const + { + assert(i < this->length()); + return this->value[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////////////////////////////// // Operators diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 8d8bd05b..0c819ac8 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -55,17 +55,6 @@ namespace glm typedef tvec1 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 diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 110edce7..55811739 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -32,43 +32,12 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec1::size() const - { - return 1; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec1::length() const - { - return 1; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER T & tvec1::operator[](length_t i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER T const & tvec1::operator[](length_t i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - ////////////////////////////////////// // Implicit basic constructors template GLM_FUNC_QUALIFIER tvec1::tvec1() -# ifndef GLM_FORCE_NO_CTOR_INIT +# ifndef GLM_FORCE_NO_CTOR_INIT : x(0) # endif {} @@ -118,6 +87,51 @@ namespace glm : x(static_cast(v.x)) {} + ////////////////////////////////////// + // Component accesses + +# ifdef GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1::size_type tvec1::size() const + { + return 1; + } + + template + GLM_FUNC_QUALIFIER T & tvec1::operator[](typename tvec1::size_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tvec1::operator[](typename tvec1::size_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1::length_type tvec1::length() const + { + return 1; + } + + template + GLM_FUNC_QUALIFIER T & tvec1::operator[](typename tvec1::length_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tvec1::operator[](typename tvec1::length_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////// // Unary arithmetic operators diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index dc4de565..8ad6f946 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -54,18 +54,6 @@ namespace glm typedef tvec2 type; typedef tvec2 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 diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index b6645260..674f075c 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -32,44 +32,13 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec2::size() const - { - return 2; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec2::length() const - { - return 2; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER T & tvec2::operator[](length_t i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER T const & tvec2::operator[](length_t i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - ////////////////////////////////////// // Implicit basic constructors template GLM_FUNC_QUALIFIER tvec2::tvec2() # ifndef GLM_FORCE_NO_CTOR_INIT - : x(0), y(0) + : x(0), y(0) # endif {} @@ -92,8 +61,8 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tvec2::tvec2(T const & s1, T const & s2) - : x(s1), y(s2) + GLM_FUNC_QUALIFIER tvec2::tvec2(T const & a, T const & b) + : x(a), y(b) {} ////////////////////////////////////// @@ -137,6 +106,51 @@ namespace glm , y(static_cast(v.y)) {} + ////////////////////////////////////// + // Component accesses + +# ifdef GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2::size_type tvec2::size() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER T & tvec2::operator[](typename tvec2::size_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tvec2::operator[](typename tvec2::size_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2::length_type tvec2::length() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER T & tvec2::operator[](typename tvec2::length_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tvec2::operator[](typename tvec2::length_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////// // Unary arithmetic operators diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 581eef7f..094a3703 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -54,18 +54,6 @@ namespace glm typedef tvec3 type; typedef tvec3 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 diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 7cc96351..27c1b90d 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -32,37 +32,6 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec3::size() const - { - return 3; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec3::length() const - { - return 3; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER T & tvec3::operator[](length_t i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER T const & tvec3::operator[](length_t i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - ////////////////////////////////////// // Implicit basic constructors @@ -166,6 +135,51 @@ namespace glm z(static_cast(v.z)) {} + ////////////////////////////////////// + // Component accesses + +# ifdef GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3::size_type tvec3::size() const + { + return 3; + } + + template + GLM_FUNC_QUALIFIER T & tvec3::operator[](typename tvec3::size_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tvec3::operator[](typename tvec3::size_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3::length_type tvec3::length() const + { + return 3; + } + + template + GLM_FUNC_QUALIFIER T & tvec3::operator[](typename tvec3::length_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tvec3::operator[](typename tvec3::length_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////// // Unary arithmetic operators diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 7ae526c3..b62906a2 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -106,18 +106,6 @@ namespace detail typedef tvec4 type; typedef tvec4 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 diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 450fa6f5..f14b9cf2 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -32,37 +32,6 @@ namespace glm { -#ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec4::size() const - { - return 4; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec4::length() const - { - return 4; - } -#endif - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER T & tvec4::operator[](length_t i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER T const & tvec4::operator[](length_t i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - ////////////////////////////////////// // Implicit basic constructors @@ -268,6 +237,51 @@ namespace glm w(static_cast(v.w)) {} + ////////////////////////////////////// + // Component accesses + +# ifdef GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4::size_type tvec4::size() const + { + return 4; + } + + template + GLM_FUNC_QUALIFIER T & tvec4::operator[](typename tvec4::size_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tvec4::operator[](typename tvec4::size_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4::length_type tvec4::length() const + { + return 4; + } + + template + GLM_FUNC_QUALIFIER T & tvec4::operator[](typename tvec4::length_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tvec4::operator[](typename tvec4::length_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + ////////////////////////////////////// // Unary arithmetic operators diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index a76f4530..15372cd0 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -62,25 +62,30 @@ namespace glm template struct tquat { + typedef tquat type; typedef T value_type; - typedef tvec4 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 diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 31d489a8..d9615ce1 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -49,43 +49,57 @@ namespace detail }; }//namespace detail -#if GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tquat::size() const - { - return 4; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tquat::length() const - { - return 4; - } -#endif - ////////////////////////////////////// - // Accesses + // Component accesses - template - GLM_FUNC_QUALIFIER T & tquat::operator[] (length_t i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } +# ifdef GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat::size_type tquat::size() const + { + return 4; + } - template - GLM_FUNC_QUALIFIER T const & tquat::operator[] (length_t i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER T & tquat::operator[](typename tquat::size_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tquat::operator[](typename tquat::size_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat::length_type tquat::length() const + { + return 4; + } + + template + GLM_FUNC_QUALIFIER T & tquat::operator[](typename tquat::length_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tquat::operator[](typename tquat::length_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } +# endif//GLM_FORCE_SIZE_FUNC ////////////////////////////////////// // Implicit basic constructors template GLM_FUNC_QUALIFIER tquat::tquat() -# ifndef GLM_FORCE_NO_CTOR_INIT +# ifndef GLM_FORCE_NO_CTOR_INIT : x(0), y(0), z(0), w(1) # endif {} diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 4c1bd3d2..333d9681 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -67,14 +67,25 @@ namespace glm public: glm::tquat real, dual; -#if GLM_FORCE_SIZE_FUNC - /// Return the count of components of a dual quaternion - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; -#else - /// Return the count of components of a dual quaternion - GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; -#endif//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_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_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 + ////////////////////////////////////// // Implicit basic constructors @@ -104,10 +115,6 @@ namespace glm GLM_FUNC_DECL explicit tdualquat(tmat2x4 const & holder_mat); GLM_FUNC_DECL explicit tdualquat(tmat3x4 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 & operator*=(T const & s); GLM_FUNC_DECL tdualquat & operator/=(T const & s); diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 13312bff..eb1b5970 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -35,19 +35,53 @@ namespace glm { -#if GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tdualquat::size() const - { - return 2; - } -#else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tdualquat::length() const - { - return 2; - } -#endif + ////////////////////////////////////// + // Component accesses + +# ifdef GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tdualquat::size_type tdualquat::size() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER typename tdualquat::part_type & tdualquat::operator[](typename tdualquat::size_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&real)[i]; + } + + template + GLM_FUNC_QUALIFIER typename tdualquat::part_type const & tdualquat::operator[](typename tdualquat::size_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&real)[i]; + } +# else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tdualquat::length_type tdualquat::length() const + { + return 2; + } + + template + GLM_FUNC_QUALIFIER typename tdualquat::part_type & tdualquat::operator[](typename tdualquat::length_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&real)[i]; + } + + template + GLM_FUNC_QUALIFIER typename tdualquat::part_type const & tdualquat::operator[](typename tdualquat::length_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&real)[i]; + } +# endif//GLM_FORCE_SIZE_FUNC + + ////////////////////////////////////// + // Implicit basic constructors template GLM_FUNC_QUALIFIER tdualquat::tdualquat() @@ -113,24 +147,7 @@ namespace glm } ////////////////////////////////////////////////////////////// - // tdualquat accesses - - template - GLM_FUNC_QUALIFIER typename tdualquat::part_type & tdualquat::operator[](length_t i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&real)[i]; - } - - template - GLM_FUNC_QUALIFIER typename tdualquat::part_type const & tdualquat::operator[](length_t i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&real)[i]; - } - - ////////////////////////////////////////////////////////////// - // tdualquat operators + // tdualquat operators template GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator*=(T const & s)