diff --git a/glm/core/type_mat2x2.hpp b/glm/core/type_mat2x2.hpp index 3d000bc9..b3f5c34b 100644 --- a/glm/core/type_mat2x2.hpp +++ b/glm/core/type_mat2x2.hpp @@ -135,8 +135,14 @@ namespace detail GLM_FUNC_DECL tmat2x2 & operator/=(U const & s); template GLM_FUNC_DECL tmat2x2 & operator/=(tmat2x2 const & m); - GLM_FUNC_DECL tmat2x2 & operator++(); - GLM_FUNC_DECL tmat2x2 & operator--(); + + ////////////////////////////////////// + // Increment and decrement operators + + GLM_FUNC_DECL tmat2x2 & operator++ (); + GLM_FUNC_DECL tmat2x2 & operator-- (); + GLM_FUNC_DECL tmat2x2 operator++(int); + GLM_FUNC_DECL tmat2x2 operator--(int); }; // Binary operators @@ -232,18 +238,9 @@ namespace detail // Unary constant operators template - tmat2x2 const operator- ( + tmat2x2 const operator-( tmat2x2 const & m); - template - tmat2x2 const operator-- ( - tmat2x2 const & m, - int); - - template - tmat2x2 const operator++ ( - tmat2x2 const & m, - int); } //namespace detail } //namespace glm diff --git a/glm/core/type_mat2x2.inl b/glm/core/type_mat2x2.inl index f5a42b72..12e40677 100644 --- a/glm/core/type_mat2x2.inl +++ b/glm/core/type_mat2x2.inl @@ -397,7 +397,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator++ () + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator++() { ++this->value[0]; ++this->value[1]; @@ -405,13 +405,29 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator-- () + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator--() { --this->value[0]; --this->value[1]; return *this; } + template + GLM_FUNC_QUALIFIER tmat2x2 tmat2x2::operator++(int) + { + tmat2x2 Result(*this); + ++*this; + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat2x2 tmat2x2::operator--(int) + { + tmat2x2 Result(*this); + --*this; + return Result; + } + ////////////////////////////////////////////////////////////// // Binary operators @@ -649,30 +665,6 @@ namespace detail -m[1]); } - template - GLM_FUNC_QUALIFIER tmat2x2 const operator++ - ( - tmat2x2 const & m, - int - ) - { - return tmat2x2( - m[0] + T(1), - m[1] + T(1)); - } - - template - GLM_FUNC_QUALIFIER tmat2x2 const operator-- - ( - tmat2x2 const & m, - int - ) - { - return tmat2x2( - m[0] - T(1), - m[1] - T(1)); - } - ////////////////////////////////////// // Boolean operators diff --git a/glm/core/type_mat2x3.hpp b/glm/core/type_mat2x3.hpp index 59072282..377910e4 100644 --- a/glm/core/type_mat2x3.hpp +++ b/glm/core/type_mat2x3.hpp @@ -124,8 +124,13 @@ namespace detail template GLM_FUNC_DECL tmat2x3 & operator/= (U const & s); + ////////////////////////////////////// + // Increment and decrement operators + GLM_FUNC_DECL tmat2x3 & operator++ (); GLM_FUNC_DECL tmat2x3 & operator-- (); + GLM_FUNC_DECL tmat2x3 operator++(int); + GLM_FUNC_DECL tmat2x3 operator--(int); }; // Binary operators @@ -196,18 +201,9 @@ namespace detail // Unary constant operators template - tmat2x3 const operator- ( + tmat2x3 const operator- ( tmat2x3 const & m); - template - tmat2x3 const operator-- ( - tmat2x3 const & m, - int); - - template - tmat2x3 const operator++ ( - tmat2x3 const & m, - int); }//namespace detail }//namespace glm diff --git a/glm/core/type_mat2x3.inl b/glm/core/type_mat2x3.inl index 43c38231..4f6d1934 100644 --- a/glm/core/type_mat2x3.inl +++ b/glm/core/type_mat2x3.inl @@ -374,7 +374,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x3 & tmat2x3::operator++ () + GLM_FUNC_QUALIFIER tmat2x3 & tmat2x3::operator++() { ++this->value[0]; ++this->value[1]; @@ -382,13 +382,29 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x3 & tmat2x3::operator-- () + GLM_FUNC_QUALIFIER tmat2x3 & tmat2x3::operator--() { --this->value[0]; --this->value[1]; return *this; } + template + GLM_FUNC_QUALIFIER tmat2x3 tmat2x3::operator++(int) + { + tmat2x3 Result(*this); + ++*this; + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat2x3 tmat2x3::operator--(int) + { + tmat2x3 Result(*this); + --*this; + return Result; + } + ////////////////////////////////////////////////////////////// // Binary operators @@ -595,30 +611,6 @@ namespace detail -m[1]); } - template - GLM_FUNC_QUALIFIER tmat2x3 const operator++ - ( - tmat2x3 const & m, - int - ) - { - return tmat2x3( - m[0] + typename tmat2x3::value_type(1), - m[1] + typename tmat2x3::value_type(1)); - } - - template - GLM_FUNC_QUALIFIER tmat2x3 const operator-- - ( - tmat2x3 const & m, - int - ) - { - return tmat2x3( - m[0] - typename tmat2x3::value_type(1), - m[1] - typename tmat2x3::value_type(1)); - } - ////////////////////////////////////// // Boolean operators diff --git a/glm/core/type_mat2x4.hpp b/glm/core/type_mat2x4.hpp index cd3e4924..d560ca93 100644 --- a/glm/core/type_mat2x4.hpp +++ b/glm/core/type_mat2x4.hpp @@ -126,8 +126,13 @@ namespace detail template GLM_FUNC_DECL tmat2x4& operator/= (U const & s); - GLM_FUNC_DECL tmat2x4& operator++ (); - GLM_FUNC_DECL tmat2x4& operator-- (); + ////////////////////////////////////// + // Increment and decrement operators + + GLM_FUNC_DECL tmat2x4 & operator++ (); + GLM_FUNC_DECL tmat2x4 & operator-- (); + GLM_FUNC_DECL tmat2x4 operator++(int); + GLM_FUNC_DECL tmat2x4 operator--(int); }; // Binary operators @@ -201,16 +206,6 @@ namespace detail tmat2x4 const operator- ( tmat2x4 const & m); - template - tmat2x4 const operator-- ( - tmat2x4 const & m, - int); - - template - tmat2x4 const operator++ ( - tmat2x4 const & m, - int); - }//namespace detail }//namespace glm diff --git a/glm/core/type_mat2x4.inl b/glm/core/type_mat2x4.inl index d201abcd..75069041 100644 --- a/glm/core/type_mat2x4.inl +++ b/glm/core/type_mat2x4.inl @@ -377,7 +377,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator++ () + GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator++() { ++this->value[0]; ++this->value[1]; @@ -385,13 +385,29 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator-- () + GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator--() { --this->value[0]; --this->value[1]; return *this; } + template + GLM_FUNC_QUALIFIER tmat2x4 tmat2x4::operator++(int) + { + tmat2x4 Result(*this); + ++*this; + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat2x4 tmat2x4::operator--(int) + { + tmat2x4 Result(*this); + --*this; + return Result; + } + ////////////////////////////////////////////////////////////// // Binary operators @@ -614,30 +630,6 @@ namespace detail -m[1]); } - template - GLM_FUNC_QUALIFIER tmat2x4 const operator++ - ( - tmat2x4 const & m, - int - ) - { - return tmat2x4( - m[0] + typename tmat2x4::value_type(1), - m[1] + typename tmat2x4::value_type(1)); - } - - template - GLM_FUNC_QUALIFIER tmat2x4 const operator-- - ( - tmat2x4 const & m, - int - ) - { - return tmat2x4( - m[0] - typename tmat2x4::value_type(1), - m[1] - typename tmat2x4::value_type(1)); - } - ////////////////////////////////////// // Boolean operators diff --git a/glm/core/type_mat3x2.hpp b/glm/core/type_mat3x2.hpp index 0f2056cb..b28ef7aa 100644 --- a/glm/core/type_mat3x2.hpp +++ b/glm/core/type_mat3x2.hpp @@ -132,8 +132,13 @@ namespace detail template GLM_FUNC_DECL tmat3x2 & operator/= (U const & s); + ////////////////////////////////////// + // Increment and decrement operators + GLM_FUNC_DECL tmat3x2 & operator++ (); GLM_FUNC_DECL tmat3x2 & operator-- (); + GLM_FUNC_DECL tmat3x2 operator++(int); + GLM_FUNC_DECL tmat3x2 operator--(int); }; // Binary operators @@ -204,18 +209,9 @@ namespace detail // Unary constant operators template - tmat3x2 const operator- ( + tmat3x2 const operator-( tmat3x2 const & m); - template - tmat3x2 const operator-- ( - tmat3x2 const & m, - int); - - template - tmat3x2 const operator++ ( - tmat3x2 const & m, - int); }//namespace detail }//namespace glm diff --git a/glm/core/type_mat3x2.inl b/glm/core/type_mat3x2.inl index a65e5117..ad174850 100644 --- a/glm/core/type_mat3x2.inl +++ b/glm/core/type_mat3x2.inl @@ -421,6 +421,22 @@ namespace detail return *this; } + template + GLM_FUNC_QUALIFIER tmat3x2 tmat3x2::operator++(int) + { + tmat3x2 Result(*this); + ++*this; + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat3x2 tmat3x2::operator--(int) + { + tmat3x2 Result(*this); + --*this; + return Result; + } + ////////////////////////////////////////////////////////////// // Binary operators @@ -627,34 +643,6 @@ namespace detail -m[2]); } - template - GLM_FUNC_QUALIFIER tmat3x2 const operator++ - ( - tmat3x2 const & m, - int - ) - { - typename tmat3x2::value_type One(1); - return tmat3x2( - m[0] + One, - m[1] + One, - m[2] + One); - } - - template - GLM_FUNC_QUALIFIER tmat3x2 const operator-- - ( - tmat3x2 const & m, - int - ) - { - typename tmat3x2::value_type One(1); - return tmat3x2( - m[0] - One, - m[1] - One, - m[2] - One); - } - ////////////////////////////////////// // Boolean operators diff --git a/glm/core/type_mat3x3.hpp b/glm/core/type_mat3x3.hpp index 47708b67..af0e06f3 100644 --- a/glm/core/type_mat3x3.hpp +++ b/glm/core/type_mat3x3.hpp @@ -139,8 +139,14 @@ namespace detail GLM_FUNC_DECL tmat3x3& operator/= (U const & s); template GLM_FUNC_DECL tmat3x3& operator/= (tmat3x3 const & m); - GLM_FUNC_DECL tmat3x3& operator++ (); - GLM_FUNC_DECL tmat3x3& operator-- (); + + ////////////////////////////////////// + // Increment and decrement operators + + GLM_FUNC_DECL tmat3x3 & operator++ (); + GLM_FUNC_DECL tmat3x3 & operator-- (); + GLM_FUNC_DECL tmat3x3 operator++(int); + GLM_FUNC_DECL tmat3x3 operator--(int); }; // Binary operators @@ -236,18 +242,9 @@ namespace detail // Unary constant operators template - tmat3x3 const operator- ( + tmat3x3 const operator-( tmat3x3 const & m); - template - tmat3x3 const operator-- ( - tmat3x3 const & m, - int); - - template - tmat3x3 const operator++ ( - tmat3x3 const & m, - int); }//namespace detail }//namespace glm diff --git a/glm/core/type_mat3x3.inl b/glm/core/type_mat3x3.inl index 7e346448..d36518f3 100644 --- a/glm/core/type_mat3x3.inl +++ b/glm/core/type_mat3x3.inl @@ -426,7 +426,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat3x3 & tmat3x3::operator-- () + GLM_FUNC_QUALIFIER tmat3x3 & tmat3x3::operator--() { --this->value[0]; --this->value[1]; @@ -434,6 +434,22 @@ namespace detail return *this; } + template + GLM_FUNC_QUALIFIER tmat3x3 tmat3x3::operator++(int) + { + tmat3x3 Result(*this); + ++*this; + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat3x3 tmat3x3::operator--(int) + { + tmat3x3 Result(*this); + --*this; + return Result; + } + template GLM_FUNC_QUALIFIER tmat3x3 tmat3x3::_inverse() const { @@ -759,32 +775,6 @@ namespace detail -m[2]); } - template - GLM_FUNC_QUALIFIER tmat3x3 const operator++ - ( - tmat3x3 const & m, - int - ) - { - return tmat3x3( - m[0] + T(1), - m[1] + T(1), - m[2] + T(1)); - } - - template - GLM_FUNC_QUALIFIER tmat3x3 const operator-- - ( - tmat3x3 const & m, - int - ) - { - return tmat3x3( - m[0] - T(1), - m[1] - T(1), - m[2] - T(1)); - } - ////////////////////////////////////// // Boolean operators diff --git a/glm/core/type_mat3x4.hpp b/glm/core/type_mat3x4.hpp index 9ed720fb..9d18f488 100644 --- a/glm/core/type_mat3x4.hpp +++ b/glm/core/type_mat3x4.hpp @@ -132,8 +132,13 @@ namespace detail template GLM_FUNC_DECL tmat3x4 & operator/= (U const & s); + ////////////////////////////////////// + // Increment and decrement operators + GLM_FUNC_DECL tmat3x4 & operator++ (); GLM_FUNC_DECL tmat3x4 & operator-- (); + GLM_FUNC_DECL tmat3x4 operator++(int); + GLM_FUNC_DECL tmat3x4 operator--(int); }; // Binary operators @@ -204,19 +209,9 @@ namespace detail // Unary constant operators template - tmat3x4 const operator- ( + tmat3x4 const operator-( tmat3x4 const & m); - template - tmat3x4 const operator-- ( - tmat3x4 const & m, - int); - - template - tmat3x4 const operator++ ( - tmat3x4 const & m, - int); - }//namespace detail }//namespace glm diff --git a/glm/core/type_mat3x4.inl b/glm/core/type_mat3x4.inl index 6bfbca2d..2a3839cf 100644 --- a/glm/core/type_mat3x4.inl +++ b/glm/core/type_mat3x4.inl @@ -420,6 +420,22 @@ namespace detail return *this; } + template + GLM_FUNC_QUALIFIER tmat3x4 tmat3x4::operator++(int) + { + tmat3x4 Result(*this); + ++*this; + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat3x4 tmat3x4::operator--(int) + { + tmat3x4 Result(*this); + --*this; + return Result; + } + ////////////////////////////////////////////////////////////// // Binary operators @@ -660,32 +676,6 @@ namespace detail -m[2]); } - template - GLM_FUNC_QUALIFIER tmat3x4 const operator++ - ( - tmat3x4 const & m, - int - ) - { - return tmat3x4( - m[0] + T(1), - m[1] + T(1), - m[2] + T(1)); - } - - template - GLM_FUNC_QUALIFIER tmat3x4 const operator-- - ( - tmat3x4 const & m, - int - ) - { - return tmat3x4( - m[0] - T(1), - m[1] - T(1), - m[2] - T(1)); - } - ////////////////////////////////////// // Boolean operators diff --git a/glm/core/type_mat4x2.hpp b/glm/core/type_mat4x2.hpp index 9594d41f..a50c4d4c 100644 --- a/glm/core/type_mat4x2.hpp +++ b/glm/core/type_mat4x2.hpp @@ -137,8 +137,13 @@ namespace detail template GLM_FUNC_DECL tmat4x2& operator/= (U const & s); - GLM_FUNC_DECL tmat4x2& operator++ (); - GLM_FUNC_DECL tmat4x2& operator-- (); + ////////////////////////////////////// + // Increment and decrement operators + + GLM_FUNC_DECL tmat4x2 & operator++ (); + GLM_FUNC_DECL tmat4x2 & operator-- (); + GLM_FUNC_DECL tmat4x2 operator++(int); + GLM_FUNC_DECL tmat4x2 operator--(int); }; // Binary operators @@ -209,18 +214,9 @@ namespace detail // Unary constant operators template - tmat4x2 const operator- ( + tmat4x2 const operator-( tmat4x2 const & m); - template - tmat4x2 const operator-- ( - tmat4x2 const & m, - int); - - template - tmat4x2 const operator++ ( - tmat4x2 const & m, - int); }//namespace detail }//namespace glm diff --git a/glm/core/type_mat4x2.inl b/glm/core/type_mat4x2.inl index 009403d8..0d93542a 100644 --- a/glm/core/type_mat4x2.inl +++ b/glm/core/type_mat4x2.inl @@ -454,6 +454,22 @@ namespace detail return *this; } + template + GLM_FUNC_QUALIFIER tmat4x2 tmat4x2::operator++(int) + { + tmat4x2 Result(*this); + ++*this; + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat4x2 tmat4x2::operator--(int) + { + tmat4x2 Result(*this); + --*this; + return Result; + } + ////////////////////////////////////////////////////////////// // Binary operators @@ -676,34 +692,6 @@ namespace detail -m[3]); } - template - GLM_FUNC_QUALIFIER tmat4x2 const operator++ - ( - tmat4x2 const & m, - int - ) - { - return tmat4x2( - m[0] + typename tmat4x2::value_type(1), - m[1] + typename tmat4x2::value_type(1), - m[2] + typename tmat4x2::value_type(1), - m[3] + typename tmat4x2::value_type(1)); - } - - template - GLM_FUNC_QUALIFIER tmat4x2 const operator-- - ( - tmat4x2 const & m, - int - ) - { - return tmat4x2( - m[0] - typename tmat4x2::value_type(1), - m[1] - typename tmat4x2::value_type(1), - m[2] - typename tmat4x2::value_type(1), - m[3] - typename tmat4x2::value_type(1)); - } - ////////////////////////////////////// // Boolean operators diff --git a/glm/core/type_mat4x3.hpp b/glm/core/type_mat4x3.hpp index d5106d6f..e0e376c0 100644 --- a/glm/core/type_mat4x3.hpp +++ b/glm/core/type_mat4x3.hpp @@ -135,8 +135,13 @@ namespace detail template GLM_FUNC_DECL tmat4x3 & operator/= (U const & s); + ////////////////////////////////////// + // Increment and decrement operators + GLM_FUNC_DECL tmat4x3 & operator++ (); GLM_FUNC_DECL tmat4x3 & operator-- (); + GLM_FUNC_DECL tmat4x3 operator++(int); + GLM_FUNC_DECL tmat4x3 operator--(int); }; // Binary operators @@ -210,15 +215,6 @@ namespace detail tmat4x3 const operator- ( tmat4x3 const & m); - template - tmat4x3 const operator-- ( - tmat4x3 const & m, - int); - - template - tmat4x3 const operator++ ( - tmat4x3 const & m, - int); }//namespace detail }//namespace glm diff --git a/glm/core/type_mat4x3.inl b/glm/core/type_mat4x3.inl index ab1c9ed6..807060c2 100644 --- a/glm/core/type_mat4x3.inl +++ b/glm/core/type_mat4x3.inl @@ -710,6 +710,22 @@ namespace detail m[3] - T(1)); } + template + GLM_FUNC_QUALIFIER tmat4x3 tmat4x3::operator++(int) + { + tmat4x3 Result(*this); + ++*this; + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat4x3 tmat4x3::operator--(int) + { + tmat4x3 Result(*this); + --*this; + return Result; + } + ////////////////////////////////////// // Boolean operators diff --git a/glm/core/type_mat4x4.hpp b/glm/core/type_mat4x4.hpp index baa3c1a1..407c4341 100644 --- a/glm/core/type_mat4x4.hpp +++ b/glm/core/type_mat4x4.hpp @@ -142,8 +142,14 @@ namespace detail GLM_FUNC_DECL tmat4x4 & operator/= (U const & s); template GLM_FUNC_DECL tmat4x4 & operator/= (tmat4x4 const & m); + + ////////////////////////////////////// + // Increment and decrement operators + GLM_FUNC_DECL tmat4x4 & operator++ (); GLM_FUNC_DECL tmat4x4 & operator-- (); + GLM_FUNC_DECL tmat4x4 operator++(int); + GLM_FUNC_DECL tmat4x4 operator--(int); }; // Binary operators @@ -242,14 +248,6 @@ namespace detail tmat4x4 const operator- ( tmat4x4 const & m); - template - tmat4x4 const operator-- ( - tmat4x4 const & m, int); - - template - tmat4x4 const operator++ ( - tmat4x4 const & m, int); - }//namespace detail }//namespace glm diff --git a/glm/core/type_mat4x4.inl b/glm/core/type_mat4x4.inl index c26f5687..8d350dfd 100644 --- a/glm/core/type_mat4x4.inl +++ b/glm/core/type_mat4x4.inl @@ -496,6 +496,22 @@ namespace detail return *this; } + template + GLM_FUNC_QUALIFIER tmat4x4 tmat4x4::operator++(int) + { + tmat4x4 Result(*this); + ++*this; + return Result; + } + + template + GLM_FUNC_QUALIFIER tmat4x4 tmat4x4::operator--(int) + { + tmat4x4 Result(*this); + --*this; + return Result; + } + template GLM_FUNC_QUALIFIER tmat4x4 tmat4x4::_inverse() const { diff --git a/test/gtc/gtc_matrix_access.cpp b/test/gtc/gtc_matrix_access.cpp index 7dc8ded5..d256298e 100644 --- a/test/gtc/gtc_matrix_access.cpp +++ b/test/gtc/gtc_matrix_access.cpp @@ -349,7 +349,7 @@ int test_mat4x4_col_get() glm::vec4 D = glm::column(m, 3); Error += D == glm::vec4(0, 0, 0, 1) ? 0 : 1; - return Error; + return Error; } int main()