diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 78faf314..9df68720 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -161,7 +161,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat2x2 const operator-(tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m); + + template + GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index b7f09d7d..3f215e3f 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -374,7 +374,13 @@ namespace detail // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x2 const operator-(tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator+(tmat2x2 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat2x2 operator-(tmat2x2 const & m) { return tmat2x2( -m[0], diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 0477c0f9..493548f4 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -154,7 +154,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat2x3 const operator-(tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 operator+(tmat2x3 const & m); + + template + GLM_FUNC_DECL tmat2x3 operator-(tmat2x3 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 23018c19..e7cabb72 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -344,7 +344,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x3 const operator-(tmat2x3 const & m) + GLM_FUNC_QUALIFIER tmat2x3 operator+(tmat2x3 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat2x3 operator-(tmat2x3 const & m) { return tmat2x3( -m[0], diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 36840f12..e15714ca 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -156,7 +156,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat2x4 const operator-(tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 operator+(tmat2x4 const & m); + + template + GLM_FUNC_DECL tmat2x4 operator-(tmat2x4 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index ebb9170c..4399e0be 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -345,7 +345,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x4 const operator-(tmat2x4 const & m) + GLM_FUNC_QUALIFIER tmat2x4 operator+(tmat2x4 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat2x4 operator-(tmat2x4 const & m) { return tmat2x4( -m[0], diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 06549837..63e0a659 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -161,7 +161,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat3x2 const operator-(tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 operator+(tmat3x2 const & m); + + template + GLM_FUNC_DECL tmat3x2 operator-(tmat3x2 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index 7e3ff4be..24079cfe 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -383,8 +383,14 @@ namespace glm // -- Unary arithmetic operators -- + template + GLM_FUNC_QUALIFIER tmat3x2 operator+(tmat3x2 const & m) + { + return m; + } + template - GLM_FUNC_QUALIFIER tmat3x2 const operator-(tmat3x2 const & m) + GLM_FUNC_QUALIFIER tmat3x2 operator-(tmat3x2 const & m) { return tmat3x2( -m[0], diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 4ef3708d..799d645d 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -169,7 +169,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat3x3 const operator-(tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator+(tmat3x3 const & m); + + template + GLM_FUNC_DECL tmat3x3 operator-(tmat3x3 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index ec6f3eb6..c3b07108 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -423,7 +423,13 @@ namespace detail // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat3x3 const operator-(tmat3x3 const & m) + GLM_FUNC_QUALIFIER tmat3x3 operator+(tmat3x3 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat3x3 operator-(tmat3x3 const & m) { return tmat3x3( -m[0], diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index f9c7b908..7453673b 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -161,7 +161,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat3x4 const operator-(tmat3x4 const & m); + GLM_FUNC_DECL tmat3x4 operator+(tmat3x4 const & m); + + template + GLM_FUNC_DECL tmat3x4 operator-(tmat3x4 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 16ff84d3..dd1f0563 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -384,7 +384,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat3x4 const operator-(tmat3x4 const & m) + GLM_FUNC_QUALIFIER tmat3x4 operator+(tmat3x4 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat3x4 operator-(tmat3x4 const & m) { return tmat3x4( -m[0], diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index b3c27261..8cb7d70e 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -166,7 +166,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat4x2 const operator-(tmat4x2 const & m); + GLM_FUNC_DECL tmat4x2 operator+(tmat4x2 const & m); + + template + GLM_FUNC_DECL tmat4x2 operator-(tmat4x2 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index 187b4579..2040d4a6 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -416,7 +416,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat4x2 const operator-(tmat4x2 const & m) + GLM_FUNC_QUALIFIER tmat4x2 operator+(tmat4x2 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat4x2 operator-(tmat4x2 const & m) { return tmat4x2( -m[0], diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 7a870a86..0a5de95b 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -166,7 +166,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat4x3 const operator-(tmat4x3 const & m); + GLM_FUNC_DECL tmat4x3 operator+(tmat4x3 const & m); + + template + GLM_FUNC_DECL tmat4x3 operator-(tmat4x3 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index da76cdcc..58eeb6f9 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -416,7 +416,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat4x3 const operator-(tmat4x3 const & m) + GLM_FUNC_QUALIFIER tmat4x3 operator+(tmat4x3 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat4x3 operator-(tmat4x3 const & m) { return tmat4x3( -m[0], diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index fa585e5b..a90a5978 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -174,7 +174,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat4x4 const operator-(tmat4x4 const & m); + GLM_FUNC_DECL tmat4x4 operator+(tmat4x4 const & m); + + template + GLM_FUNC_DECL tmat4x4 operator-(tmat4x4 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index 1d463836..acfa318c 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -522,7 +522,13 @@ namespace detail // -- Unary constant operators -- template - GLM_FUNC_QUALIFIER tmat4x4 const operator-(tmat4x4 const & m) + GLM_FUNC_QUALIFIER tmat4x4 operator+(tmat4x4 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat4x4 operator-(tmat4x4 const & m) { return tmat4x4( -m[0], diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 5f4c0012..833468d8 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -208,6 +208,9 @@ namespace glm // -- Unary operators -- + template + GLM_FUNC_DECL tvec1 operator+(tvec1 const & v); + template GLM_FUNC_DECL tvec1 operator-(tvec1 const & v); diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index dde1e0de..9d397d64 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -359,6 +359,12 @@ namespace glm // -- Unary constant operators -- + template + GLM_FUNC_QUALIFIER tvec1 operator+(tvec1 const & v) + { + return v; + } + template GLM_FUNC_QUALIFIER tvec1 operator-(tvec1 const & v) { diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 73b9b82d..1d857ac7 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -237,6 +237,9 @@ namespace glm // -- Unary operators -- + template + GLM_FUNC_DECL tvec2 operator+(tvec2 const & v); + template GLM_FUNC_DECL tvec2 operator-(tvec2 const & v); diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index 6a8153e6..dfb3a33a 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -493,6 +493,12 @@ namespace glm // -- Unary arithmetic operators -- + template + GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v) + { + return v; + } + template GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v) { diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 594a7980..d4d8ff6a 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -263,6 +263,9 @@ namespace glm // -- Unary operators -- + template + GLM_FUNC_DECL tvec3 operator+(tvec3 const & v); + template GLM_FUNC_DECL tvec3 operator-(tvec3 const & v); diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 629214c4..38104a3a 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -573,6 +573,12 @@ namespace glm // -- Unary arithmetic operators -- + template + GLM_FUNC_QUALIFIER tvec3 operator+(tvec3 const & v) + { + return v; + } + template GLM_FUNC_QUALIFIER tvec3 operator-(tvec3 const & v) { diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 2c95cc76..f26350c6 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -370,6 +370,9 @@ namespace detail // -- Unary operators -- + template + 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 eaaa4fc3..a650e494 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -711,6 +711,12 @@ namespace glm // -- Unary constant operators -- + template + GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v) + { + return v; + } + template GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v) { diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index f5711c64..daf9cc19 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -169,6 +169,9 @@ namespace glm // -- Unary bit operators -- + template + GLM_FUNC_DECL tquat operator+(tquat const & q); + template GLM_FUNC_DECL tquat operator-(tquat const & q); diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 4ee7f802..e5fe5505 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -363,6 +363,12 @@ namespace detail // -- Unary bit operators -- + template + GLM_FUNC_QUALIFIER tquat operator+(tquat const & q) + { + return q; + } + template GLM_FUNC_QUALIFIER tquat operator-(tquat const & q) { diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 02786f47..c62fcda4 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -130,7 +130,10 @@ namespace glm // -- Unary bit operators -- template - GLM_FUNC_DECL tquat operator-(tquat const & q); + GLM_FUNC_DECL tdualquat operator+(tdualquat const & q); + + template + GLM_FUNC_DECL tdualquat operator-(tdualquat const & q); // -- Binary operators -- diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index c6b057f2..961dd1ca 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -196,7 +196,7 @@ namespace glm template GLM_FUNC_QUALIFIER tdualquat operator-(tdualquat const & q) { - return tdualquat(-q.real,-q.dual); + return q; } // -- Binary operators -- diff --git a/readme.md b/readme.md index 6d769eda..f4d601fb 100644 --- a/readme.md +++ b/readme.md @@ -64,6 +64,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ##### Improvements: - Improved GTC_random linearRand documentation - Improved GTC_reciprocal documentation +- Added unary + operator #435 ##### Fixes: - Fixed GTX_extended_min_max filename typo #386