From b968defd220c887640479bb1a90d725606fbdf58 Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Sun, 13 Mar 2016 21:32:06 +0200 Subject: [PATCH 01/10] Add missing const to declaration --- glm/detail/type_mat4x4.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index 4766f1d6..a0008c50 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -210,7 +210,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); From 8e7a3a905381538ea77631721d47502a5ddb771c Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Sun, 13 Mar 2016 21:32:33 +0200 Subject: [PATCH 02/10] Add missing operator function definitions --- glm/detail/type_vec4.inl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 3a929a01..78622734 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -801,6 +801,16 @@ namespace glm v.w / scalar); } + template + GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v, tvec1 const & scalar) + { + 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 & scalar, tvec4 const & v) + { + 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) { From 798e4f0e78c56c6d45c0e26ed23345e9e4fb6d93 Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Sun, 13 Mar 2016 21:32:41 +0200 Subject: [PATCH 03/10] Remove (old?) operator/ member functions These don't seem to have matching definitions and they conflict with similar functions in the glm namespace (in the same header files). --- glm/detail/type_mat2x2.hpp | 5 ----- glm/detail/type_mat3x3.hpp | 5 ----- glm/detail/type_mat4x4.hpp | 5 ----- 3 files changed, 15 deletions(-) diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 0388e759..130bc7e6 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]; diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 806ae811..3b90536b 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]; diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index a0008c50..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]; From 1e192be3701e22b35b8fe24f6de28bebef98bdf6 Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Tue, 15 Mar 2016 02:20:15 +0200 Subject: [PATCH 04/10] Remove const & from POD to match other functions in class --- glm/detail/type_vec4.hpp | 8 ++++---- glm/detail/type_vec4.inl | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 4668ff81..067b3ed7 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,7 +391,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 & v, tvec1 const & scalar); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 78622734..3ef51fdf 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -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, From 236fed9d93ac4f1363db3706823e52f47c60f12a Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Tue, 15 Mar 2016 02:21:42 +0200 Subject: [PATCH 05/10] Add const & to POD to match other functions in the class --- glm/detail/type_mat2x4.hpp | 4 ++-- glm/detail/type_mat2x4.inl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 7e0cc87d..45dfe142 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -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 const & s); template - GLM_FUNC_DECL tmat2x4 operator/(T s, tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 operator/(T const & s, tmat2x4 const & m); // -- Boolean operators -- diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index cac649f6..8d6f824e 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -493,7 +493,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, const T& s) + GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, T const & s) { return tmat2x4( m[0] / s, @@ -501,7 +501,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x4 operator/(T s, tmat2x4 const & m) + GLM_FUNC_QUALIFIER tmat2x4 operator/(T const & s, tmat2x4 const & m) { return tmat2x4( s / m[0], From 21fb034338adbfbbbcc97dd6be9970384d837837 Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Tue, 15 Mar 2016 02:22:48 +0200 Subject: [PATCH 06/10] Add missing boolean operator declarations --- glm/gtc/quaternion.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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 From 131b85f4b977048e31c290a1e55ff0486056116a Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Tue, 15 Mar 2016 02:36:33 +0200 Subject: [PATCH 07/10] Fix declarations (use tdualquat instead of tquat) --- glm/gtx/dual_quaternion.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 9bef77dd..6845bbcf 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); From 55d7b07e123f5282438bf64d96b67c121b302a64 Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Tue, 15 Mar 2016 02:37:38 +0200 Subject: [PATCH 08/10] Add missing boolean operator declarations --- glm/gtx/dual_quaternion.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 6845bbcf..cddf1fe6 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -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 From 2d54f437f1a88c33f12b8d321e369ddc8ae13749 Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Tue, 15 Mar 2016 02:38:16 +0200 Subject: [PATCH 09/10] Fix operator-(), add operator+() --- glm/gtx/dual_quaternion.inl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 961dd1ca..fd41dcdc 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -194,11 +194,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 From 99d3486e1fb044a524702d424b9c3f383b13b884 Mon Sep 17 00:00:00 2001 From: Sami Kankaristo Date: Tue, 15 Mar 2016 03:24:53 +0200 Subject: [PATCH 10/10] Rename tvec1 parameters from scalar to v1/v2 --- glm/detail/type_vec4.hpp | 4 ++-- glm/detail/type_vec4.inl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 067b3ed7..624bcf8f 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -394,13 +394,13 @@ namespace detail 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 3ef51fdf..29b78bf5 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -802,7 +802,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v, tvec1 const & scalar) + GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v1, tvec1 const & v2) { return tvec4( v1.x / v2.x, @@ -822,7 +822,7 @@ namespace glm } template - GLM_FUNC_DECL tvec4 operator/(tvec1 const & scalar, tvec4 const & v) + GLM_FUNC_DECL tvec4 operator/(tvec1 const & v1, tvec4 const & v2) { return tvec4( v1.x / v2.x,