From efce35f901c6698c194604665bf0ba47b4910ca8 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 19 Jan 2011 11:56:48 +0000 Subject: [PATCH] Updated equal and not equal operators for vectors --- glm/core/type_vec1.inl | 23 +++++++++++++++++++++++ glm/core/type_vec2.inl | 23 +++++++++++++++++++++++ glm/core/type_vec3.inl | 23 +++++++++++++++++++++++ glm/core/type_vec4.inl | 36 ++++++++++++++++++++++++++++++++++++ glm/gtx/comparison.hpp | 7 ++++--- glm/gtx/comparison.inl | 4 ++-- 6 files changed, 111 insertions(+), 5 deletions(-) diff --git a/glm/core/type_vec1.inl b/glm/core/type_vec1.inl index 47c586a2..a64b93f3 100644 --- a/glm/core/type_vec1.inl +++ b/glm/core/type_vec1.inl @@ -234,6 +234,29 @@ namespace glm return *this; } + ////////////////////////////////////// + // Boolean operators + + template + inline bool operator== + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return (v1.x == v2.x); + } + + template + inline bool operator!= + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return (v1.x != v2.x); + } + ////////////////////////////////////// // Unary bit operators diff --git a/glm/core/type_vec2.inl b/glm/core/type_vec2.inl index 4620b687..ac40c966 100644 --- a/glm/core/type_vec2.inl +++ b/glm/core/type_vec2.inl @@ -296,6 +296,29 @@ namespace glm return *this; } + ////////////////////////////////////// + // Boolean operators + + template + inline bool operator== + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return (v1.x == v2.x) && (v1.y == v2.y); + } + + template + inline bool operator!= + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return (v1.x != v2.x) || (v1.y != v2.y); + } + ////////////////////////////////////// // Unary bit operators diff --git a/glm/core/type_vec3.inl b/glm/core/type_vec3.inl index d2b1ae29..bd849208 100644 --- a/glm/core/type_vec3.inl +++ b/glm/core/type_vec3.inl @@ -333,6 +333,29 @@ namespace glm return *this; } + ////////////////////////////////////// + // Boolean operators + + template + inline bool operator== + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z); + } + + template + inline bool operator!= + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z); + } + ////////////////////////////////////// // Unary bit operators diff --git a/glm/core/type_vec4.inl b/glm/core/type_vec4.inl index cb2ff4cc..28e5f356 100644 --- a/glm/core/type_vec4.inl +++ b/glm/core/type_vec4.inl @@ -861,6 +861,29 @@ namespace glm v.w - One); } + ////////////////////////////////////// + // Boolean operators + + template + inline bool operator== + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z) && (v1.w == v2.w); + } + + template + inline bool operator!= + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z) || (v1.w != v2.w); + } + ////////////////////////////////////// // Binary bit operators @@ -1129,6 +1152,19 @@ namespace glm ~v.w); } + template + inline tvec4 operator~ + ( + tvec4 const & v + ) + { + return tvec4( + ~v.x, + ~v.y, + ~v.z, + ~v.w); + } + ////////////////////////////////////// // tref definition diff --git a/glm/gtx/comparison.hpp b/glm/gtx/comparison.hpp index a035e936..6928e7b5 100644 --- a/glm/gtx/comparison.hpp +++ b/glm/gtx/comparison.hpp @@ -24,8 +24,9 @@ namespace glm namespace gtx{ //! GLM_GTX_comparison extension: Defined comparison operators for vectors. - namespace comparison{ - + namespace comparison + { +/* //! Define == operator for vectors //! From GLM_GTX_comparison extension. template @@ -67,7 +68,7 @@ namespace glm bool operator!= ( detail::tvec4 const & x, detail::tvec4 const & y); - +*/ }//namespace comparison }//namespace gtx }//namespace glm diff --git a/glm/gtx/comparison.inl b/glm/gtx/comparison.inl index 6db48eb2..4b847246 100644 --- a/glm/gtx/comparison.inl +++ b/glm/gtx/comparison.inl @@ -10,7 +10,7 @@ namespace glm{ namespace gtx{ namespace comparison{ - +/* template inline bool operator== ( @@ -70,7 +70,7 @@ inline bool operator!= { return glm::any(glm::notEqual(x, y)); } - +*/ }//namespace comparison }//namespace gtx }//namespace glm