From f1d4c3962215160db53683905798ca22a0bfc5ab Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 14 Feb 2015 01:11:10 +0100 Subject: [PATCH 1/7] Fixed memory corruption (undefined behaviour) #303 --- glm/detail/type_vec1.hpp | 3 ++ glm/detail/type_vec1.inl | 12 +++++ glm/detail/type_vec2.hpp | 3 ++ glm/detail/type_vec2.inl | 101 +++++++++++++++++++-------------------- glm/detail/type_vec3.hpp | 3 ++ glm/detail/type_vec3.inl | 14 ++++++ glm/detail/type_vec4.hpp | 3 ++ readme.txt | 1 + 8 files changed, 87 insertions(+), 53 deletions(-) diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 6967d3e0..3550d032 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -108,6 +108,7 @@ namespace glm // Implicit basic constructors GLM_FUNC_DECL tvec1(); + GLM_FUNC_DECL tvec1(tvec1 const & v); template GLM_FUNC_DECL tvec1(tvec1 const & v); @@ -154,6 +155,8 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tvec1 & operator=(tvec1 const & v); + template GLM_FUNC_DECL tvec1 & operator=(tvec1 const & v); template diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 16f9ba15..bd756cd4 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -42,6 +42,11 @@ namespace glm # endif {} + template + GLM_FUNC_QUALIFIER tvec1::tvec1(tvec1 const & v) + : x(v.x) + {} + template template GLM_FUNC_QUALIFIER tvec1::tvec1(tvec1 const & v) @@ -135,6 +140,13 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator=(tvec1 const & v) + { + this->x = v.x; + return *this; + } + template template GLM_FUNC_QUALIFIER tvec1 & tvec1::operator=(tvec1 const & v) diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 8663f24e..15fe74e0 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -109,6 +109,7 @@ namespace glm // Implicit basic constructors GLM_FUNC_DECL tvec2(); + GLM_FUNC_DECL tvec2(tvec2 const & v); template GLM_FUNC_DECL tvec2(tvec2 const & v); @@ -162,6 +163,8 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tvec2 & operator=(tvec2 const & v); + template GLM_FUNC_DECL tvec2 & operator=(tvec2 const & v); template diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index f0219c8f..4db29479 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////////////////////// /// OpenGL Mathematics (glm.g-truc.net) /// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to deal /// in the Software without restriction, including without limitation the rights @@ -12,10 +12,6 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -25,13 +21,44 @@ /// THE SOFTWARE. /// /// @ref core -/// @file glm/detail/type_tvec2.inl +/// @file glm/core/type_tvec2.inl /// @date 2008-08-18 / 2011-06-15 /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// namespace glm { +#ifdef GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec2::size() const + { + return 2; + } +#else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec2::length() const + { + return 2; + } +#endif + + ////////////////////////////////////// + // Accesses + + template + GLM_FUNC_QUALIFIER T & tvec2::operator[](length_t i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + + template + GLM_FUNC_QUALIFIER T const & tvec2::operator[](length_t i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } + ////////////////////////////////////// // Implicit basic constructors @@ -42,6 +69,11 @@ namespace glm # endif {} + template + GLM_FUNC_QUALIFIER tvec2::tvec2(tvec2 const & v) + : x(v.x), y(v.y) + {} + template template GLM_FUNC_QUALIFIER tvec2::tvec2(tvec2 const & v) @@ -61,8 +93,8 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tvec2::tvec2(T const & a, T const & b) - : x(a), y(b) + GLM_FUNC_QUALIFIER tvec2::tvec2(T const & s1, T const & s2) + : x(s1), y(s2) {} ////////////////////////////////////// @@ -106,54 +138,17 @@ namespace glm , y(static_cast(v.y)) {} - ////////////////////////////////////// - // Component accesses - -# ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2::size_type tvec2::size() const - { - return 2; - } - - template - GLM_FUNC_QUALIFIER T & tvec2::operator[](typename tvec2::size_type i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER T const & tvec2::operator[](typename tvec2::size_type i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } -# else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2::length_type tvec2::length() const - { - return 2; - } - - template - GLM_FUNC_QUALIFIER T & tvec2::operator[](typename tvec2::length_type i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER T const & tvec2::operator[](typename tvec2::length_type i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } -# endif//GLM_FORCE_SIZE_FUNC - ////////////////////////////////////// // Unary arithmetic operators + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) + { + this->x = v.x; + this->y = v.y; + return *this; + } + template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 5fe349e6..5f0673bf 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -110,6 +110,7 @@ namespace glm // Implicit basic constructors GLM_FUNC_DECL tvec3(); + GLM_FUNC_DECL tvec3(tvec3 const & v); template GLM_FUNC_DECL tvec3(tvec3 const & v); @@ -184,6 +185,8 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tvec3 & operator=(tvec3 const & v); + template GLM_FUNC_DECL tvec3 & operator=(tvec3 const & v); template diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 92f78436..b2088d8b 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -42,6 +42,11 @@ namespace glm # endif {} + template + GLM_FUNC_QUALIFIER tvec3::tvec3(tvec3 const & v) + : x(v.x), y(v.y), z(v.z) + {} + template template GLM_FUNC_QUALIFIER tvec3::tvec3(tvec3 const & v) @@ -183,6 +188,15 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + template + GLM_FUNC_QUALIFIER tvec3& tvec3::operator=(tvec3 const & v) + { + this->x = v.x; + this->y = v.y; + this->z = v.z; + return *this; + } + template template GLM_FUNC_QUALIFIER tvec3& tvec3::operator=(tvec3 const & v) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index ea9409ab..408d2de4 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -167,6 +167,7 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec4(); + //GLM_FUNC_DECL tvec4(tvec4 const & v); template GLM_FUNC_DECL tvec4(tvec4 const & v); @@ -284,6 +285,8 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators + //GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); + template GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); template diff --git a/readme.txt b/readme.txt index 7ca5bf76..cb5d6273 100644 --- a/readme.txt +++ b/readme.txt @@ -87,6 +87,7 @@ Fixes: - Disabled GTX_scalar_multiplication for GCC, failing to build tests #242 - Fixed Visual C++ 2015 constexpr errors: Disabled only partial support - Fixed functions not inlined with Clang #302 +- Fixed memory corruption (undefined behaviour) #303 ================================================================================ GLM 0.9.6.1: 2014-12-10 From 78443328165be1420e625963423ec9afa26f1527 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 14 Feb 2015 13:56:48 +0100 Subject: [PATCH 2/7] Fixed memory corruption (undefined behaviour) #303 --- glm/detail/type_mat2x2.hpp | 3 ++ glm/detail/type_mat2x2.inl | 15 ++++++ glm/detail/type_mat2x3.hpp | 72 +++++++++----------------- glm/detail/type_mat2x3.inl | 15 ++++++ glm/detail/type_mat2x4.hpp | 76 ++++++++++----------------- glm/detail/type_mat2x4.inl | 15 ++++++ glm/detail/type_mat3x2.hpp | 72 +++++++++----------------- glm/detail/type_mat3x2.inl | 17 ++++++ glm/detail/type_mat3x3.hpp | 100 ++++++++++++------------------------ glm/detail/type_mat3x3.inl | 17 ++++++ glm/detail/type_mat3x4.hpp | 3 ++ glm/detail/type_mat3x4.inl | 17 ++++++ glm/detail/type_mat4x2.hpp | 17 +++--- glm/detail/type_mat4x2.inl | 19 +++++++ glm/detail/type_mat4x3.hpp | 3 ++ glm/detail/type_mat4x3.inl | 19 +++++++ glm/detail/type_mat4x4.hpp | 3 ++ glm/detail/type_mat4x4.inl | 21 ++++++++ glm/detail/type_vec2.hpp | 52 +++++++++---------- glm/detail/type_vec4.hpp | 4 +- glm/detail/type_vec4.inl | 15 ++++++ glm/gtc/quaternion.hpp | 18 +++++-- glm/gtc/quaternion.inl | 69 ++++++++++++++++++------- glm/gtx/dual_quaternion.hpp | 11 +++- glm/gtx/dual_quaternion.inl | 37 ++++++++++--- 25 files changed, 431 insertions(+), 279 deletions(-) diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index eac1034a..046ceac3 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -63,6 +63,7 @@ namespace glm ////////////////////////////////////// // Constructors GLM_FUNC_DECL tmat2x2(); + GLM_FUNC_DECL tmat2x2(tmat2x2 const & m); template GLM_FUNC_DECL tmat2x2(tmat2x2 const & m); @@ -127,6 +128,8 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tmat2x2 & operator=(tmat2x2 const & v); + template GLM_FUNC_DECL tmat2x2 & operator=(tmat2x2 const & m); template diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index cac40352..779cc091 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -62,6 +62,13 @@ namespace detail # endif } + template + GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(tmat2x2 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + } + template template GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(tmat2x2 const & m) @@ -236,6 +243,14 @@ namespace detail ////////////////////////////////////////////////////////////// // Unary updatable operators + template + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator=(tmat2x2 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + return *this; + } + template template GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator=(tmat2x2 const & m) diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index f6a6caec..9986e881 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -58,6 +58,7 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat2x3(); + GLM_FUNC_DECL tmat2x3(tmat2x3 const & m); template GLM_FUNC_DECL tmat2x3(tmat2x3 const & m); @@ -123,20 +124,22 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tmat2x3 & operator=(tmat2x3 const & m); + template - GLM_FUNC_DECL tmat2x3 & operator= (tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 & operator=(tmat2x3 const & m); template - GLM_FUNC_DECL tmat2x3 & operator+= (U s); + GLM_FUNC_DECL tmat2x3 & operator+=(U s); template - GLM_FUNC_DECL tmat2x3 & operator+= (tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 & operator+=(tmat2x3 const & m); template - GLM_FUNC_DECL tmat2x3 & operator-= (U s); + GLM_FUNC_DECL tmat2x3 & operator-=(U s); template - GLM_FUNC_DECL tmat2x3 & operator-= (tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 & operator-=(tmat2x3 const & m); template - GLM_FUNC_DECL tmat2x3 & operator*= (U s); + GLM_FUNC_DECL tmat2x3 & operator*=(U s); template - GLM_FUNC_DECL tmat2x3 & operator/= (U s); + GLM_FUNC_DECL tmat2x3 & operator/=(U s); ////////////////////////////////////// // Increment and decrement operators @@ -150,74 +153,47 @@ 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 const & s); template - GLM_FUNC_DECL tmat2x3 operator+ ( - tmat2x3 const & m1, - tmat2x3 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat2x3 operator- ( - tmat2x3 const & m1, - tmat2x3 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat2x3 operator* ( - T const & s, - tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 operator*(T const & s, tmat2x3 const & m); template - GLM_FUNC_DECL typename tmat2x3::col_type operator* ( - tmat2x3 const & m, - typename tmat2x3::row_type const & v); + GLM_FUNC_DECL typename tmat2x3::col_type operator*(tmat2x3 const & m, typename tmat2x3::row_type const & v); template - GLM_FUNC_DECL typename tmat2x3::row_type operator* ( - typename tmat2x3::col_type const & v, - tmat2x3 const & m); + GLM_FUNC_DECL typename tmat2x3::row_type operator*(typename tmat2x3::col_type const & v, tmat2x3 const & m); template - GLM_FUNC_DECL tmat2x3 operator* ( - tmat2x3 const & m1, - tmat2x2 const & m2); + GLM_FUNC_DECL tmat2x3 operator*(tmat2x3 const & m1, tmat2x2 const & m2); template - GLM_FUNC_DECL tmat3x3 operator* ( - tmat2x3 const & m1, - tmat3x2 const & m2); + GLM_FUNC_DECL tmat3x3 operator*(tmat2x3 const & m1, tmat3x2 const & m2); template - GLM_FUNC_DECL tmat4x3 operator* ( - tmat2x3 const & m1, - tmat4x2 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat2x3 operator/ ( - T const & s, - tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 operator/(T const & s, tmat2x3 const & m); // Unary constant operators template - GLM_FUNC_DECL tmat2x3 const operator- ( - tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 const operator-(tmat2x3 const & m); }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 126f5858..32c30fdd 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -44,6 +44,13 @@ namespace glm # endif } + template + GLM_FUNC_QUALIFIER tmat2x3::tmat2x3(tmat2x3 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + } + template template GLM_FUNC_QUALIFIER tmat2x3::tmat2x3(tmat2x3 const & m) @@ -220,6 +227,14 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators + template + GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator=(tmat2x3 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + return *this; + } + template template GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator=(tmat2x3 const & m) diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 7087e06c..9239e9c9 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -58,6 +58,7 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat2x4(); + GLM_FUNC_DECL tmat2x4(tmat2x4 const & m); template GLM_FUNC_DECL tmat2x4(tmat2x4 const & m); @@ -124,20 +125,22 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tmat2x4 & operator=(tmat2x4 const & m); + template - GLM_FUNC_DECL tmat2x4& operator= (tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 & operator=(tmat2x4 const & m); template - GLM_FUNC_DECL tmat2x4& operator+= (U s); + GLM_FUNC_DECL tmat2x4 & operator+=(U s); template - GLM_FUNC_DECL tmat2x4& operator+= (tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 & operator+=(tmat2x4 const & m); template - GLM_FUNC_DECL tmat2x4& operator-= (U s); + GLM_FUNC_DECL tmat2x4 & operator-=(U s); template - GLM_FUNC_DECL tmat2x4& operator-= (tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 & operator-=(tmat2x4 const & m); template - GLM_FUNC_DECL tmat2x4& operator*= (U s); + GLM_FUNC_DECL tmat2x4 & operator*=(U s); template - GLM_FUNC_DECL tmat2x4& operator/= (U s); + GLM_FUNC_DECL tmat2x4 & operator/=(U s); ////////////////////////////////////// // Increment and decrement operators @@ -151,74 +154,47 @@ 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 const & s); template - GLM_FUNC_DECL tmat2x4 operator+ ( - tmat2x4 const & m1, - tmat2x4 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat2x4 operator- ( - tmat2x4 const & m1, - tmat2x4 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat2x4 operator* ( - T const & s, - tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 operator*(T const & s, tmat2x4 const & m); template - GLM_FUNC_DECL typename tmat2x4::col_type operator* ( - tmat2x4 const & m, - typename tmat2x4::row_type const & v); + GLM_FUNC_DECL typename tmat2x4::col_type operator*(tmat2x4 const & m, typename tmat2x4::row_type const & v); template - GLM_FUNC_DECL typename tmat2x4::row_type operator* ( - typename tmat2x4::col_type const & v, - tmat2x4 const & m); + GLM_FUNC_DECL typename tmat2x4::row_type operator*(typename tmat2x4::col_type const & v, tmat2x4 const & m); template - GLM_FUNC_DECL tmat4x4 operator* ( - tmat2x4 const & m1, - tmat4x2 const & m2); + GLM_FUNC_DECL tmat4x4 operator*(tmat2x4 const & m1, tmat4x2 const & m2); template - GLM_FUNC_DECL tmat2x4 operator* ( - tmat2x4 const & m1, - tmat2x2 const & m2); - - template - GLM_FUNC_DECL tmat3x4 operator* ( - tmat2x4 const & m1, - tmat3x2 const & m2); + GLM_FUNC_DECL tmat2x4 operator*(tmat2x4 const & m1, tmat2x2 const & m2); template - GLM_FUNC_DECL tmat2x4 operator/ ( - tmat2x4 const & m, - T s); + GLM_FUNC_DECL tmat3x4 operator*(tmat2x4 const & m1, tmat3x2 const & m2); + + template + GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, T s); template - GLM_FUNC_DECL tmat2x4 operator/ ( - T s, - tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 operator/(T s, tmat2x4 const & m); // Unary constant operators template - GLM_FUNC_DECL tmat2x4 const operator- ( - tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 const operator-(tmat2x4 const & m); }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index a7b89643..fcf5d315 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -44,6 +44,13 @@ namespace glm # endif } + template + GLM_FUNC_QUALIFIER tmat2x4::tmat2x4(tmat2x4 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + } + template template GLM_FUNC_QUALIFIER tmat2x4::tmat2x4(tmat2x4 const & m) @@ -221,6 +228,14 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators + template + GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator=(tmat2x4 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + return *this; + } + template template GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator=(tmat2x4 const & m) diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 0ba7cfeb..9fd573f2 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -58,6 +58,7 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat3x2(); + GLM_FUNC_DECL tmat3x2(tmat3x2 const & m); template GLM_FUNC_DECL tmat3x2(tmat3x2 const & m); @@ -130,20 +131,22 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tmat3x2 & operator=(tmat3x2 const & m); + template - GLM_FUNC_DECL tmat3x2 & operator= (tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 & operator=(tmat3x2 const & m); template - GLM_FUNC_DECL tmat3x2 & operator+= (U s); + GLM_FUNC_DECL tmat3x2 & operator+=(U s); template - GLM_FUNC_DECL tmat3x2 & operator+= (tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 & operator+=(tmat3x2 const & m); template - GLM_FUNC_DECL tmat3x2 & operator-= (U s); + GLM_FUNC_DECL tmat3x2 & operator-=(U s); template - GLM_FUNC_DECL tmat3x2 & operator-= (tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 & operator-=(tmat3x2 const & m); template - GLM_FUNC_DECL tmat3x2 & operator*= (U s); + GLM_FUNC_DECL tmat3x2 & operator*=(U s); template - GLM_FUNC_DECL tmat3x2 & operator/= (U s); + GLM_FUNC_DECL tmat3x2 & operator/=(U s); ////////////////////////////////////// // Increment and decrement operators @@ -156,74 +159,47 @@ 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 const & s); template - GLM_FUNC_DECL tmat3x2 operator+ ( - tmat3x2 const & m1, - tmat3x2 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat3x2 operator- ( - tmat3x2 const & m1, - tmat3x2 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat3x2 operator* ( - T const & s, - tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 operator*(T const & s, tmat3x2 const & m); template - GLM_FUNC_DECL typename tmat3x2::col_type operator* ( - tmat3x2 const & m, - typename tmat3x2::row_type const & v); + GLM_FUNC_DECL typename tmat3x2::col_type operator*(tmat3x2 const & m, typename tmat3x2::row_type const & v); template - GLM_FUNC_DECL typename tmat3x2::row_type operator* ( - typename tmat3x2::col_type const & v, - tmat3x2 const & m); + GLM_FUNC_DECL typename tmat3x2::row_type operator*(typename tmat3x2::col_type const & v, tmat3x2 const & m); template - GLM_FUNC_DECL tmat2x2 operator* ( - tmat3x2 const & m1, - tmat2x3 const & m2); + GLM_FUNC_DECL tmat2x2 operator*(tmat3x2 const & m1, tmat2x3 const & m2); template - GLM_FUNC_DECL tmat3x2 operator* ( - tmat3x2 const & m1, - tmat3x3 const & m2); + GLM_FUNC_DECL tmat3x2 operator*(tmat3x2 const & m1, tmat3x3 const & m2); template - GLM_FUNC_DECL tmat4x2 operator* ( - tmat3x2 const & m1, - tmat4x3 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat3x2 operator/ ( - T const & s, - tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 operator/(T const & s, tmat3x2 const & m); // Unary constant operators template - GLM_FUNC_DECL tmat3x2 const operator-( - tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 const operator-(tmat3x2 const & m); }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index e4f4d42d..d42a9aec 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -45,6 +45,14 @@ namespace glm # endif } + template + GLM_FUNC_QUALIFIER tmat3x2::tmat3x2(tmat3x2 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + } + template template GLM_FUNC_QUALIFIER tmat3x2::tmat3x2(tmat3x2 const & m) @@ -249,6 +257,15 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators + template + GLM_FUNC_QUALIFIER tmat3x2& tmat3x2::operator=(tmat3x2 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + return *this; + } + template template GLM_FUNC_QUALIFIER tmat3x2& tmat3x2::operator=(tmat3x2 const & m) diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 9064cee9..dddfc535 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -62,6 +62,7 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat3x3(); + GLM_FUNC_DECL tmat3x3(tmat3x3 const & m); template GLM_FUNC_DECL tmat3x3(tmat3x3 const & m); @@ -134,129 +135,94 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tmat3x3 & operator=(tmat3x3 const & m); + template - GLM_FUNC_DECL tmat3x3& operator= (tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 & operator=(tmat3x3 const & m); template - GLM_FUNC_DECL tmat3x3& operator+= (U s); + GLM_FUNC_DECL tmat3x3 & operator+=(U s); template - GLM_FUNC_DECL tmat3x3& operator+= (tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 & operator+=(tmat3x3 const & m); template - GLM_FUNC_DECL tmat3x3& operator-= (U s); + GLM_FUNC_DECL tmat3x3 & operator-=(U s); template - GLM_FUNC_DECL tmat3x3& operator-= (tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 & operator-=(tmat3x3 const & m); template - GLM_FUNC_DECL tmat3x3& operator*= (U s); + GLM_FUNC_DECL tmat3x3 & operator*=(U s); template - GLM_FUNC_DECL tmat3x3& operator*= (tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 & operator*=(tmat3x3 const & m); template - GLM_FUNC_DECL tmat3x3& operator/= (U s); + GLM_FUNC_DECL tmat3x3 & operator/=(U s); template - GLM_FUNC_DECL tmat3x3& operator/= (tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 & operator/=(tmat3x3 const & m); ////////////////////////////////////// // Increment and decrement operators - GLM_FUNC_DECL tmat3x3 & operator++ (); - GLM_FUNC_DECL tmat3x3 & operator-- (); + GLM_FUNC_DECL tmat3x3 & operator++(); + GLM_FUNC_DECL tmat3x3 & operator--(); GLM_FUNC_DECL tmat3x3 operator++(int); GLM_FUNC_DECL tmat3x3 operator--(int); }; // Binary operators template - GLM_FUNC_DECL tmat3x3 operator+ ( - tmat3x3 const & m, - T const & s); + GLM_FUNC_DECL tmat3x3 operator+(tmat3x3 const & m, T const & s); template - GLM_FUNC_DECL tmat3x3 operator+ ( - T const & s, - tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator+(T const & s, tmat3x3 const & m); template - GLM_FUNC_DECL tmat3x3 operator+ ( - tmat3x3 const & m1, - tmat3x3 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat3x3 operator- ( - T const & s, - tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator-(T const & s, tmat3x3 const & m); template - GLM_FUNC_DECL tmat3x3 operator- ( - tmat3x3 const & m1, - tmat3x3 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat3x3 operator* ( - T const & s, - tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator*(T const & s, tmat3x3 const & m); template - GLM_FUNC_DECL typename tmat3x3::col_type operator* ( - tmat3x3 const & m, - typename tmat3x3::row_type const & v); + GLM_FUNC_DECL typename tmat3x3::col_type operator*(tmat3x3 const & m, typename tmat3x3::row_type const & v); template - GLM_FUNC_DECL typename tmat3x3::row_type operator* ( - typename tmat3x3::col_type const & v, - tmat3x3 const & m); + GLM_FUNC_DECL typename tmat3x3::row_type operator*(typename tmat3x3::col_type const & v, tmat3x3 const & m); template - GLM_FUNC_DECL tmat3x3 operator* ( - tmat3x3 const & m1, - tmat3x3 const & m2); + GLM_FUNC_DECL tmat3x3 operator*(tmat3x3 const & m1, tmat3x3 const & m2); template - GLM_FUNC_DECL tmat2x3 operator* ( - tmat3x3 const & m1, - tmat2x3 const & m2); + GLM_FUNC_DECL tmat2x3 operator*(tmat3x3 const & m1, tmat2x3 const & m2); template - GLM_FUNC_DECL tmat4x3 operator* ( - tmat3x3 const & m1, - tmat4x3 const & m2); + 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 const & s); template - GLM_FUNC_DECL tmat3x3 operator/ ( - T const & s, - tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator/(T const & s, tmat3x3 const & m); template - GLM_FUNC_DECL typename tmat3x3::col_type operator/ ( - tmat3x3 const & m, - typename tmat3x3::row_type const & v); + GLM_FUNC_DECL typename tmat3x3::col_type operator/(tmat3x3 const & m, typename tmat3x3::row_type const & v); template - GLM_FUNC_DECL typename tmat3x3::row_type operator/ ( - typename tmat3x3::col_type const & v, - tmat3x3 const & m); + GLM_FUNC_DECL typename tmat3x3::row_type operator/(typename tmat3x3::col_type const & v, tmat3x3 const & m); template - GLM_FUNC_DECL tmat3x3 operator/ ( - tmat3x3 const & m1, - tmat3x3 const & m2); + GLM_FUNC_DECL tmat3x3 operator/(tmat3x3 const & m1, tmat3x3 const & m2); // Unary constant operators template - GLM_FUNC_DECL tmat3x3 const operator-( - tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 const operator-(tmat3x3 const & m); }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index de7c24ee..ad933d36 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -73,6 +73,14 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(ctor) {} + template + GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(tmat3x3 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + } + template template GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(tmat3x3 const & m) @@ -273,6 +281,15 @@ namespace detail ////////////////////////////////////////////////////////////// // Operators + template + GLM_FUNC_QUALIFIER tmat3x3 & tmat3x3::operator=(tmat3x3 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + return *this; + } + template template GLM_FUNC_QUALIFIER tmat3x3 & tmat3x3::operator=(tmat3x3 const & m) diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 8222ea45..7814e3fd 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -58,6 +58,7 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat3x4(); + GLM_FUNC_DECL tmat3x4(tmat3x4 const & m); template GLM_FUNC_DECL tmat3x4(tmat3x4 const & m); @@ -129,6 +130,8 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tmat3x4 & operator=(tmat3x4 const & m); + template GLM_FUNC_DECL tmat3x4 & operator=(tmat3x4 const & m); template diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index cf474c1a..03e0c2cf 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -45,6 +45,14 @@ namespace glm # endif } + template + GLM_FUNC_QUALIFIER tmat3x4::tmat3x4(tmat3x4 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + } + template template GLM_FUNC_QUALIFIER tmat3x4::tmat3x4(tmat3x4 const & m) @@ -248,6 +256,15 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators + template + GLM_FUNC_QUALIFIER tmat3x4& tmat3x4::operator=(tmat3x4 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + return *this; + } + template template GLM_FUNC_QUALIFIER tmat3x4& tmat3x4::operator=(tmat3x4 const & m) diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 2ad1affc..d529ecbd 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -58,6 +58,7 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat4x2(); + GLM_FUNC_DECL tmat4x2(tmat4x2 const & m); template GLM_FUNC_DECL tmat4x2(tmat4x2 const & m); @@ -135,20 +136,22 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tmat4x2 & operator=(tmat4x2 const & m); + template - GLM_FUNC_DECL tmat4x2& operator=(tmat4x2 const & m); + GLM_FUNC_DECL tmat4x2 & operator=(tmat4x2 const & m); template - GLM_FUNC_DECL tmat4x2& operator+=(U s); + GLM_FUNC_DECL tmat4x2 & operator+=(U s); template - GLM_FUNC_DECL tmat4x2& operator+=(tmat4x2 const & m); + GLM_FUNC_DECL tmat4x2 & operator+=(tmat4x2 const & m); template - GLM_FUNC_DECL tmat4x2& operator-=(U s); + GLM_FUNC_DECL tmat4x2 & operator-=(U s); template - GLM_FUNC_DECL tmat4x2& operator-=(tmat4x2 const & m); + GLM_FUNC_DECL tmat4x2 & operator-=(tmat4x2 const & m); template - GLM_FUNC_DECL tmat4x2& operator*=(U s); + GLM_FUNC_DECL tmat4x2 & operator*=(U s); template - GLM_FUNC_DECL tmat4x2& operator/=(U s); + GLM_FUNC_DECL tmat4x2 & operator/=(U s); ////////////////////////////////////// // Increment and decrement operators diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index 977a9f51..dac9ff06 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -46,6 +46,15 @@ namespace glm # endif } + template + GLM_FUNC_QUALIFIER tmat4x2::tmat4x2(tmat4x2 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + this->value[3] = m.value[3]; + } + template template GLM_FUNC_QUALIFIER tmat4x2::tmat4x2(tmat4x2 const & m) @@ -271,6 +280,16 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators + template + GLM_FUNC_QUALIFIER tmat4x2& tmat4x2::operator=(tmat4x2 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } + template template GLM_FUNC_QUALIFIER tmat4x2& tmat4x2::operator=(tmat4x2 const & m) diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 54c8ee7f..8bde1ac0 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -57,6 +57,7 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat4x3(); + GLM_FUNC_DECL tmat4x3(tmat4x3 const & m); template GLM_FUNC_DECL tmat4x3(tmat4x3 const & m); @@ -134,6 +135,8 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tmat4x3 & operator=(tmat4x3 const & m); + template GLM_FUNC_DECL tmat4x3 & operator=(tmat4x3 const & m); template diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index b38682e7..d5c62c8a 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -46,6 +46,15 @@ namespace glm # endif } + template + GLM_FUNC_QUALIFIER tmat4x3::tmat4x3(tmat4x3 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + this->value[3] = m.value[3]; + } + template template GLM_FUNC_QUALIFIER tmat4x3::tmat4x3(tmat4x3 const & m) @@ -271,6 +280,16 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators + template + GLM_FUNC_QUALIFIER tmat4x3& tmat4x3::operator=(tmat4x3 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } + template template GLM_FUNC_QUALIFIER tmat4x3& tmat4x3::operator=(tmat4x3 const & m) diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index 61519090..dcb7269b 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -62,6 +62,7 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat4x4(); + GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); template GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); @@ -139,6 +140,8 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + GLM_FUNC_DECL tmat4x4 & operator=(tmat4x4 const & m); + template GLM_FUNC_DECL tmat4x4 & operator=(tmat4x4 const & m); template diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index 534706b9..103be5b6 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -106,6 +106,15 @@ namespace detail # endif } + template + GLM_FUNC_QUALIFIER tmat4x4::tmat4x4(tmat4x4 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + } + template template GLM_FUNC_QUALIFIER tmat4x4::tmat4x4(tmat4x4 const & m) @@ -357,6 +366,18 @@ namespace detail ////////////////////////////////////////////////////////////// // Operators + template + GLM_FUNC_QUALIFIER tmat4x4& tmat4x4::operator=(tmat4x4 const & m) + { + //memcpy could be faster + //memcpy(&this->value, &m.value, 16 * sizeof(valType)); + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } + template template GLM_FUNC_QUALIFIER tmat4x4& tmat4x4::operator=(tmat4x4 const & m) diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 15fe74e0..29cfa092 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -163,34 +163,34 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tvec2 & operator=(tvec2 const & v); + GLM_FUNC_DECL tvec2& operator=(tvec2 const & v); template - GLM_FUNC_DECL tvec2 & operator=(tvec2 const & v); + GLM_FUNC_DECL tvec2& operator=(tvec2 const & v); template - GLM_FUNC_DECL tvec2 & operator+=(U s); + GLM_FUNC_DECL tvec2& operator+=(U s); template - GLM_FUNC_DECL tvec2 & operator+=(tvec1 const & v); + GLM_FUNC_DECL tvec2& operator+=(tvec1 const & v); template - GLM_FUNC_DECL tvec2 & operator+=(tvec2 const & v); + GLM_FUNC_DECL tvec2& operator+=(tvec2 const & v); template - GLM_FUNC_DECL tvec2 & operator-=(U s); + GLM_FUNC_DECL tvec2& operator-=(U s); template - GLM_FUNC_DECL tvec2 & operator-=(tvec1 const & v); + GLM_FUNC_DECL tvec2& operator-=(tvec1 const & v); template - GLM_FUNC_DECL tvec2 & operator-=(tvec2 const & v); + GLM_FUNC_DECL tvec2& operator-=(tvec2 const & v); template - GLM_FUNC_DECL tvec2 & operator*=(U s); + GLM_FUNC_DECL tvec2& operator*=(U s); template - GLM_FUNC_DECL tvec2 & operator*=(tvec1 const & v); + GLM_FUNC_DECL tvec2& operator*=(tvec1 const & v); template - GLM_FUNC_DECL tvec2 & operator*=(tvec2 const & v); + GLM_FUNC_DECL tvec2& operator*=(tvec2 const & v); template - GLM_FUNC_DECL tvec2 & operator/=(U s); + GLM_FUNC_DECL tvec2& operator/=(U s); template - GLM_FUNC_DECL tvec2 & operator/=(tvec1 const & v); + GLM_FUNC_DECL tvec2& operator/=(tvec1 const & v); template - GLM_FUNC_DECL tvec2 & operator/=(tvec2 const & v); + GLM_FUNC_DECL tvec2& operator/=(tvec2 const & v); ////////////////////////////////////// // Increment and decrement operators @@ -204,29 +204,29 @@ namespace glm // Unary bit operators template - GLM_FUNC_DECL tvec2 & operator%= (U s); + GLM_FUNC_DECL tvec2 & operator%=(U s); template - GLM_FUNC_DECL tvec2 & operator%= (tvec1 const & v); + GLM_FUNC_DECL tvec2 & operator%=(tvec1 const & v); template - GLM_FUNC_DECL tvec2 & operator%= (tvec2 const & v); + GLM_FUNC_DECL tvec2 & operator%=(tvec2 const & v); template - GLM_FUNC_DECL tvec2 & operator&= (U s); + GLM_FUNC_DECL tvec2 & operator&=(U s); template - GLM_FUNC_DECL tvec2 & operator&= (tvec1 const & v); + GLM_FUNC_DECL tvec2 & operator&=(tvec1 const & v); template - GLM_FUNC_DECL tvec2 & operator&= (tvec2 const & v); + GLM_FUNC_DECL tvec2 & operator&=(tvec2 const & v); template - GLM_FUNC_DECL tvec2 & operator|= (U s); + GLM_FUNC_DECL tvec2 & operator|=(U s); template - GLM_FUNC_DECL tvec2 & operator|= (tvec1 const & v); + GLM_FUNC_DECL tvec2 & operator|=(tvec1 const & v); template - GLM_FUNC_DECL tvec2 & operator|= (tvec2 const & v); + GLM_FUNC_DECL tvec2 & operator|=(tvec2 const & v); template - GLM_FUNC_DECL tvec2 & operator^= (U s); + GLM_FUNC_DECL tvec2 & operator^=(U s); template - GLM_FUNC_DECL tvec2 & operator^= (tvec1 const & v); + GLM_FUNC_DECL tvec2 & operator^=(tvec1 const & v); template - GLM_FUNC_DECL tvec2 & operator^= (tvec2 const & v); + GLM_FUNC_DECL tvec2 & operator^=(tvec2 const & v); template GLM_FUNC_DECL tvec2 & operator<<=(U s); template diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 408d2de4..8189d6f0 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -167,7 +167,7 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec4(); - //GLM_FUNC_DECL tvec4(tvec4 const & v); + GLM_FUNC_DECL tvec4(tvec4 const & v); template GLM_FUNC_DECL tvec4(tvec4 const & v); @@ -285,7 +285,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators - //GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); + GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); template GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index e1db10af..fbdf51fc 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -42,6 +42,11 @@ namespace glm # endif {} + template + GLM_FUNC_QUALIFIER tvec4::tvec4(tvec4 const & v) + : x(v.x), y(v.y), z(v.z), w(v.w) + {} + template template GLM_FUNC_QUALIFIER tvec4::tvec4(tvec4 const & v) @@ -245,6 +250,16 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator=(tvec4 const & v) + { + this->x = v.x; + this->y = v.y; + this->z = v.z; + this->w = v.w; + return *this; + } + template template GLM_FUNC_QUALIFIER tvec4 & tvec4::operator=(tvec4 const & v) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index f98e705f..0735abf8 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -91,6 +91,7 @@ namespace glm // Implicit basic constructors GLM_FUNC_DECL tquat(); + GLM_FUNC_DECL tquat(tquat const & q); template GLM_FUNC_DECL tquat(tquat const & q); @@ -133,10 +134,19 @@ namespace glm ////////////////////////////////////// // Operators - GLM_FUNC_DECL tquat & operator+=(tquat const & q); - GLM_FUNC_DECL tquat & operator*=(tquat const & q); - GLM_FUNC_DECL tquat & operator*=(T const & s); - GLM_FUNC_DECL tquat & operator/=(T const & s); + + GLM_FUNC_DECL tquat & operator=(tquat const & m); + + template + GLM_FUNC_DECL tquat & operator=(tquat const & m); + template + GLM_FUNC_DECL tquat & operator+=(tquat const & q); + template + GLM_FUNC_DECL tquat & operator*=(tquat const & q); + template + GLM_FUNC_DECL tquat & operator*=(U s); + template + GLM_FUNC_DECL tquat & operator/=(U s); }; template diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 46c03296..33ca82cc 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -104,6 +104,11 @@ namespace detail # endif {} + template + GLM_FUNC_QUALIFIER tquat::tquat(tquat const & q) + : x(q.x), y(q.y), z(q.z), w(q.w) + {} + template template GLM_FUNC_QUALIFIER tquat::tquat(tquat const & q) @@ -176,7 +181,7 @@ namespace detail this->w = c.x * c.y * c.z + s.x * s.y * s.z; this->x = s.x * c.y * c.z - c.x * s.y * s.z; this->y = c.x * s.y * c.z + s.x * c.y * s.z; - this->z = c.x * c.y * s.z - s.x * s.y * c.z; + this->z = c.x * c.y * s.z - s.x * s.y * c.z; } template @@ -221,19 +226,43 @@ namespace detail // tquat operators template - GLM_FUNC_QUALIFIER tquat & tquat::operator+=(tquat const & q) + GLM_FUNC_QUALIFIER tquat & tquat::operator=(tquat const & q) { - this->w += q.w; - this->x += q.x; - this->y += q.y; - this->z += q.z; + this->w = q.w; + this->x = q.x; + this->y = q.y; + this->z = q.z; return *this; } template - GLM_FUNC_QUALIFIER tquat & tquat::operator*=(tquat const & q) + template + GLM_FUNC_QUALIFIER tquat & tquat::operator=(tquat const & q) + { + this->w = static_cast(q.w); + this->x = static_cast(q.x); + this->y = static_cast(q.y); + this->z = static_cast(q.z); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tquat & tquat::operator+=(tquat const & q) + { + this->w += static_cast(q.w); + this->x += static_cast(q.x); + this->y += static_cast(q.y); + this->z += static_cast(q.z); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tquat & tquat::operator*=(tquat const & r) { tquat const p(*this); + tquat const q(r); this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z; this->x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y; @@ -242,23 +271,25 @@ namespace detail return *this; } - template - GLM_FUNC_QUALIFIER tquat & tquat::operator*=(T const & s) + template + template + GLM_FUNC_QUALIFIER tquat & tquat::operator*=(U s) { - this->w *= s; - this->x *= s; - this->y *= s; - this->z *= s; + this->w *= static_cast(s); + this->x *= static_cast(s); + this->y *= static_cast(s); + this->z *= static_cast(s); return *this; } - template - GLM_FUNC_QUALIFIER tquat & tquat::operator/=(T const & s) + template + template + GLM_FUNC_QUALIFIER tquat & tquat::operator/=(U s) { - this->w /= s; - this->x /= s; - this->y /= s; - this->z /= s; + this->w /= static_cast(s); + this->x /= static_cast(s); + this->y /= static_cast(s); + this->z /= static_cast(s); return *this; } diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 66771f99..3cb14746 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -90,6 +90,7 @@ namespace glm // Implicit basic constructors GLM_FUNC_DECL tdualquat(); + GLM_FUNC_DECL tdualquat(tdualquat const & d); template GLM_FUNC_DECL tdualquat(tdualquat const & d); @@ -116,8 +117,14 @@ namespace glm GLM_FUNC_DECL explicit tdualquat(tmat3x4 const & aug_mat); // Operators - GLM_FUNC_DECL tdualquat & operator*=(T const & s); - GLM_FUNC_DECL tdualquat & operator/=(T const & s); + GLM_FUNC_DECL tdualquat & operator=(tdualquat const & m); + + template + GLM_FUNC_DECL tdualquat & operator=(tdualquat const & m); + template + GLM_FUNC_DECL tdualquat & operator*=(U s); + template + GLM_FUNC_DECL tdualquat & operator/=(U s); }; template diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 6fed846f..8fed0855 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -91,6 +91,12 @@ namespace glm # endif {} + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat(tdualquat const & d) + : real(d.real) + , dual(d.dual) + {} + template template GLM_FUNC_QUALIFIER tdualquat::tdualquat(tdualquat const & d) @@ -150,18 +156,37 @@ namespace glm // tdualquat operators template - GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator*=(T const & s) + GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator=(tdualquat const & q) { - this->real *= s; - this->dual *= s; + this->real = q.real; + this->dual = q.dual; return *this; } template - GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator/=(T const & s) + template + GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator=(tdualquat const & q) { - this->real /= s; - this->dual /= s; + this->real = q.real; + this->dual = q.dual; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator*=(U s) + { + this->real *= static_cast(s); + this->dual *= static_cast(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator/=(U s) + { + this->real /= static_cast(s); + this->dual /= static_cast(s); return *this; } From 9a8cffd83ac7245baaa83722d627aab8077c9b9e Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 15 Feb 2015 15:33:14 +0100 Subject: [PATCH 3/7] Fixed Android doesn't have C++ 11 STL #284 --- glm/detail/setup.hpp | 2 +- readme.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 730cb7a7..e624d2bb 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -500,7 +500,7 @@ // http://gcc.gnu.org/projects/cxx0x.html // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx -#if GLM_PLATFORM != GLM_PLATFORM_ANDROID +#if GLM_PLATFORM == GLM_PLATFORM_ANDROID # define GLM_HAS_CXX11_STL 0 #elif GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG) # define GLM_HAS_CXX11_STL __has_include(<__config>) diff --git a/readme.txt b/readme.txt index cb5d6273..0f758711 100644 --- a/readme.txt +++ b/readme.txt @@ -63,6 +63,12 @@ GLM is a header only library, there is nothing to build, just include it. More informations in GLM manual: http://glm.g-truc.net/glm.pdf +================================================================================ +GLM 0.9.6.3: 2015-0X-XX +-------------------------------------------------------------------------------- +Fixes: +- Fixed Android doesn't have C++ 11 STL #284 + ================================================================================ GLM 0.9.6.2: 2015-02-15 -------------------------------------------------------------------------------- From 09241ec000060fd3d085a11d608eb7909e004c75 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 15 Feb 2015 16:12:54 +0100 Subject: [PATCH 4/7] Updated readme 0.9.6.3 --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 0f758711..aa67dca4 100644 --- a/readme.txt +++ b/readme.txt @@ -64,7 +64,7 @@ More informations in GLM manual: http://glm.g-truc.net/glm.pdf ================================================================================ -GLM 0.9.6.3: 2015-0X-XX +GLM 0.9.6.3: 2015-02-15 -------------------------------------------------------------------------------- Fixes: - Fixed Android doesn't have C++ 11 STL #284 From 567157fc8c31ae0a068dad291046b4e7692dc285 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 15 Feb 2015 16:23:13 +0100 Subject: [PATCH 5/7] Updated version --- glm/detail/setup.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index e624d2bb..969569f2 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -42,11 +42,11 @@ #define GLM_VERSION_MAJOR 0 #define GLM_VERSION_MINOR 9 #define GLM_VERSION_PATCH 6 -#define GLM_VERSION_REVISION 2 +#define GLM_VERSION_REVISION 3 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_VERSION_DISPLAYED)) # define GLM_MESSAGE_VERSION_DISPLAYED -# pragma message ("GLM: version 0.9.6.2") +# pragma message ("GLM: version 0.9.6.3") #endif//GLM_MESSAGE /////////////////////////////////////////////////////////////////////////////////// From 7b9c7008eb6b05f8efa3a0561e6226664a251cb6 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 15 Feb 2015 16:30:39 +0100 Subject: [PATCH 6/7] Updated version --- glm/detail/setup.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 969569f2..688db446 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -42,11 +42,11 @@ #define GLM_VERSION_MAJOR 0 #define GLM_VERSION_MINOR 9 #define GLM_VERSION_PATCH 6 -#define GLM_VERSION_REVISION 3 +#define GLM_VERSION_REVISION 4 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_VERSION_DISPLAYED)) # define GLM_MESSAGE_VERSION_DISPLAYED -# pragma message ("GLM: version 0.9.6.3") +# pragma message ("GLM: version 0.9.6.4") #endif//GLM_MESSAGE /////////////////////////////////////////////////////////////////////////////////// From ba68939dece885cfc0b70125fc88a86d322b3ab5 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 15 Feb 2015 16:32:26 +0100 Subject: [PATCH 7/7] Updated readme for 0.9.6.4 --- readme.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/readme.txt b/readme.txt index aa67dca4..ff293a4f 100644 --- a/readme.txt +++ b/readme.txt @@ -63,6 +63,12 @@ GLM is a header only library, there is nothing to build, just include it. More informations in GLM manual: http://glm.g-truc.net/glm.pdf +================================================================================ +GLM 0.9.6.4: 2015-0X-XX +-------------------------------------------------------------------------------- +Fixes: + + ================================================================================ GLM 0.9.6.3: 2015-02-15 --------------------------------------------------------------------------------