diff --git a/CMakeLists.txt b/CMakeLists.txt index f9fc72b0..12d8abbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,12 +17,12 @@ enable_testing() add_definitions(-D_CRT_SECURE_NO_WARNINGS) option(GLM_STATIC_LIBRARY_ENABLE "GLM static library" OFF) -if(NOT GLM_STATIC_LIBRARY_ENABLE) +if(GLM_STATIC_LIBRARY_ENABLE) message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_STATIC_LIBRARY_ENABLE with ON to build an optional static library") endif() option(GLM_DYNAMIC_LIBRARY_ENABLE "GLM static library" OFF) -if(NOT GLM_DYNAMIC_LIBRARY_ENABLE) +if(GLM_DYNAMIC_LIBRARY_ENABLE) message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_DYNAMIC_LIBRARY_ENABLE with ON to build an optional dynamic library") endif() 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 6182f62b..b4688035 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -62,6 +62,7 @@ #define GLM_PLATFORM_UNIX 0x00400000 #define GLM_PLATFORM_QNXNTO 0x00800000 #define GLM_PLATFORM_WINCE 0x01000000 +#define GLM_PLATFORM_CYGWIN 0x02000000 #ifdef GLM_FORCE_PLATFORM_UNKNOWN # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN @@ -985,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.hpp b/glm/detail/type_mat2x2.hpp index 0388e759..c0a99e35 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -49,11 +49,6 @@ namespace glm typedef tmat2x2 transpose_type; typedef T value_type; - template - friend tvec2 operator/(tmat2x2 const & m, tvec2 const & v); - template - friend tvec2 operator/(tvec2 const & v, tmat2x2 const & m); - private: col_type value[2]; @@ -66,7 +61,7 @@ namespace glm GLM_FUNC_DECL tmat2x2(tmat2x2 const & m); GLM_FUNC_DECL explicit tmat2x2(ctor); - GLM_FUNC_DECL explicit tmat2x2(T const & x); + GLM_FUNC_DECL explicit tmat2x2(T scalar); GLM_FUNC_DECL tmat2x2( T const & x1, T const & y1, T const & x2, T const & y2); @@ -150,28 +145,28 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m, T const & s); + GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m, T scalar); template - GLM_FUNC_DECL tmat2x2 operator+(T const & s, tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator+(T scalar, tmat2x2 const & m); template - GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m1, tmat2x2 const & m2); + GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m1, tmat2x2 const & m2); template - GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m, T const & s); + GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m, T scalar); template - GLM_FUNC_DECL tmat2x2 operator-(T const & s, tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator-(T scalar, tmat2x2 const & m); template - GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m1, tmat2x2 const & m2); + GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m1, tmat2x2 const & m2); template - GLM_FUNC_DECL tmat2x2 operator*(tmat2x2 const & m, T const & s); + GLM_FUNC_DECL tmat2x2 operator*(tmat2x2 const & m, T scalar); template - GLM_FUNC_DECL tmat2x2 operator*(T const & s, tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator*(T scalar, tmat2x2 const & m); template GLM_FUNC_DECL typename tmat2x2::col_type operator*(tmat2x2 const & m, typename tmat2x2::row_type const & v); @@ -180,7 +175,7 @@ namespace glm GLM_FUNC_DECL typename tmat2x2::row_type operator*(typename tmat2x2::col_type const & v, tmat2x2 const & m); template - GLM_FUNC_DECL tmat2x2 operator*(tmat2x2 const & m1, tmat2x2 const & m2); + GLM_FUNC_DECL tmat2x2 operator*(tmat2x2 const & m1, tmat2x2 const & m2); template GLM_FUNC_DECL tmat3x2 operator*(tmat2x2 const & m1, tmat3x2 const & m2); @@ -189,10 +184,10 @@ namespace glm GLM_FUNC_DECL tmat4x2 operator*(tmat2x2 const & m1, tmat4x2 const & m2); template - GLM_FUNC_DECL tmat2x2 operator/(tmat2x2 const & m, T const & s); + GLM_FUNC_DECL tmat2x2 operator/(tmat2x2 const & m, T scalar); template - GLM_FUNC_DECL tmat2x2 operator/(T const & s, tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator/(T scalar, tmat2x2 const & m); template GLM_FUNC_DECL typename tmat2x2::col_type operator/(tmat2x2 const & m, typename tmat2x2::row_type const & v); diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index 960fee57..31e4734d 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -85,10 +85,10 @@ namespace detail {} template - GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(T const & s) + GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(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); } template @@ -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 -- @@ -264,10 +242,10 @@ namespace detail template template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator+=(U s) + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator+=(U scalar) { - this->value[0] += s; - this->value[1] += s; + this->value[0] += scalar; + this->value[1] += scalar; return *this; } @@ -282,10 +260,10 @@ namespace detail template template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator-=(U s) + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator-=(U scalar) { - this->value[0] -= s; - this->value[1] -= s; + this->value[0] -= scalar; + this->value[1] -= scalar; return *this; } @@ -300,10 +278,10 @@ namespace detail template template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator*=(U s) + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator*=(U scalar) { - this->value[0] *= s; - this->value[1] *= s; + this->value[0] *= scalar; + this->value[1] *= scalar; return *this; } @@ -316,10 +294,10 @@ namespace detail template template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator/=(U s) + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator/=(U scalar) { - this->value[0] /= s; - this->value[1] /= s; + this->value[0] /= scalar; + this->value[1] /= scalar; return *this; } @@ -383,19 +361,19 @@ namespace detail // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x2 operator+(tmat2x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x2 operator+(tmat2x2 const & m, T scalar) { return tmat2x2( - m[0] + s, - m[1] + s); + m[0] + scalar, + m[1] + scalar); } template - GLM_FUNC_QUALIFIER tmat2x2 operator+(T const & s, tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator+(T scalar, tmat2x2 const & m) { return tmat2x2( - m[0] + s, - m[1] + s); + m[0] + scalar, + m[1] + scalar); } template @@ -407,19 +385,19 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x2 operator-(tmat2x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x2 operator-(tmat2x2 const & m, T scalar) { return tmat2x2( - m[0] - s, - m[1] - s); + m[0] - scalar, + m[1] - scalar); } template - GLM_FUNC_QUALIFIER tmat2x2 operator-(T const & s, tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator-(T scalar, tmat2x2 const & m) { return tmat2x2( - s - m[0], - s - m[1]); + scalar - m[0], + scalar - m[1]); } template @@ -431,19 +409,19 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x2 operator*(tmat2x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x2 operator*(tmat2x2 const & m, T scalar) { return tmat2x2( - m[0] * s, - m[1] * s); + m[0] * scalar, + m[1] * scalar); } template - GLM_FUNC_QUALIFIER tmat2x2 operator*(T const & s, tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator*(T scalar, tmat2x2 const & m) { return tmat2x2( - m[0] * s, - m[1] * s); + m[0] * scalar, + m[1] * scalar); } template @@ -507,19 +485,19 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x2 operator/(tmat2x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x2 operator/(tmat2x2 const & m, T scalar) { return tmat2x2( - m[0] / s, - m[1] / s); + m[0] / scalar, + m[1] / scalar); } template - GLM_FUNC_QUALIFIER tmat2x2 operator/(T const & s, tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator/(T scalar, tmat2x2 const & m) { return tmat2x2( - s / m[0], - s / m[1]); + scalar / m[0], + scalar / m[1]); } template 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 7e0cc87d..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, const T& s); + GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, T scalar); template - GLM_FUNC_DECL tmat2x4 operator/(T 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 cac649f6..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, const T& 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 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 806ae811..3dd2d102 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -49,11 +49,6 @@ namespace glm typedef tmat3x3 transpose_type; typedef T value_type; - template - friend tvec3 operator/(tmat3x3 const & m, tvec3 const & v); - template - friend tvec3 operator/(tvec3 const & v, tmat3x3 const & m); - private: col_type value[3]; @@ -66,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, @@ -83,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( @@ -157,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); @@ -196,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.hpp b/glm/detail/type_mat4x4.hpp index 4766f1d6..c210f396 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -49,11 +49,6 @@ namespace glm typedef tmat4x4 transpose_type; typedef T value_type; - template - friend tvec4 operator/(tmat4x4 const & m, tvec4 const & v); - template - friend tvec4 operator/(tvec4 const & v, tmat4x4 const & m); - private: col_type value[4]; @@ -210,7 +205,7 @@ namespace glm GLM_FUNC_DECL typename tmat4x4::col_type operator/(tmat4x4 const & m, typename tmat4x4::row_type const & v); template - GLM_FUNC_DECL typename tmat4x4::row_type operator/(typename tmat4x4::col_type & v, tmat4x4 const & m); + GLM_FUNC_DECL typename tmat4x4::row_type operator/(typename tmat4x4::col_type const & v, tmat4x4 const & m); template GLM_FUNC_DECL tmat4x4 operator/(tmat4x4 const & m1, tmat4x4 const & m2); 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.hpp b/glm/detail/type_vec1.hpp index 40291ecb..c9708111 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -102,7 +102,7 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tvec1(ctor); - GLM_FUNC_DECL explicit tvec1(T const & scalar); + GLM_FUNC_DECL explicit tvec1(T scalar); // -- Conversion vector constructors -- @@ -137,19 +137,19 @@ namespace glm template GLM_FUNC_DECL tvec1 & operator=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator+=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator+=(U scalar); template GLM_FUNC_DECL tvec1 & operator+=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator-=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator-=(U scalar); template GLM_FUNC_DECL tvec1 & operator-=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator*=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator*=(U scalar); template GLM_FUNC_DECL tvec1 & operator*=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator/=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator/=(U scalar); template GLM_FUNC_DECL tvec1 & operator/=(tvec1 const & v); @@ -163,27 +163,27 @@ namespace glm // -- Unary bit operators -- template - GLM_FUNC_DECL tvec1 & operator%=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator%=(U scalar); template GLM_FUNC_DECL tvec1 & operator%=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator&=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator&=(U scalar); template GLM_FUNC_DECL tvec1 & operator&=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator|=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator|=(U scalar); template GLM_FUNC_DECL tvec1 & operator|=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator^=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator^=(U scalar); template GLM_FUNC_DECL tvec1 & operator^=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator<<=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator<<=(U scalar); template GLM_FUNC_DECL tvec1 & operator<<=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator>>=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator>>=(U scalar); template GLM_FUNC_DECL tvec1 & operator>>=(tvec1 const & v); }; @@ -199,91 +199,91 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tvec1 operator+(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator+(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator+(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator+(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator+(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator-(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator-(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator-(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator-(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator- (tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator*(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator*(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator*(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator*(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator*(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator/(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator/(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator/(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator/(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator/(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator%(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator%(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator%(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator%(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator%(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator&(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator&(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator&(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator&(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator&(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator|(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator|(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator|(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator|(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator|(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator^(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator^(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator^(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator^(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator^(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator<<(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator<<(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator<<(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator<<(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator<<(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator>>(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator>>(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator>>(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator>>(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator>>(tvec1 const & v1, tvec1 const & v2); diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index d1bf7cf5..a3b46e5a 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -63,7 +63,7 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tvec1::tvec1(T const & scalar) + GLM_FUNC_QUALIFIER tvec1::tvec1(T scalar) : x(scalar) {} @@ -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]; } @@ -136,7 +136,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator+=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator+=(U scalar) { this->x += static_cast(scalar); return *this; @@ -152,7 +152,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator-=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator-=(U scalar) { this->x -= static_cast(scalar); return *this; @@ -168,7 +168,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator*=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator*=(U scalar) { this->x *= static_cast(scalar); return *this; @@ -184,7 +184,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator/=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator/=(U scalar) { this->x /= static_cast(scalar); return *this; @@ -234,7 +234,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator%=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator%=(U scalar) { this->x %= static_cast(scalar); return *this; @@ -250,7 +250,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator&=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator&=(U scalar) { this->x &= static_cast(scalar); return *this; @@ -266,7 +266,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator|=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator|=(U scalar) { this->x |= static_cast(scalar); return *this; @@ -282,7 +282,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator^=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator^=(U scalar) { this->x ^= static_cast(scalar); return *this; @@ -298,7 +298,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator<<=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator<<=(U scalar) { this->x <<= static_cast(scalar); return *this; @@ -314,7 +314,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator>>=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator>>=(U scalar) { this->x >>= static_cast(scalar); return *this; @@ -346,14 +346,14 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tvec1 operator+(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator+(tvec1 const & v, T scalar) { return tvec1( v.x + scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator+(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator+(T scalar, tvec1 const & v) { return tvec1( scalar + v.x); @@ -368,14 +368,14 @@ namespace glm //operator- template - GLM_FUNC_QUALIFIER tvec1 operator-(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator-(tvec1 const & v, T scalar) { return tvec1( v.x - scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator-(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator-(T scalar, tvec1 const & v) { return tvec1( scalar - v.x); @@ -389,14 +389,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator*(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator*(tvec1 const & v, T scalar) { return tvec1( v.x * scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator*(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator*(T scalar, tvec1 const & v) { return tvec1( scalar * v.x); @@ -410,14 +410,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator/(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator/(tvec1 const & v, T scalar) { return tvec1( v.x / scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator/(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator/(T scalar, tvec1 const & v) { return tvec1( scalar / v.x); @@ -433,14 +433,14 @@ namespace glm // -- Binary bit operators -- template - GLM_FUNC_QUALIFIER tvec1 operator%(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator%(tvec1 const & v, T scalar) { return tvec1( v.x % scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator%(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator%(T scalar, tvec1 const & v) { return tvec1( scalar % v.x); @@ -454,14 +454,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator&(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator&(tvec1 const & v, T scalar) { return tvec1( v.x & scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator&(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator&(T scalar, tvec1 const & v) { return tvec1( scalar & v.x); @@ -475,14 +475,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator|(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator|(tvec1 const & v, T scalar) { return tvec1( v.x | scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator|(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator|(T scalar, tvec1 const & v) { return tvec1( scalar | v.x); @@ -496,14 +496,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator^(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator^(tvec1 const & v, T scalar) { return tvec1( v.x ^ scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator^(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator^(T scalar, tvec1 const & v) { return tvec1( scalar ^ v.x); @@ -517,14 +517,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator<<(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator<<(tvec1 const & v, T scalar) { return tvec1( v.x << scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator<<(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator<<(T scalar, tvec1 const & v) { return tvec1( scalar << v.x); @@ -538,14 +538,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator>>(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator>>(tvec1 const & v, T scalar) { return tvec1( v.x >> scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator>>(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator>>(T scalar, tvec1 const & v) { return tvec1( scalar >> v.x); diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index de425e10..4d9b8c70 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -102,14 +102,14 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tvec2(ctor); - GLM_FUNC_DECL explicit tvec2(T const & scalar); - GLM_FUNC_DECL tvec2(T const & s1, T const & s2); + GLM_FUNC_DECL explicit tvec2(T scalar); + GLM_FUNC_DECL tvec2(T s1, T s2); // -- Conversion constructors -- /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL tvec2(A const & x, B const & y); + GLM_FUNC_DECL tvec2(A x, B y); template GLM_FUNC_DECL tvec2(tvec1 const & v1, tvec1 const & v2); @@ -225,13 +225,13 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tvec2 operator+(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator+(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator+(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator+(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator+(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator+(tvec1 const & v1, tvec2 const & v2); @@ -240,13 +240,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator+(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator-(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator-(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator-(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator-(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator-(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator-(tvec1 const & v1, tvec2 const & v2); @@ -255,13 +255,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator-(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator*(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator*(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator*(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator*(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator*(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator*(tvec1 const & v1, tvec2 const & v2); @@ -270,13 +270,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator*(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator/(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator/(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator/(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator/(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator/(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator/(tvec1 const & v1, tvec2 const & v2); @@ -285,13 +285,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator/(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator%(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator%(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator%(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator%(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator%(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator%(tvec1 const & v1, tvec2 const & v2); @@ -300,13 +300,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator%(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator&(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator&(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator&(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator&(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator&(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator&(tvec1 const & v1, tvec2 const & v2); @@ -315,13 +315,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator&(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator|(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator|(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator|(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator|(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator|(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator|(tvec1 const & v1, tvec2 const & v2); @@ -330,13 +330,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator|(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator^(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator^(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator^(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator^(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator^(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator^(tvec1 const & v1, tvec2 const & v2); @@ -345,13 +345,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator^(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator<<(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator<<(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator<<(tvec1 const & v1, tvec2 const & v2); @@ -360,13 +360,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator>>(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator>>(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator>>(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator>>(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator>>(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator>>(tvec1 const & v1, tvec2 const & v2); diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index dfb3a33a..6caf4854 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -72,12 +72,12 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tvec2::tvec2(T const & scalar) + GLM_FUNC_QUALIFIER tvec2::tvec2(T scalar) : x(scalar), y(scalar) {} template - GLM_FUNC_QUALIFIER tvec2::tvec2(T const & s1, T const & s2) + GLM_FUNC_QUALIFIER tvec2::tvec2(T s1, T s2) : x(s1), y(s2) {} @@ -85,7 +85,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec2::tvec2(A const & a, B const & b) + GLM_FUNC_QUALIFIER tvec2::tvec2(A a, B b) : x(static_cast(a)) , y(static_cast(b)) {} @@ -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 -- @@ -510,7 +488,7 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v, T scalar) { return tvec2( v.x + scalar, @@ -526,7 +504,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator+(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator+(T scalar, tvec2 const & v) { return tvec2( scalar + v.x, @@ -550,7 +528,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v, T scalar) { return tvec2( v.x - scalar, @@ -566,7 +544,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator-(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator-(T scalar, tvec2 const & v) { return tvec2( scalar - v.x, @@ -590,11 +568,11 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v1, T const & v2) + GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v, T scalar) { return tvec2( - v1.x * v2, - v1.y * v2); + v.x * scalar, + v.y * scalar); } template @@ -606,7 +584,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator*(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator*(T scalar, tvec2 const & v) { return tvec2( scalar * v.x, @@ -630,7 +608,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v, T scalar) { return tvec2( v.x / scalar, @@ -646,7 +624,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator/(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator/(T scalar, tvec2 const & v) { return tvec2( scalar / v.x, @@ -672,7 +650,7 @@ namespace glm // -- Binary bit operators -- template - GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v, T scalar) { return tvec2( v.x % scalar, @@ -688,7 +666,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator%(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator%(T scalar, tvec2 const & v) { return tvec2( scalar % v.x, @@ -712,7 +690,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v, T scalar) { return tvec2( v.x & scalar, @@ -728,7 +706,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator&(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator&(T scalar, tvec2 const & v) { return tvec2( scalar & v.x, @@ -752,7 +730,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v, T scalar) { return tvec2( v.x | scalar, @@ -768,7 +746,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator|(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator|(T scalar, tvec2 const & v) { return tvec2( scalar | v.x, @@ -792,7 +770,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v, T scalar) { return tvec2( v.x ^ scalar, @@ -808,7 +786,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator^(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator^(T scalar, tvec2 const & v) { return tvec2( scalar ^ v.x, @@ -832,7 +810,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v, T scalar) { return tvec2( v.x << scalar, @@ -848,7 +826,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator<<(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator<<(T scalar, tvec2 const & v) { return tvec2( scalar << v.x, @@ -872,7 +850,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v, T scalar) { return tvec2( v.x >> scalar, @@ -888,7 +866,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator>>(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator>>(T scalar, tvec2 const & v) { return tvec2( scalar >> v.x, diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 70e4290b..8280a219 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -103,14 +103,14 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tvec3(ctor); - GLM_FUNC_DECL explicit tvec3(T const & scalar); - GLM_FUNC_DECL tvec3(T const & a, T const & b, T const & c); + GLM_FUNC_DECL explicit tvec3(T scalar); + GLM_FUNC_DECL tvec3(T a, T b, T c); // -- Conversion scalar constructors -- /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL tvec3(A const & a, B const & b, C const & c); + GLM_FUNC_DECL tvec3(A a, B b, C c); template GLM_FUNC_DECL tvec3(tvec1 const & a, tvec1 const & b, tvec1 const & c); @@ -118,13 +118,13 @@ namespace glm /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL tvec3(tvec2 const & a, B const & b); + GLM_FUNC_DECL tvec3(tvec2 const & a, B b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template GLM_FUNC_DECL tvec3(tvec2 const & a, tvec1 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL tvec3(A const & a, tvec2 const & b); + GLM_FUNC_DECL tvec3(A a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template GLM_FUNC_DECL tvec3(tvec1 const & a, tvec2 const & b); @@ -247,151 +247,151 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tvec3 operator+(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator+(tvec3 const & v, T scalar); template GLM_FUNC_DECL tvec3 operator+(tvec3 const & v, tvec1 const & scalar); template - GLM_FUNC_DECL tvec3 operator+(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator+(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator+(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator+(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator+(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator-(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator-(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator-(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator-(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator-(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator-(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator-(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator-(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator-(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator*(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator*(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator*(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator*(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator*(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator*(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator/(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator/(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator/(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator/(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator/(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator/(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator/(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator/(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator/(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator%(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator%(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator%(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator%(tvec3 const & v1, tvec1 const & v2); template GLM_FUNC_DECL tvec3 operator%(T const & scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator%(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator%(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator%(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator&(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator&(tvec3 const & v1, T scalar); template - GLM_FUNC_DECL tvec3 operator&(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator&(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator&(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator&(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator&(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator&(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator&(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator|(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator|(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator|(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator|(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator|(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator|(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator|(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator|(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator|(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator^(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator^(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator^(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator^(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator^(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator^(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator^(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator^(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator^(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator<<(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator<<(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator<<(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator<<(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator>>(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator>>(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator>>(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator>>(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v1, tvec3 const & v2); diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 38104a3a..b730ab58 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -89,12 +89,12 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tvec3::tvec3(T const & scalar) + GLM_FUNC_QUALIFIER tvec3::tvec3(T scalar) : x(scalar), y(scalar), z(scalar) {} template - GLM_FUNC_QUALIFIER tvec3::tvec3(T const & a, T const & b, T const & c) + GLM_FUNC_QUALIFIER tvec3::tvec3(T a, T b, T c) : x(a), y(b), z(c) {} @@ -102,7 +102,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec3::tvec3(A const & a, B const & b, C const & c) : + GLM_FUNC_QUALIFIER tvec3::tvec3(A a, B b, C c) : x(static_cast(a)), y(static_cast(b)), z(static_cast(c)) @@ -120,7 +120,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec3::tvec3(tvec2 const & a, B const & b) : + GLM_FUNC_QUALIFIER tvec3::tvec3(tvec2 const & a, B b) : x(static_cast(a.x)), y(static_cast(a.y)), z(static_cast(b)) @@ -136,7 +136,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec3::tvec3(A const & a, tvec2 const & b) : + GLM_FUNC_QUALIFIER tvec3::tvec3(A a, tvec2 const & b) : x(static_cast(a)), y(static_cast(b.x)), z(static_cast(b.y)) @@ -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 -- @@ -591,7 +569,7 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tvec3 operator+(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator+(tvec3 const & v, T scalar) { return tvec3( v.x + scalar, @@ -609,7 +587,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator+(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator+(T scalar, tvec3 const & v) { return tvec3( scalar + v.x, @@ -636,7 +614,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator-(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator-(tvec3 const & v, T scalar) { return tvec3( v.x - scalar, @@ -654,7 +632,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator-(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator-(T scalar, tvec3 const & v) { return tvec3( scalar - v.x, @@ -681,7 +659,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator*(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator*(tvec3 const & v, T scalar) { return tvec3( v.x * scalar, @@ -699,7 +677,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator*(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator*(T scalar, tvec3 const & v) { return tvec3( scalar * v.x, @@ -726,7 +704,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator/(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator/(tvec3 const & v, T scalar) { return tvec3( v.x / scalar, @@ -744,7 +722,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator/(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator/(T scalar, tvec3 const & v) { return tvec3( scalar / v.x, @@ -773,7 +751,7 @@ namespace glm // -- Binary bit operators -- template - GLM_FUNC_QUALIFIER tvec3 operator%(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator%(tvec3 const & v, T scalar) { return tvec3( v.x % scalar, @@ -791,7 +769,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator%(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator%(T scalar, tvec3 const & v) { return tvec3( scalar % v.x, @@ -818,7 +796,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator&(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator&(tvec3 const & v, T scalar) { return tvec3( v.x & scalar, @@ -836,7 +814,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator&(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator&(T scalar, tvec3 const & v) { return tvec3( scalar & v.x, @@ -863,7 +841,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator|(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator|(tvec3 const & v, T scalar) { return tvec3( v.x | scalar, @@ -881,7 +859,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator|(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator|(T scalar, tvec3 const & v) { return tvec3( scalar | v.x, @@ -908,7 +886,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator^(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator^(tvec3 const & v, T scalar) { return tvec3( v.x ^ scalar, @@ -926,7 +904,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator^(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator^(T scalar, tvec3 const & v) { return tvec3( scalar ^ v.x, @@ -953,7 +931,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator<<(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator<<(tvec3 const & v, T scalar) { return tvec3( v.x << scalar, @@ -971,7 +949,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator<<(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator<<(T scalar, tvec3 const & v) { return tvec3( scalar << v.x, @@ -998,7 +976,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator>>(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator>>(tvec3 const & v, T scalar) { return tvec3( v.x >> scalar, @@ -1016,7 +994,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator>>(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator>>(T scalar, tvec3 const & v) { return tvec3( scalar >> v.x, diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 4668ff81..624bcf8f 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -346,7 +346,7 @@ namespace detail // -- Binary operators -- template - GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, const T& scalar); + GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, T scalar); template GLM_FUNC_DECL tvec4 operator+(tvec4 const & v1, tvec1 const & v2); @@ -361,7 +361,7 @@ namespace detail GLM_FUNC_DECL tvec4 operator+(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, const T& scalar); + GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, T scalar); template GLM_FUNC_DECL tvec4 operator-(tvec4 const & v1, tvec1 const & v2); @@ -376,7 +376,7 @@ namespace detail GLM_FUNC_DECL tvec4 operator-(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, const T& scalar); + GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, T scalar); template GLM_FUNC_DECL tvec4 operator*(tvec4 const & v1, tvec1 const & v2); @@ -391,16 +391,16 @@ namespace detail GLM_FUNC_DECL tvec4 operator*(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, const T& scalar); + GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, T scalar); template - GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec4 operator/(tvec4 const & v1, tvec1 const & v2); template GLM_FUNC_DECL tvec4 operator/(T scalar, tvec4 const & v); template - GLM_FUNC_DECL tvec4 operator/(tvec1 const & scalar, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator/(tvec1 const & v1, tvec4 const & v2); template GLM_FUNC_DECL tvec4 operator/(tvec4 const & v1, tvec4 const & v2); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 3a929a01..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]; } @@ -642,7 +642,7 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v, const T& scalar) + GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v, T scalar) { return tvec4( v.x + scalar, @@ -692,7 +692,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v, const T& scalar) + GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v, T scalar) { return tvec4( v.x - scalar, @@ -742,7 +742,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator*(tvec4 const & v, const T& scalar) + GLM_FUNC_QUALIFIER tvec4 operator*(tvec4 const & v, T scalar) { return tvec4( v.x * scalar, @@ -792,7 +792,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v, const T& scalar) + GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v, T scalar) { return tvec4( v.x / scalar, @@ -801,6 +801,16 @@ namespace glm v.w / scalar); } + template + GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v1, tvec1 const & v2) + { + return tvec4( + v1.x / v2.x, + v1.y / v2.x, + v1.z / v2.x, + v1.w / v2.x); + } + template GLM_FUNC_QUALIFIER tvec4 operator/(T scalar, tvec4 const & v) { @@ -811,6 +821,16 @@ namespace glm scalar / v.w); } + template + GLM_FUNC_DECL tvec4 operator/(tvec1 const & v1, tvec4 const & v2) + { + return tvec4( + v1.x / v2.x, + v1.x / v2.y, + v1.x / v2.z, + v1.x / v2.w); + } + template GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v1, tvec4 const & v2) { 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.hpp b/glm/gtc/quaternion.hpp index a7055fae..0832f7f3 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -170,6 +170,14 @@ namespace glm template GLM_FUNC_DECL tquat operator/(tquat const & q, T const & s); + // -- Boolean operators -- + + template + GLM_FUNC_DECL bool operator==(tquat const & q1, tquat const & q2); + + template + GLM_FUNC_DECL bool operator!=(tquat const & q1, tquat const & q2); + /// Returns the length of the quaternion. /// /// @see gtc_quaternion 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.hpp b/glm/gtx/dual_quaternion.hpp index 9bef77dd..cddf1fe6 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -130,16 +130,16 @@ namespace glm GLM_FUNC_DECL tdualquat operator*(tdualquat const & q, tdualquat const & p); template - GLM_FUNC_DECL tvec3 operator*(tquat const & q, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator*(tdualquat const & q, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, tquat const & q); + GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, tdualquat const & q); template - GLM_FUNC_DECL tvec4 operator*(tquat const & q, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator*(tdualquat const & q, tvec4 const & v); template - GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, tquat const & q); + GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, tdualquat const & q); template GLM_FUNC_DECL tdualquat operator*(tdualquat const & q, T const & s); @@ -150,6 +150,14 @@ namespace glm template GLM_FUNC_DECL tdualquat operator/(tdualquat const & q, T const & s); + // -- Boolean operators -- + + template + GLM_FUNC_DECL bool operator==(tdualquat const & q1, tdualquat const & q2); + + template + GLM_FUNC_DECL bool operator!=(tdualquat const & q1, tdualquat const & q2); + /// Returns the normalized quaternion. /// /// @see gtx_dual_quaternion diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 961dd1ca..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 -- @@ -194,11 +172,17 @@ namespace glm // -- Unary bit operators -- template - GLM_FUNC_QUALIFIER tdualquat operator-(tdualquat const & q) + GLM_FUNC_QUALIFIER tdualquat operator+(tdualquat const & q) { return q; } + template + GLM_FUNC_QUALIFIER tdualquat operator-(tdualquat const & q) + { + return tdualquat(-q.real, -q.dual); + } + // -- Binary operators -- template 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/readme.md b/readme.md index f178a82d..1bf66230 100644 --- a/readme.md +++ b/readme.md @@ -76,13 +76,15 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ##### Deprecation: - Removed GLM_FORCE_SIZE_FUNC define -#### [GLM 0.9.7.4](https://github.com/g-truc/glm/tree/0.9.7) - 2016-XX-XX +#### [GLM 0.9.7.4](https://github.com/g-truc/glm/releases/tag/0.9.7.4) - 2016-03-19 ##### Fixes: - Fixed asinh and atanh warning with C++98 STL #484 - Fixed polar coordinates function latitude #485 - Fixed outerProduct defintions and operator signatures for mat2x4 and vec4 #475 - Fixed eulerAngles precision error, returns NaN #451 - Fixed undefined reference errors #489 +- Fixed missing GLM_PLATFORM_CYGWIN declaration #495 +- Fixed various undefined reference errors #490 #### [GLM 0.9.7.3](https://github.com/g-truc/glm/releases/tag/0.9.7.3) - 2016-02-21 ##### Improvements: 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