diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 2c32626f..3575f603 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -87,7 +87,7 @@ namespace detail GLM_FUNC_QUALIFIER static vecType call(vecType const & x, vecType const & y, vecType const & a) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = a[i] ? y[i] : x[i]; return Result; } diff --git a/glm/detail/func_matrix.inl b/glm/detail/func_matrix.inl index 1ebed1fb..8328b9eb 100644 --- a/glm/detail/func_matrix.inl +++ b/glm/detail/func_matrix.inl @@ -270,7 +270,7 @@ namespace detail GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'matrixCompMult' only accept floating-point inputs"); matType result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(result); ++i) + for(length_t i = 0; i < result.length(); ++i) result[i] = x[i] * y[i]; return result; } @@ -281,7 +281,7 @@ namespace detail GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); typename detail::outerProduct_trait::type m(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(m); ++i) + for(length_t i = 0; i < m.length(); ++i) m[i] = c * r[i]; return m; } diff --git a/glm/detail/func_vector_relational.inl b/glm/detail/func_vector_relational.inl index 72106d6e..a511ee8d 100644 --- a/glm/detail/func_vector_relational.inl +++ b/glm/detail/func_vector_relational.inl @@ -37,10 +37,10 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType lessThan(vecType const & x, vecType const & y) { - assert(detail::component_count(x) == detail::component_count(y)); + assert(x.length() == y.length()); vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] < y[i]; return Result; @@ -49,10 +49,10 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType lessThanEqual(vecType const & x, vecType const & y) { - assert(detail::component_count(x) == detail::component_count(y)); + assert(x.length() == y.length()); vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] <= y[i]; return Result; } @@ -60,10 +60,10 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType greaterThan(vecType const & x, vecType const & y) { - assert(detail::component_count(x) == detail::component_count(y)); + assert(x.length() == y.length()); vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] > y[i]; return Result; } @@ -71,10 +71,10 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType greaterThanEqual(vecType const & x, vecType const & y) { - assert(detail::component_count(x) == detail::component_count(y)); + assert(x.length() == y.length()); vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] >= y[i]; return Result; } @@ -82,10 +82,10 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType equal(vecType const & x, vecType const & y) { - assert(detail::component_count(x) == detail::component_count(y)); + assert(x.length() == y.length()); vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] == y[i]; return Result; } @@ -93,10 +93,10 @@ namespace glm template class vecType> GLM_FUNC_QUALIFIER vecType notEqual(vecType const & x, vecType const & y) { - assert(detail::component_count(x) == detail::component_count(y)); + assert(x.length() == y.length()); vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] != y[i]; return Result; } @@ -105,7 +105,7 @@ namespace glm GLM_FUNC_QUALIFIER bool any(vecType const & v) { bool Result = false; - for(detail::component_count_t i = 0; i < detail::component_count(v); ++i) + for(length_t i = 0; i < v.length(); ++i) Result = Result || v[i]; return Result; } @@ -114,7 +114,7 @@ namespace glm GLM_FUNC_QUALIFIER bool all(vecType const & v) { bool Result = true; - for(detail::component_count_t i = 0; i < detail::component_count(v); ++i) + for(length_t i = 0; i < v.length(); ++i) Result = Result && v[i]; return Result; } @@ -123,7 +123,7 @@ namespace glm GLM_FUNC_QUALIFIER vecType not_(vecType const & v) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(v); ++i) + for(length_t i = 0; i < v.length(); ++i) Result[i] = !v[i]; return Result; } diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index c69852a6..b4688035 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -986,37 +986,16 @@ namespace glm { using std::size_t; -# if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC) +# if defined(GLM_FORCE_SIZE_T_LENGTH) typedef size_t length_t; # else typedef int length_t; # endif - -namespace detail -{ -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t component_count_t; -# else - typedef length_t component_count_t; -# endif - - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR component_count_t component_count(genType const & m) - { -# ifdef GLM_FORCE_SIZE_FUNC - return m.size(); -# else - return m.length(); -# endif - } -}//namespace detail }//namespace glm #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH) # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH -# if defined GLM_FORCE_SIZE_FUNC -# pragma message("GLM: .length() is replaced by .size() and returns a std::size_t") -# elif defined GLM_FORCE_SIZE_T_LENGTH +# if defined GLM_FORCE_SIZE_T_LENGTH # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t") # else # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification") diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index db4758fa..31e4734d 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -199,47 +199,25 @@ namespace detail // -- 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 GLM_CONSTEXPR typename tmat2x2::length_type tmat2x2::length() 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 & 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::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 + 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]; + } // -- Unary updatable operators -- diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index da412319..e5d910f3 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -62,10 +62,10 @@ namespace glm GLM_FUNC_DECL tmat2x3(tmat2x3 const & m); GLM_FUNC_DECL explicit tmat2x3(ctor); - GLM_FUNC_DECL explicit tmat2x3(T const & s); + GLM_FUNC_DECL explicit tmat2x3(T scalar); GLM_FUNC_DECL tmat2x3( - T const & x0, T const & y0, T const & z0, - T const & x1, T const & y1, T const & z1); + T x0, T y0, T z0, + T x1, T y1, T z1); GLM_FUNC_DECL tmat2x3( col_type const & v0, col_type const & v1); @@ -74,8 +74,8 @@ namespace glm template GLM_FUNC_DECL tmat2x3( - X1 const & x1, Y1 const & y1, Z1 const & z1, - X2 const & x2, Y2 const & y2, Z2 const & z2); + X1 x1, Y1 y1, Z1 z1, + X2 x2, Y2 y2, Z2 z2); template GLM_FUNC_DECL tmat2x3( @@ -142,22 +142,22 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tmat2x3 operator+(tmat2x3 const & m, T const & s); + GLM_FUNC_DECL tmat2x3 operator+(tmat2x3 const & m, T scalar); template GLM_FUNC_DECL tmat2x3 operator+(tmat2x3 const & m1, tmat2x3 const & m2); template - GLM_FUNC_DECL tmat2x3 operator-(tmat2x3 const & m, T const & s); + GLM_FUNC_DECL tmat2x3 operator-(tmat2x3 const & m, T scalar); template GLM_FUNC_DECL tmat2x3 operator-(tmat2x3 const & m1, tmat2x3 const & m2); template - GLM_FUNC_DECL tmat2x3 operator*(tmat2x3 const & m, T const & s); + GLM_FUNC_DECL tmat2x3 operator*(tmat2x3 const & m, T scalar); template - GLM_FUNC_DECL tmat2x3 operator*(T const & s, tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 operator*(T scalar, tmat2x3 const & m); template GLM_FUNC_DECL typename tmat2x3::col_type operator*(tmat2x3 const & m, typename tmat2x3::row_type const & v); @@ -175,10 +175,10 @@ namespace glm GLM_FUNC_DECL tmat4x3 operator*(tmat2x3 const & m1, tmat4x2 const & m2); template - GLM_FUNC_DECL tmat2x3 operator/(tmat2x3 const & m, T const & s); + GLM_FUNC_DECL tmat2x3 operator/(tmat2x3 const & m, T scalar); template - GLM_FUNC_DECL tmat2x3 operator/(T const & s, tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 operator/(T scalar, tmat2x3 const & m); // -- Boolean operators -- diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 76c00f50..8ea5e746 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -67,17 +67,17 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tmat2x3::tmat2x3(T const & s) + GLM_FUNC_QUALIFIER tmat2x3::tmat2x3(T scalar) { - this->value[0] = col_type(s, 0, 0); - this->value[1] = col_type(0, s, 0); + this->value[0] = col_type(scalar, 0, 0); + this->value[1] = col_type(0, scalar, 0); } template GLM_FUNC_QUALIFIER tmat2x3::tmat2x3 ( - T const & x0, T const & y0, T const & z0, - T const & x1, T const & y1, T const & z1 + T x0, T y0, T z0, + T x1, T y1, T z1 ) { this->value[0] = col_type(x0, y0, z0); @@ -99,8 +99,8 @@ namespace glm typename X2, typename Y2, typename Z2> GLM_FUNC_QUALIFIER tmat2x3::tmat2x3 ( - X1 const & x1, Y1 const & y1, Z1 const & z1, - X2 const & x2, Y2 const & y2, Z2 const & z2 + X1 x1, Y1 y1, Z1 z1, + X2 x2, Y2 y2, Z2 z2 ) { this->value[0] = col_type(static_cast(x1), value_type(y1), value_type(z1)); @@ -183,47 +183,25 @@ namespace glm // -- 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 GLM_CONSTEXPR typename tmat2x3::length_type tmat2x3::length() 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 & 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::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 + 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]; + } // -- Unary updatable operators -- @@ -353,11 +331,11 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x3 operator+(tmat2x3 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x3 operator+(tmat2x3 const & m, T scalar) { return tmat2x3( - m[0] + s, - m[1] + s); + m[0] + scalar, + m[1] + scalar); } template @@ -369,11 +347,11 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x3 operator-(tmat2x3 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x3 operator-(tmat2x3 const & m, T scalar) { return tmat2x3( - m[0] - s, - m[1] - s); + m[0] - scalar, + m[1] - scalar); } template @@ -385,19 +363,19 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x3 operator*(tmat2x3 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x3 operator*(tmat2x3 const & m, T scalar) { return tmat2x3( - m[0] * s, - m[1] * s); + m[0] * scalar, + m[1] * scalar); } template - GLM_FUNC_QUALIFIER tmat2x3 operator*(T const & s, tmat2x3 const & m) + GLM_FUNC_QUALIFIER tmat2x3 operator*(T scalar, tmat2x3 const & m) { return tmat2x3( - m[0] * s, - m[1] * s); + m[0] * scalar, + m[1] * scalar); } template @@ -484,19 +462,19 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x3 operator/(tmat2x3 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x3 operator/(tmat2x3 const & m, T scalar) { return tmat2x3( - m[0] / s, - m[1] / s); + m[0] / scalar, + m[1] / scalar); } template - GLM_FUNC_QUALIFIER tmat2x3 operator/(T const & s, tmat2x3 const & m) + GLM_FUNC_QUALIFIER tmat2x3 operator/(T scalar, tmat2x3 const & m) { return tmat2x3( - s / m[0], - s / m[1]); + scalar / m[0], + scalar / m[1]); } // -- Boolean operators -- diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 45dfe142..91e23272 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -62,10 +62,10 @@ namespace glm GLM_FUNC_DECL tmat2x4(tmat2x4 const & m); GLM_FUNC_DECL explicit tmat2x4(ctor); - GLM_FUNC_DECL explicit tmat2x4(T const & s); + GLM_FUNC_DECL explicit tmat2x4(T scalar); GLM_FUNC_DECL tmat2x4( - T const & x0, T const & y0, T const & z0, T const & w0, - T const & x1, T const & y1, T const & z1, T const & w1); + T x0, T y0, T z0, T w0, + T x1, T y1, T z1, T w1); GLM_FUNC_DECL tmat2x4( col_type const & v0, col_type const & v1); @@ -76,8 +76,8 @@ namespace glm typename X1, typename Y1, typename Z1, typename W1, typename X2, typename Y2, typename Z2, typename W2> GLM_FUNC_DECL tmat2x4( - X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, - X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2); + X1 x1, Y1 y1, Z1 z1, W1 w1, + X2 x2, Y2 y2, Z2 z2, W2 w2); template GLM_FUNC_DECL tmat2x4( @@ -144,22 +144,22 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tmat2x4 operator+(tmat2x4 const & m, T const & s); + GLM_FUNC_DECL tmat2x4 operator+(tmat2x4 const & m, T scalar); template GLM_FUNC_DECL tmat2x4 operator+(tmat2x4 const & m1, tmat2x4 const & m2); template - GLM_FUNC_DECL tmat2x4 operator-(tmat2x4 const & m, T const & s); + GLM_FUNC_DECL tmat2x4 operator-(tmat2x4 const & m, T scalar); template GLM_FUNC_DECL tmat2x4 operator-(tmat2x4 const & m1, tmat2x4 const & m2); template - GLM_FUNC_DECL tmat2x4 operator*(tmat2x4 const & m, T const & s); + GLM_FUNC_DECL tmat2x4 operator*(tmat2x4 const & m, T scalar); template - GLM_FUNC_DECL tmat2x4 operator*(T const & s, tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 operator*(T scalar, tmat2x4 const & m); template GLM_FUNC_DECL typename tmat2x4::col_type operator*(tmat2x4 const & m, typename tmat2x4::row_type const & v); @@ -177,10 +177,10 @@ namespace glm GLM_FUNC_DECL tmat3x4 operator*(tmat2x4 const & m1, tmat3x2 const & m2); template - GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, T const & s); + GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, T scalar); template - GLM_FUNC_DECL tmat2x4 operator/(T const & s, tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 operator/(T scalar, tmat2x4 const & m); // -- Boolean operators -- diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 8d6f824e..d7b47007 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -67,18 +67,18 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tmat2x4::tmat2x4(T const & s) + GLM_FUNC_QUALIFIER tmat2x4::tmat2x4(T scalar) { value_type const Zero(0); - this->value[0] = col_type(s, Zero, Zero, Zero); - this->value[1] = col_type(Zero, s, Zero, Zero); + this->value[0] = col_type(scalar, Zero, Zero, Zero); + this->value[1] = col_type(Zero, scalar, Zero, Zero); } template GLM_FUNC_QUALIFIER tmat2x4::tmat2x4 ( - T const & x0, T const & y0, T const & z0, T const & w0, - T const & x1, T const & y1, T const & z1, T const & w1 + T x0, T y0, T z0, T w0, + T x1, T y1, T z1, T w1 ) { this->value[0] = col_type(x0, y0, z0, w0); @@ -100,8 +100,8 @@ namespace glm typename X2, typename Y2, typename Z2, typename W2> GLM_FUNC_QUALIFIER tmat2x4::tmat2x4 ( - X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, - X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2 + X1 x1, Y1 y1, Z1 z1, W1 w1, + X2 x2, Y2 y2, Z2 z2, W2 w2 ) { this->value[0] = col_type(static_cast(x1), value_type(y1), value_type(z1), value_type(w1)); @@ -184,47 +184,25 @@ namespace glm // -- 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 GLM_CONSTEXPR typename tmat2x4::length_type tmat2x4::length() 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 & 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::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 + 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]; + } // -- Unary updatable operators -- @@ -354,11 +332,11 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x4 operator+(tmat2x4 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x4 operator+(tmat2x4 const & m, T scalar) { return tmat2x4( - m[0] + s, - m[1] + s); + m[0] + scalar, + m[1] + scalar); } template @@ -370,11 +348,11 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x4 operator-(tmat2x4 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x4 operator-(tmat2x4 const & m, T scalar) { return tmat2x4( - m[0] - s, - m[1] - s); + m[0] - scalar, + m[1] - scalar); } template @@ -386,19 +364,19 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x4 operator*(tmat2x4 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x4 operator*(tmat2x4 const & m, T scalar) { return tmat2x4( - m[0] * s, - m[1] * s); + m[0] * scalar, + m[1] * scalar); } template - GLM_FUNC_QUALIFIER tmat2x4 operator*(T const & s, tmat2x4 const & m) + GLM_FUNC_QUALIFIER tmat2x4 operator*(T scalar, tmat2x4 const & m) { return tmat2x4( - m[0] * s, - m[1] * s); + m[0] * scalar, + m[1] * scalar); } template @@ -493,19 +471,19 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, T scalar) { return tmat2x4( - m[0] / s, - m[1] / s); + m[0] / scalar, + m[1] / scalar); } template - GLM_FUNC_QUALIFIER tmat2x4 operator/(T const & s, tmat2x4 const & m) + GLM_FUNC_QUALIFIER tmat2x4 operator/(T scalar, tmat2x4 const & m) { return tmat2x4( - s / m[0], - s / m[1]); + scalar / m[0], + scalar / m[1]); } // -- Boolean operators -- diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 06922b6b..ddaef432 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -62,11 +62,11 @@ namespace glm GLM_FUNC_DECL tmat3x2(tmat3x2 const & m); GLM_FUNC_DECL explicit tmat3x2(ctor); - GLM_FUNC_DECL explicit tmat3x2(T const & s); + GLM_FUNC_DECL explicit tmat3x2(T scalar); GLM_FUNC_DECL tmat3x2( - T const & x0, T const & y0, - T const & x1, T const & y1, - T const & x2, T const & y2); + T x0, T y0, + T x1, T y1, + T x2, T y2); GLM_FUNC_DECL tmat3x2( col_type const & v0, col_type const & v1, @@ -79,9 +79,9 @@ namespace glm typename X2, typename Y2, typename X3, typename Y3> GLM_FUNC_DECL tmat3x2( - X1 const & x1, Y1 const & y1, - X2 const & x2, Y2 const & y2, - X3 const & x3, Y3 const & y3); + X1 x1, Y1 y1, + X2 x2, Y2 y2, + X3 x3, Y3 y3); template GLM_FUNC_DECL tmat3x2( @@ -149,22 +149,22 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tmat3x2 operator+(tmat3x2 const & m, T const & s); + GLM_FUNC_DECL tmat3x2 operator+(tmat3x2 const & m, T scalar); template GLM_FUNC_DECL tmat3x2 operator+(tmat3x2 const & m1, tmat3x2 const & m2); template - GLM_FUNC_DECL tmat3x2 operator-(tmat3x2 const & m, T const & s); + GLM_FUNC_DECL tmat3x2 operator-(tmat3x2 const & m, T scalar); template GLM_FUNC_DECL tmat3x2 operator-(tmat3x2 const & m1, tmat3x2 const & m2); template - GLM_FUNC_DECL tmat3x2 operator*(tmat3x2 const & m, T const & s); + GLM_FUNC_DECL tmat3x2 operator*(tmat3x2 const & m, T scalar); template - GLM_FUNC_DECL tmat3x2 operator*(T const & s, tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 operator*(T scalar, tmat3x2 const & m); template GLM_FUNC_DECL typename tmat3x2::col_type operator*(tmat3x2 const & m, typename tmat3x2::row_type const & v); @@ -182,10 +182,10 @@ namespace glm GLM_FUNC_DECL tmat4x2 operator*(tmat3x2 const & m1, tmat4x3 const & m2); template - GLM_FUNC_DECL tmat3x2 operator/(tmat3x2 const & m, T const & s); + GLM_FUNC_DECL tmat3x2 operator/(tmat3x2 const & m, T scalar); template - GLM_FUNC_DECL tmat3x2 operator/(T const & s, tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 operator/(T scalar, tmat3x2 const & m); // -- Boolean operators -- diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index f497e395..e39839eb 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -70,19 +70,19 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tmat3x2::tmat3x2(T const & s) + GLM_FUNC_QUALIFIER tmat3x2::tmat3x2(T scalar) { - this->value[0] = col_type(s, 0); - this->value[1] = col_type(0, s); + this->value[0] = col_type(scalar, 0); + this->value[1] = col_type(0, scalar); this->value[2] = col_type(0, 0); } template GLM_FUNC_QUALIFIER tmat3x2::tmat3x2 ( - T const & x0, T const & y0, - T const & x1, T const & y1, - T const & x2, T const & y2 + T x0, T y0, + T x1, T y1, + T x2, T y2 ) { this->value[0] = col_type(x0, y0); @@ -112,9 +112,9 @@ namespace glm typename X3, typename Y3> GLM_FUNC_QUALIFIER tmat3x2::tmat3x2 ( - X1 const & x1, Y1 const & y1, - X2 const & x2, Y2 const & y2, - X3 const & x3, Y3 const & y3 + X1 x1, Y1 y1, + X2 x2, Y2 y2, + X3 x3, Y3 y3 ) { this->value[0] = col_type(static_cast(x1), value_type(y1)); @@ -213,47 +213,25 @@ namespace glm // -- 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 GLM_CONSTEXPR typename tmat3x2::length_type tmat3x2::length() 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 & 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::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 + 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]; + } // -- Unary updatable operators -- @@ -394,12 +372,12 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat3x2 operator+(tmat3x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x2 operator+(tmat3x2 const & m, T scalar) { return tmat3x2( - m[0] + s, - m[1] + s, - m[2] + s); + m[0] + scalar, + m[1] + scalar, + m[2] + scalar); } template @@ -412,12 +390,12 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat3x2 operator-(tmat3x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x2 operator-(tmat3x2 const & m, T scalar) { return tmat3x2( - m[0] - s, - m[1] - s, - m[2] - s); + m[0] - scalar, + m[1] - scalar, + m[2] - scalar); } template @@ -430,21 +408,21 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat3x2 operator*(tmat3x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x2 operator*(tmat3x2 const & m, T scalar) { return tmat3x2( - m[0] * s, - m[1] * s, - m[2] * s); + m[0] * scalar, + m[1] * scalar, + m[2] * scalar); } template - GLM_FUNC_QUALIFIER tmat3x2 operator*(T const & s, tmat3x2 const & m) + GLM_FUNC_QUALIFIER tmat3x2 operator*(T scalar, tmat3x2 const & m) { return tmat3x2( - m[0] * s, - m[1] * s, - m[2] * s); + m[0] * scalar, + m[1] * scalar, + m[2] * scalar); } template @@ -516,21 +494,21 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat3x2 operator/(tmat3x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x2 operator/(tmat3x2 const & m, T scalar) { return tmat3x2( - m[0] / s, - m[1] / s, - m[2] / s); + m[0] / scalar, + m[1] / scalar, + m[2] / scalar); } template - GLM_FUNC_QUALIFIER tmat3x2 operator/(T const & s, tmat3x2 const & m) + GLM_FUNC_QUALIFIER tmat3x2 operator/(T scalar, tmat3x2 const & m) { return tmat3x2( - s / m[0], - s / m[1], - s / m[2]); + scalar / m[0], + scalar / m[1], + scalar / m[2]); } // -- Boolean operators -- diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 3b90536b..3dd2d102 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -61,11 +61,11 @@ namespace glm GLM_FUNC_DECL tmat3x3(tmat3x3 const & m); GLM_FUNC_DECL explicit tmat3x3(ctor); - GLM_FUNC_DECL explicit tmat3x3(T const & s); + GLM_FUNC_DECL explicit tmat3x3(T scalar); GLM_FUNC_DECL tmat3x3( - T const & x0, T const & y0, T const & z0, - T const & x1, T const & y1, T const & z1, - T const & x2, T const & y2, T const & z2); + T x0, T y0, T z0, + T x1, T y1, T z1, + T x2, T y2, T z2); GLM_FUNC_DECL tmat3x3( col_type const & v0, col_type const & v1, @@ -78,9 +78,9 @@ namespace glm typename X2, typename Y2, typename Z2, typename X3, typename Y3, typename Z3> GLM_FUNC_DECL tmat3x3( - X1 const & x1, Y1 const & y1, Z1 const & z1, - X2 const & x2, Y2 const & y2, Z2 const & z2, - X3 const & x3, Y3 const & y3, Z3 const & z3); + X1 x1, Y1 y1, Z1 z1, + X2 x2, Y2 y2, Z2 z2, + X3 x3, Y3 y3, Z3 z3); template GLM_FUNC_DECL tmat3x3( @@ -152,28 +152,28 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tmat3x3 operator+(tmat3x3 const & m, T const & s); + GLM_FUNC_DECL tmat3x3 operator+(tmat3x3 const & m, T scalar); template - GLM_FUNC_DECL tmat3x3 operator+(T const & s, tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator+(T scalar, tmat3x3 const & m); template GLM_FUNC_DECL tmat3x3 operator+(tmat3x3 const & m1, tmat3x3 const & m2); template - GLM_FUNC_DECL tmat3x3 operator-(tmat3x3 const & m, T const & s); + GLM_FUNC_DECL tmat3x3 operator-(tmat3x3 const & m, T scalar); template - GLM_FUNC_DECL tmat3x3 operator-(T const & s, tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator-(T scalar, tmat3x3 const & m); template GLM_FUNC_DECL tmat3x3 operator-(tmat3x3 const & m1, tmat3x3 const & m2); template - GLM_FUNC_DECL tmat3x3 operator*(tmat3x3 const & m, T const & s); + GLM_FUNC_DECL tmat3x3 operator*(tmat3x3 const & m, T scalar); template - GLM_FUNC_DECL tmat3x3 operator*(T const & s, tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator*(T scalar, tmat3x3 const & m); template GLM_FUNC_DECL typename tmat3x3::col_type operator*(tmat3x3 const & m, typename tmat3x3::row_type const & v); @@ -191,10 +191,10 @@ namespace glm GLM_FUNC_DECL tmat4x3 operator*(tmat3x3 const & m1, tmat4x3 const & m2); template - GLM_FUNC_DECL tmat3x3 operator/(tmat3x3 const & m, T const & s); + GLM_FUNC_DECL tmat3x3 operator/(tmat3x3 const & m, T scalar); template - GLM_FUNC_DECL tmat3x3 operator/(T const & s, tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator/(T scalar, tmat3x3 const & m); template GLM_FUNC_DECL typename tmat3x3::col_type operator/(tmat3x3 const & m, typename tmat3x3::row_type const & v); diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index 9ee0111e..24aec439 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -94,19 +94,19 @@ namespace detail {} template - GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(T const & s) + GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(T scalar) { - this->value[0] = col_type(s, 0, 0); - this->value[1] = col_type(0, s, 0); - this->value[2] = col_type(0, 0, s); + this->value[0] = col_type(scalar, 0, 0); + this->value[1] = col_type(0, scalar, 0); + this->value[2] = col_type(0, 0, scalar); } template GLM_FUNC_QUALIFIER tmat3x3::tmat3x3 ( - T const & x0, T const & y0, T const & z0, - T const & x1, T const & y1, T const & z1, - T const & x2, T const & y2, T const & z2 + T x0, T y0, T z0, + T x1, T y1, T z1, + T x2, T y2, T z2 ) { this->value[0] = col_type(x0, y0, z0); @@ -136,9 +136,9 @@ namespace detail typename X3, typename Y3, typename Z3> GLM_FUNC_QUALIFIER tmat3x3::tmat3x3 ( - X1 const & x1, Y1 const & y1, Z1 const & z1, - X2 const & x2, Y2 const & y2, Z2 const & z2, - X3 const & x3, Y3 const & y3, Z3 const & z3 + X1 x1, Y1 y1, Z1 z1, + X2 x2, Y2 y2, Z2 z2, + X3 x3, Y3 y3, Z3 z3 ) { this->value[0] = col_type(static_cast(x1), value_type(y1), value_type(z1)); @@ -237,47 +237,25 @@ namespace detail // -- 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 GLM_CONSTEXPR typename tmat3x3::length_type tmat3x3::length() 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 & 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::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 + 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]; + } // -- Unary updatable operators -- @@ -432,21 +410,21 @@ namespace detail // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat3x3 operator+(tmat3x3 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x3 operator+(tmat3x3 const & m, T scalar) { return tmat3x3( - m[0] + s, - m[1] + s, - m[2] + s); + m[0] + scalar, + m[1] + scalar, + m[2] + scalar); } template - GLM_FUNC_QUALIFIER tmat3x3 operator+(T const & s, tmat3x3 const & m) + GLM_FUNC_QUALIFIER tmat3x3 operator+(T scalar, tmat3x3 const & m) { return tmat3x3( - m[0] + s, - m[1] + s, - m[2] + s); + m[0] + scalar, + m[1] + scalar, + m[2] + scalar); } template @@ -459,21 +437,21 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat3x3 operator-(tmat3x3 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x3 operator-(tmat3x3 const & m, T scalar) { return tmat3x3( - m[0] - s, - m[1] - s, - m[2] - s); + m[0] - scalar, + m[1] - scalar, + m[2] - scalar); } template - GLM_FUNC_QUALIFIER tmat3x3 operator-(T const & s, tmat3x3 const & m) + GLM_FUNC_QUALIFIER tmat3x3 operator-(T scalar, tmat3x3 const & m) { return tmat3x3( - s - m[0], - s - m[1], - s - m[2]); + scalar - m[0], + scalar - m[1], + scalar - m[2]); } template @@ -486,21 +464,21 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat3x3 operator*(tmat3x3 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x3 operator*(tmat3x3 const & m, T scalar) { return tmat3x3( - m[0] * s, - m[1] * s, - m[2] * s); + m[0] * scalar, + m[1] * scalar, + m[2] * scalar); } template - GLM_FUNC_QUALIFIER tmat3x3 operator*(T const & s, tmat3x3 const & m) + GLM_FUNC_QUALIFIER tmat3x3 operator*(T scalar, tmat3x3 const & m) { return tmat3x3( - m[0] * s, - m[1] * s, - m[2] * s); + m[0] * scalar, + m[1] * scalar, + m[2] * scalar); } template @@ -588,21 +566,21 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat3x3 operator/(tmat3x3 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x3 operator/(tmat3x3 const & m, T scalar) { return tmat3x3( - m[0] / s, - m[1] / s, - m[2] / s); + m[0] / scalar, + m[1] / scalar, + m[2] / scalar); } template - GLM_FUNC_QUALIFIER tmat3x3 operator/(T const & s, tmat3x3 const & m) + GLM_FUNC_QUALIFIER tmat3x3 operator/(T scalar, tmat3x3 const & m) { return tmat3x3( - s / m[0], - s / m[1], - s / m[2]); + scalar / m[0], + scalar / m[1], + scalar / m[2]); } template diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 445340ec..4c5691b6 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -62,11 +62,11 @@ namespace glm GLM_FUNC_DECL tmat3x4(tmat3x4 const & m); GLM_FUNC_DECL explicit tmat3x4(ctor); - GLM_FUNC_DECL explicit tmat3x4(T const & s); + GLM_FUNC_DECL explicit tmat3x4(T scalar); GLM_FUNC_DECL tmat3x4( - T const & x0, T const & y0, T const & z0, T const & w0, - T const & x1, T const & y1, T const & z1, T const & w1, - T const & x2, T const & y2, T const & z2, T const & w2); + T x0, T y0, T z0, T w0, + T x1, T y1, T z1, T w1, + T x2, T y2, T z2, T w2); GLM_FUNC_DECL tmat3x4( col_type const & v0, col_type const & v1, @@ -79,9 +79,9 @@ namespace glm typename X2, typename Y2, typename Z2, typename W2, typename X3, typename Y3, typename Z3, typename W3> GLM_FUNC_DECL tmat3x4( - X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, - X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, - X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3); + X1 x1, Y1 y1, Z1 z1, W1 w1, + X2 x2, Y2 y2, Z2 z2, W2 w2, + X3 x3, Y3 y3, Z3 z3, W3 w3); template GLM_FUNC_DECL tmat3x4( @@ -149,22 +149,22 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tmat3x4 operator+(tmat3x4 const & m, T const & s); + GLM_FUNC_DECL tmat3x4 operator+(tmat3x4 const & m, T scalar); template GLM_FUNC_DECL tmat3x4 operator+(tmat3x4 const & m1, tmat3x4 const & m2); template - GLM_FUNC_DECL tmat3x4 operator-(tmat3x4 const & m, T const & s); + GLM_FUNC_DECL tmat3x4 operator-(tmat3x4 const & m, T scalar); template GLM_FUNC_DECL tmat3x4 operator-(tmat3x4 const & m1, tmat3x4 const & m2); template - GLM_FUNC_DECL tmat3x4 operator*(tmat3x4 const & m, T const & s); + GLM_FUNC_DECL tmat3x4 operator*(tmat3x4 const & m, T scalar); template - GLM_FUNC_DECL tmat3x4 operator*(T const & s, tmat3x4 const & m); + GLM_FUNC_DECL tmat3x4 operator*(T scalar, tmat3x4 const & m); template GLM_FUNC_DECL typename tmat3x4::col_type operator*(tmat3x4 const & m, typename tmat3x4::row_type const & v); @@ -182,10 +182,10 @@ namespace glm GLM_FUNC_DECL tmat3x4 operator*(tmat3x4 const & m1, tmat3x3 const & m2); template - GLM_FUNC_DECL tmat3x4 operator/(tmat3x4 const & m, T const & s); + GLM_FUNC_DECL tmat3x4 operator/(tmat3x4 const & m, T scalar); template - GLM_FUNC_DECL tmat3x4 operator/(T const & s, tmat3x4 const & m); + GLM_FUNC_DECL tmat3x4 operator/(T scalar, tmat3x4 const & m); // -- Boolean operators -- diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 3991d95d..ba6149c4 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -70,19 +70,19 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tmat3x4::tmat3x4(T const & s) + GLM_FUNC_QUALIFIER tmat3x4::tmat3x4(T scalar) { - this->value[0] = col_type(s, 0, 0, 0); - this->value[1] = col_type(0, s, 0, 0); - this->value[2] = col_type(0, 0, s, 0); + this->value[0] = col_type(scalar, 0, 0, 0); + this->value[1] = col_type(0, scalar, 0, 0); + this->value[2] = col_type(0, 0, scalar, 0); } template GLM_FUNC_QUALIFIER tmat3x4::tmat3x4 ( - T const & x0, T const & y0, T const & z0, T const & w0, - T const & x1, T const & y1, T const & z1, T const & w1, - T const & x2, T const & y2, T const & z2, T const & w2 + T x0, T y0, T z0, T w0, + T x1, T y1, T z1, T w1, + T x2, T y2, T z2, T w2 ) { this->value[0] = col_type(x0, y0, z0, w0); @@ -112,9 +112,9 @@ namespace glm typename X3, typename Y3, typename Z3, typename W3> GLM_FUNC_QUALIFIER tmat3x4::tmat3x4 ( - X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, - X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, - X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3 + X1 x1, Y1 y1, Z1 z1, W1 w1, + X2 x2, Y2 y2, Z2 z2, W2 w2, + X3 x3, Y3 y3, Z3 z3, W3 w3 ) { this->value[0] = col_type(static_cast(x1), value_type(y1), value_type(z1), value_type(w1)); @@ -213,47 +213,25 @@ namespace glm // -- 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 GLM_CONSTEXPR typename tmat3x4::length_type tmat3x4::length() 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 & 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::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 + 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]; + } // -- Unary updatable operators -- @@ -394,12 +372,12 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat3x4 operator+(tmat3x4 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x4 operator+(tmat3x4 const & m, T scalar) { return tmat3x4( - m[0] + s, - m[1] + s, - m[2] + s); + m[0] + scalar, + m[1] + scalar, + m[2] + scalar); } template @@ -412,12 +390,12 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat3x4 operator-(tmat3x4 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x4 operator-(tmat3x4 const & m, T scalar) { return tmat3x4( - m[0] - s, - m[1] - s, - m[2] - s); + m[0] - scalar, + m[1] - scalar, + m[2] - scalar); } template @@ -430,21 +408,21 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat3x4 operator*(tmat3x4 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x4 operator*(tmat3x4 const & m, T scalar) { return tmat3x4( - m[0] * s, - m[1] * s, - m[2] * s); + m[0] * scalar, + m[1] * scalar, + m[2] * scalar); } template - GLM_FUNC_QUALIFIER tmat3x4 operator*(T const & s, tmat3x4 const & m) + GLM_FUNC_QUALIFIER tmat3x4 operator*(T scalar, tmat3x4 const & m) { return tmat3x4( - m[0] * s, - m[1] * s, - m[2] * s); + m[0] * scalar, + m[1] * scalar, + m[2] * scalar); } template @@ -556,21 +534,21 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat3x4 operator/(tmat3x4 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat3x4 operator/(tmat3x4 const & m, T scalar) { return tmat3x4( - m[0] / s, - m[1] / s, - m[2] / s); + m[0] / scalar, + m[1] / scalar, + m[2] / scalar); } template - GLM_FUNC_QUALIFIER tmat3x4 operator/(T const & s, tmat3x4 const & m) + GLM_FUNC_QUALIFIER tmat3x4 operator/(T scalar, tmat3x4 const & m) { return tmat3x4( - s / m[0], - s / m[1], - s / m[2]); + scalar / m[0], + scalar / m[1], + scalar / m[2]); } // -- Boolean operators -- diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index ad66ed19..2ce89511 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -62,12 +62,12 @@ namespace glm GLM_FUNC_DECL tmat4x2(tmat4x2 const & m); GLM_FUNC_DECL explicit tmat4x2(ctor); - GLM_FUNC_DECL explicit tmat4x2(T const & x); + GLM_FUNC_DECL explicit tmat4x2(T scalar); GLM_FUNC_DECL tmat4x2( - T const & x0, T const & y0, - T const & x1, T const & y1, - T const & x2, T const & y2, - T const & x3, T const & y3); + T x0, T y0, + T x1, T y1, + T x2, T y2, + T x3, T y3); GLM_FUNC_DECL tmat4x2( col_type const & v0, col_type const & v1, @@ -82,10 +82,10 @@ namespace glm typename X3, typename Y3, typename X4, typename Y4> GLM_FUNC_DECL tmat4x2( - X1 const & x1, Y1 const & y1, - X2 const & x2, Y2 const & y2, - X3 const & x3, Y3 const & y3, - X4 const & x4, Y4 const & y4); + X1 x1, Y1 y1, + X2 x2, Y2 y2, + X3 x3, Y3 y3, + X4 x4, Y4 y4); template GLM_FUNC_DECL tmat4x2( @@ -154,22 +154,22 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tmat4x2 operator+(tmat4x2 const & m, T const & s); + GLM_FUNC_DECL tmat4x2 operator+(tmat4x2 const & m, T scalar); template GLM_FUNC_DECL tmat4x2 operator+(tmat4x2 const & m1, tmat4x2 const & m2); template - GLM_FUNC_DECL tmat4x2 operator-(tmat4x2 const & m, T const & s); + GLM_FUNC_DECL tmat4x2 operator-(tmat4x2 const & m, T scalar); template GLM_FUNC_DECL tmat4x2 operator-(tmat4x2 const & m1, tmat4x2 const & m2); template - GLM_FUNC_DECL tmat4x2 operator*(tmat4x2 const & m, T const & s); + GLM_FUNC_DECL tmat4x2 operator*(tmat4x2 const & m, T scalar); template - GLM_FUNC_DECL tmat4x2 operator*(T const & s, tmat4x2 const & m); + GLM_FUNC_DECL tmat4x2 operator*(T scalar, tmat4x2 const & m); template GLM_FUNC_DECL typename tmat4x2::col_type operator*(tmat4x2 const & m, typename tmat4x2::row_type const & v); @@ -187,10 +187,10 @@ namespace glm GLM_FUNC_DECL tmat4x2 operator*(tmat4x2 const & m1, tmat4x4 const & m2); template - GLM_FUNC_DECL tmat4x2 operator/(tmat4x2 const & m, T const & s); + GLM_FUNC_DECL tmat4x2 operator/(tmat4x2 const & m, T scalar); template - GLM_FUNC_DECL tmat4x2 operator/(T const & s, tmat4x2 const & m); + GLM_FUNC_DECL tmat4x2 operator/(T scalar, tmat4x2 const & m); // -- Boolean operators -- diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index 2040d4a6..1b0d048f 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -80,10 +80,10 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tmat4x2::tmat4x2(T const & s) + GLM_FUNC_QUALIFIER tmat4x2::tmat4x2(T scalar) { - this->value[0] = col_type(s, 0); - this->value[1] = col_type(0, s); + this->value[0] = col_type(scalar, 0); + this->value[1] = col_type(0, scalar); this->value[2] = col_type(0, 0); this->value[3] = col_type(0, 0); } @@ -91,10 +91,10 @@ namespace glm template GLM_FUNC_QUALIFIER tmat4x2::tmat4x2 ( - T const & x0, T const & y0, - T const & x1, T const & y1, - T const & x2, T const & y2, - T const & x3, T const & y3 + T x0, T y0, + T x1, T y1, + T x2, T y2, + T x3, T y3 ) { this->value[0] = col_type(x0, y0); @@ -128,10 +128,10 @@ namespace glm typename X4, typename Y4> GLM_FUNC_QUALIFIER tmat4x2::tmat4x2 ( - X1 const & x1, Y1 const & y1, - X2 const & x2, Y2 const & y2, - X3 const & x3, Y3 const & y3, - X4 const & x4, Y4 const & y4 + X1 x1, Y1 y1, + X2 x2, Y2 y2, + X3 x3, Y3 y3, + X4 x4, Y4 y4 ) { this->value[0] = col_type(static_cast(x1), value_type(y1)); @@ -242,47 +242,25 @@ namespace glm // -- 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 GLM_CONSTEXPR typename tmat4x2::length_type tmat4x2::length() 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 & 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::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 + 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]; + } // -- Unary updatable operators -- @@ -434,13 +412,13 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat4x2 operator+(tmat4x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat4x2 operator+(tmat4x2 const & m, T scalar) { return tmat4x2( - m[0] + s, - m[1] + s, - m[2] + s, - m[3] + s); + m[0] + scalar, + m[1] + scalar, + m[2] + scalar, + m[3] + scalar); } template @@ -454,13 +432,13 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat4x2 operator-(tmat4x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat4x2 operator-(tmat4x2 const & m, T scalar) { return tmat4x2( - m[0] - s, - m[1] - s, - m[2] - s, - m[3] - s); + m[0] - scalar, + m[1] - scalar, + m[2] - scalar, + m[3] - scalar); } template @@ -474,23 +452,23 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat4x2 operator*(tmat4x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat4x2 operator*(tmat4x2 const & m, T scalar) { return tmat4x2( - m[0] * s, - m[1] * s, - m[2] * s, - m[3] * s); + m[0] * scalar, + m[1] * scalar, + m[2] * scalar, + m[3] * scalar); } template - GLM_FUNC_QUALIFIER tmat4x2 operator*(T const & s, tmat4x2 const & m) + GLM_FUNC_QUALIFIER tmat4x2 operator*(T scalar, tmat4x2 const & m) { return tmat4x2( - m[0] * s, - m[1] * s, - m[2] * s, - m[3] * s); + m[0] * scalar, + m[1] * scalar, + m[2] * scalar, + m[3] * scalar); } template @@ -567,23 +545,23 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat4x2 operator/(tmat4x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat4x2 operator/(tmat4x2 const & m, T scalar) { return tmat4x2( - m[0] / s, - m[1] / s, - m[2] / s, - m[3] / s); + m[0] / scalar, + m[1] / scalar, + m[2] / scalar, + m[3] / scalar); } template - GLM_FUNC_QUALIFIER tmat4x2 operator/(T const & s, tmat4x2 const & m) + GLM_FUNC_QUALIFIER tmat4x2 operator/(T scalar, tmat4x2 const & m) { return tmat4x2( - s / m[0], - s / m[1], - s / m[2], - s / m[3]); + scalar / m[0], + scalar / m[1], + scalar / m[2], + scalar / m[3]); } // -- Boolean operators -- diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index c2979782..9e75a19a 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -235,47 +235,25 @@ namespace glm // -- 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 GLM_CONSTEXPR typename tmat4x3::length_type tmat4x3::length() 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 & 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::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 + 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]; + } // -- Unary updatable operators -- diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index 319325a7..bd80a126 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -323,47 +323,25 @@ namespace detail // -- 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 GLM_CONSTEXPR typename tmat4x4::length_type tmat4x4::length() 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 & 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::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 + 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]; + } // -- Unary arithmetic operators -- diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 5b4fa422..a3b46e5a 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -104,14 +104,14 @@ namespace glm template GLM_FUNC_QUALIFIER T & tvec1::operator[](typename tvec1::length_type i) { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + assert(i >= 0 && i < this->length()); 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)); + assert(i >= 0 && i < this->length()); return (&x)[i]; } diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index f23563f5..6caf4854 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -122,47 +122,25 @@ namespace glm // -- 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 GLM_CONSTEXPR typename tvec2::length_type tvec2::length() 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 & tvec2::operator[](typename tvec2::length_type i) + { + assert(i >= 0 && i < this->length()); + 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 + template + GLM_FUNC_QUALIFIER T const & tvec2::operator[](typename tvec2::length_type i) const + { + assert(i >= 0 && i < this->length()); + return (&x)[i]; + } // -- Unary arithmetic operators -- diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index f8e95a30..b730ab58 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -168,47 +168,25 @@ namespace glm // -- 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 GLM_CONSTEXPR typename tvec3::length_type tvec3::length() 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 & tvec3::operator[](typename tvec3::length_type i) + { + assert(i >= 0 && i < this->length()); + 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 + template + GLM_FUNC_QUALIFIER T const & tvec3::operator[](typename tvec3::length_type i) const + { + assert(i >= 0 && i < this->length()); + return (&x)[i]; + } // -- Unary arithmetic operators -- diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 29b78bf5..625c515c 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -213,14 +213,14 @@ namespace glm template GLM_FUNC_QUALIFIER T & tvec4::operator[](typename tvec4::length_type i) { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + assert(i >= 0 && i < this->length()); 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)); + assert(i >= 0 && i < this->length()); return (&x)[i]; } diff --git a/glm/gtc/matrix_access.inl b/glm/gtc/matrix_access.inl index c0c2faad..2df23173 100644 --- a/glm/gtc/matrix_access.inl +++ b/glm/gtc/matrix_access.inl @@ -40,10 +40,10 @@ namespace glm typename genType::row_type const & x ) { - assert(index >= 0 && static_cast(index) < detail::component_count(m[0])); + assert(index >= 0 && index < m[0].length()); genType Result = m; - for(detail::component_count_t i = 0; i < detail::component_count(m); ++i) + for(length_t i = 0; i < m.length(); ++i) Result[i][index] = x[i]; return Result; } @@ -55,10 +55,10 @@ namespace glm length_t index ) { - assert(index >= 0 && static_cast(index) < detail::component_count(m[0])); + assert(index >= 0 && index < m[0].length()); typename genType::row_type Result; - for(detail::component_count_t i = 0; i < detail::component_count(m); ++i) + for(length_t i = 0; i < m.length(); ++i) Result[i] = m[i][index]; return Result; } @@ -71,7 +71,7 @@ namespace glm typename genType::col_type const & x ) { - assert(index >= 0 && static_cast(index) < detail::component_count(m)); + assert(index >= 0 && index < m.length()); genType Result = m; Result[index] = x; @@ -85,7 +85,7 @@ namespace glm length_t index ) { - assert(index >= 0 && static_cast(index) < detail::component_count(m)); + assert(index >= 0 && index < m.length()); return m[index]; } diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index ff4c2d68..7ea1b1d3 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -60,14 +60,14 @@ namespace detail template GLM_FUNC_QUALIFIER T & tquat::operator[](typename tquat::length_type i) { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + assert(i >= 0 && i < this->length()); 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)); + assert(i >= 0 && i < this->length()); return (&x)[i]; } @@ -717,7 +717,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 lessThan(tquat const & x, tquat const & y) { tvec4 Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] < y[i]; return Result; } @@ -726,7 +726,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 lessThanEqual(tquat const & x, tquat const & y) { tvec4 Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] <= y[i]; return Result; } @@ -735,7 +735,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 greaterThan(tquat const & x, tquat const & y) { tvec4 Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] > y[i]; return Result; } @@ -744,7 +744,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 greaterThanEqual(tquat const & x, tquat const & y) { tvec4 Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] >= y[i]; return Result; } @@ -753,7 +753,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 equal(tquat const & x, tquat const & y) { tvec4 Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] == y[i]; return Result; } @@ -762,7 +762,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 notEqual(tquat const & x, tquat const & y) { tvec4 Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] != y[i]; return Result; } diff --git a/glm/gtc/ulp.inl b/glm/gtc/ulp.inl index 765698b1..e5db24f9 100644 --- a/glm/gtc/ulp.inl +++ b/glm/gtc/ulp.inl @@ -232,7 +232,7 @@ namespace glm GLM_FUNC_QUALIFIER vecType next_float(vecType const & x) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = next_float(x[i]); return Result; } @@ -267,7 +267,7 @@ namespace glm GLM_FUNC_QUALIFIER vecType prev_float(vecType const & x) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = prev_float(x[i]); return Result; } @@ -285,7 +285,7 @@ namespace glm GLM_FUNC_QUALIFIER vecType next_float(vecType const & x, vecType const & ulps) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = next_float(x[i], ulps[i]); return Result; } @@ -303,7 +303,7 @@ namespace glm GLM_FUNC_QUALIFIER vecType prev_float(vecType const & x, vecType const & ulps) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = prev_float(x[i], ulps[i]); return Result; } @@ -343,7 +343,7 @@ namespace glm GLM_FUNC_QUALIFIER vecType float_distance(vecType const & x, vecType const & y) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = float_distance(x[i], y[i]); return Result; } diff --git a/glm/gtx/associated_min_max.inl b/glm/gtx/associated_min_max.inl index 41f08b46..f2a63f8f 100644 --- a/glm/gtx/associated_min_max.inl +++ b/glm/gtx/associated_min_max.inl @@ -47,7 +47,7 @@ GLM_FUNC_QUALIFIER tvec2 associatedMin ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] < y[i] ? a[i] : b[i]; return Result; } @@ -60,7 +60,7 @@ GLM_FUNC_QUALIFIER vecType associatedMin ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x < y ? a[i] : b[i]; return Result; } @@ -73,7 +73,7 @@ GLM_FUNC_QUALIFIER vecType associatedMin ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] < y[i] ? a : b; return Result; } @@ -100,7 +100,7 @@ GLM_FUNC_QUALIFIER vecType associatedMin ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]); return Result; } @@ -134,7 +134,7 @@ GLM_FUNC_QUALIFIER vecType associatedMin ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) { T Test1 = min(x[i], y[i]); T Test2 = min(z[i], w[i]); @@ -159,7 +159,7 @@ GLM_FUNC_QUALIFIER vecType associatedMin T Test2 = min(z, w); vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) { U Result1 = x < y ? a[i] : b[i]; U Result2 = z < w ? c[i] : d[i]; @@ -179,7 +179,7 @@ GLM_FUNC_QUALIFIER vecType associatedMin ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) { T Test1 = min(x[i], y[i]); T Test2 = min(z[i], w[i]);; @@ -206,7 +206,7 @@ GLM_FUNC_QUALIFIER tvec2 associatedMax ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] > y[i] ? a[i] : b[i]; return Result; } @@ -220,7 +220,7 @@ GLM_FUNC_QUALIFIER vecType associatedMax ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x > y ? a[i] : b[i]; return Result; } @@ -234,7 +234,7 @@ GLM_FUNC_QUALIFIER vecType associatedMax ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] > y[i] ? a : b; return Result; } @@ -262,7 +262,7 @@ GLM_FUNC_QUALIFIER vecType associatedMax ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]); return Result; } @@ -277,7 +277,7 @@ GLM_FUNC_QUALIFIER vecType associatedMax ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]); return Result; } @@ -292,7 +292,7 @@ GLM_FUNC_QUALIFIER vecType associatedMax ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c); return Result; } @@ -326,7 +326,7 @@ GLM_FUNC_QUALIFIER vecType associatedMax ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) { T Test1 = max(x[i], y[i]); T Test2 = max(z[i], w[i]); @@ -351,7 +351,7 @@ GLM_FUNC_QUALIFIER vecType associatedMax T Test2 = max(z, w); vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) { U Result1 = x > y ? a[i] : b[i]; U Result2 = z > w ? c[i] : d[i]; @@ -371,7 +371,7 @@ GLM_FUNC_QUALIFIER vecType associatedMax ) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i) + for(length_t i = 0, n = Result.length(); i < n; ++i) { T Test1 = max(x[i], y[i]); T Test2 = max(z[i], w[i]);; diff --git a/glm/gtx/component_wise.inl b/glm/gtx/component_wise.inl index 42a641da..3cb17d28 100644 --- a/glm/gtx/component_wise.inl +++ b/glm/gtx/component_wise.inl @@ -122,36 +122,36 @@ namespace detail template class vecType> GLM_FUNC_QUALIFIER T compAdd(vecType const & v) { - T result(0); - for(detail::component_count_t i = 0; i < detail::component_count(v); ++i) - result += v[i]; - return result; + T Result(0); + for(length_t i = 0, n = v.length(); i < n; ++i) + Result += v[i]; + return Result; } template class vecType> GLM_FUNC_QUALIFIER T compMul(vecType const & v) { - T result(1); - for(detail::component_count_t i = 0; i < detail::component_count(v); ++i) - result *= v[i]; - return result; + T Result(1); + for(length_t i = 0, n = v.length(); i < n; ++i) + Result *= v[i]; + return Result; } template class vecType> GLM_FUNC_QUALIFIER T compMin(vecType const & v) { - T result(v[0]); - for(detail::component_count_t i = 1; i < detail::component_count(v); ++i) - result = min(result, v[i]); - return result; + T Result(v[0]); + for(length_t i = 1, n = v.length(); i < n; ++i) + Result = min(Result, v[i]); + return Result; } template class vecType> GLM_FUNC_QUALIFIER T compMax(vecType const & v) { - T result(v[0]); - for(detail::component_count_t i = 1; i < detail::component_count(v); ++i) - result = max(result, v[i]); - return result; + T Result(v[0]); + for(length_t i = 1, n = v.length(); i < n; ++i) + Result = max(Result, v[i]); + return Result; } }//namespace glm diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index fd41dcdc..f7d7ee72 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -37,47 +37,25 @@ namespace glm { // -- 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 GLM_CONSTEXPR typename tdualquat::length_type tdualquat::length() 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 & tdualquat::operator[](typename tdualquat::length_type i) + { + assert(i >= 0 && i < this->length()); + 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 + template + GLM_FUNC_QUALIFIER typename tdualquat::part_type const & tdualquat::operator[](typename tdualquat::length_type i) const + { + assert(i >= 0 && i < this->length()); + return (&real)[i]; + } // -- Implicit basic constructors -- diff --git a/glm/gtx/fast_exponential.inl b/glm/gtx/fast_exponential.inl index 9cf882c2..3a85fd22 100644 --- a/glm/gtx/fast_exponential.inl +++ b/glm/gtx/fast_exponential.inl @@ -58,7 +58,7 @@ namespace glm GLM_FUNC_QUALIFIER vecType fastPow(vecType const & x, vecType const & y) { vecType Result(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(x); ++i) + for(length_t i = 0, n = x.length(); i < n; ++i) Result[i] = fastPow(x[i], y[i]); return Result; } diff --git a/glm/gtx/matrix_query.inl b/glm/gtx/matrix_query.inl index d913116f..18f810da 100644 --- a/glm/gtx/matrix_query.inl +++ b/glm/gtx/matrix_query.inl @@ -36,7 +36,7 @@ namespace glm GLM_FUNC_QUALIFIER bool isNull(tmat2x2 const & m, T const & epsilon) { bool result = true; - for(detail::component_count_t i = 0; result && i < 2 ; ++i) + for(length_t i = 0; result && i < m.length() ; ++i) result = isNull(m[i], epsilon); return result; } @@ -45,7 +45,7 @@ namespace glm GLM_FUNC_QUALIFIER bool isNull(tmat3x3 const & m, T const & epsilon) { bool result = true; - for(detail::component_count_t i = 0; result && i < 3 ; ++i) + for(length_t i = 0; result && i < m.length() ; ++i) result = isNull(m[i], epsilon); return result; } @@ -54,7 +54,7 @@ namespace glm GLM_FUNC_QUALIFIER bool isNull(tmat4x4 const & m, T const & epsilon) { bool result = true; - for(detail::component_count_t i = 0; result && i < 4 ; ++i) + for(length_t i = 0; result && i < m.length() ; ++i) result = isNull(m[i], epsilon); return result; } @@ -63,13 +63,13 @@ namespace glm GLM_FUNC_QUALIFIER bool isIdentity(matType const & m, T const & epsilon) { bool result = true; - for(detail::component_count_t i(0); result && i < detail::component_count(m[0]); ++i) + for(length_t i = 0; result && i < m[0].length() ; ++i) { - for(detail::component_count_t j(0); result && j < i ; ++j) + for(length_t j = 0; result && j < i ; ++j) result = abs(m[i][j]) <= epsilon; if(result) result = abs(m[i][i] - 1) <= epsilon; - for(detail::component_count_t j(i + 1); result && j < detail::component_count(m); ++j) + for(length_t j = i + 1; result && j < m.length(); ++j) result = abs(m[i][j]) <= epsilon; } return result; @@ -79,12 +79,12 @@ namespace glm GLM_FUNC_QUALIFIER bool isNormalized(tmat2x2 const & m, T const & epsilon) { bool result(true); - for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i) + for(length_t i = 0; result && i < m.length(); ++i) result = isNormalized(m[i], epsilon); - for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i) + for(length_t i = 0; result && i < m.length(); ++i) { typename tmat2x2::col_type v; - for(detail::component_count_t j(0); j < detail::component_count(m); ++j) + for(length_t j = 0; j < m.length(); ++j) v[j] = m[j][i]; result = isNormalized(v, epsilon); } @@ -95,12 +95,12 @@ namespace glm GLM_FUNC_QUALIFIER bool isNormalized(tmat3x3 const & m, T const & epsilon) { bool result(true); - for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i) + for(length_t i = 0; result && i < m.length(); ++i) result = isNormalized(m[i], epsilon); - for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i) + for(length_t i = 0; result && i < m.length(); ++i) { typename tmat3x3::col_type v; - for(detail::component_count_t j(0); j < detail::component_count(m); ++j) + for(length_t j = 0; j < m.length(); ++j) v[j] = m[j][i]; result = isNormalized(v, epsilon); } @@ -111,12 +111,12 @@ namespace glm GLM_FUNC_QUALIFIER bool isNormalized(tmat4x4 const & m, T const & epsilon) { bool result(true); - for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i) + for(length_t i = 0; result && i < m.length(); ++i) result = isNormalized(m[i], epsilon); - for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i) + for(length_t i = 0; result && i < m.length(); ++i) { typename tmat4x4::col_type v; - for(detail::component_count_t j(0); j < detail::component_count(m); ++j) + for(length_t j = 0; j < m.length(); ++j) v[j] = m[j][i]; result = isNormalized(v, epsilon); } @@ -127,15 +127,15 @@ namespace glm GLM_FUNC_QUALIFIER bool isOrthogonal(matType const & m, T const & epsilon) { bool result(true); - for(detail::component_count_t i(0); result && i < detail::component_count(m) - 1; ++i) - for(detail::component_count_t j(i + 1); result && j < detail::component_count(m); ++j) + for(length_t i(0); result && i < m.length() - 1; ++i) + for(length_t j(i + 1); result && j < m.length(); ++j) result = areOrthogonal(m[i], m[j], epsilon); if(result) { matType tmp = transpose(m); - for(detail::component_count_t i(0); result && i < detail::component_count(m) - 1 ; ++i) - for(detail::component_count_t j(i + 1); result && j < detail::component_count(m); ++j) + for(length_t i(0); result && i < m.length() - 1 ; ++i) + for(length_t j(i + 1); result && j < m.length(); ++j) result = areOrthogonal(tmp[i], tmp[j], epsilon); } return result; diff --git a/glm/gtx/range.hpp b/glm/gtx/range.hpp index 19ae2409..9fb2bb54 100644 --- a/glm/gtx/range.hpp +++ b/glm/gtx/range.hpp @@ -48,54 +48,65 @@ #endif #include "../gtc/type_ptr.hpp" +#include "../gtc/vec1.hpp" -namespace glm{ -namespace detail +namespace glm { - /* The glm types provide a .length() member, but for matrices - this only defines the number of columns, so we need to work around this */ - template - detail::component_count_t number_of_elements_(tvec2 const & v){ - return detail::component_count(v); - } - - template - detail::component_count_t number_of_elements_(tvec3 const & v){ - return detail::component_count(v); - } - - template - detail::component_count_t number_of_elements_(tvec4 const & v){ - return detail::component_count(v); - } - - template - detail::component_count_t number_of_elements_(genType const & m){ - return detail::component_count(m) * detail::component_count(m[0]); - } -}//namespace - /// @addtogroup gtx_range /// @{ + template + inline length_t components(tvec1 const & v) + { + return v.length(); + } + + template + inline length_t components(tvec2 const & v) + { + return v.length(); + } + + template + inline length_t components(tvec3 const & v) + { + return v.length(); + } + + template + inline length_t components(tvec4 const & v) + { + return v.length(); + } + template - const typename genType::value_type * begin(genType const & v){ + inline length_t components(genType const & m) + { + return m.length() * m[0].length(); + } + + template + inline typename genType::value_type const * begin(genType const & v) + { return value_ptr(v); } template - const typename genType::value_type * end(genType const & v){ - return begin(v) + detail::number_of_elements_(v); + inline typename genType::value_type const * end(genType const & v) + { + return begin(v) + components(v); } template - typename genType::value_type * begin(genType& v){ + inline typename genType::value_type * begin(genType& v) + { return value_ptr(v); } template - typename genType::value_type * end(genType& v){ - return begin(v) + detail::number_of_elements_(v); + inline typename genType::value_type * end(genType& v) + { + return begin(v) + components(v); } /// @} diff --git a/test/gtx/gtx_type_trait.cpp b/test/gtx/gtx_type_trait.cpp index 874366cf..f0829c67 100644 --- a/test/gtx/gtx_type_trait.cpp +++ b/test/gtx/gtx_type_trait.cpp @@ -17,7 +17,7 @@ struct type_gni static bool const is_quat = false; }; */ - +/* namespace detail { template