From a0743f94aa6a50300a42930bb22377f37f7d722f Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 29 Jul 2014 02:42:18 +0200 Subject: [PATCH] Added full tvec1 support to tvec2 --- glm/detail/type_vec2.hpp | 116 +++++++-- glm/detail/type_vec2.inl | 530 +++++++++++++++++++++++---------------- 2 files changed, 403 insertions(+), 243 deletions(-) diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 95365538..5803bf1d 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -106,13 +106,9 @@ namespace detail ////////////////////////////////////// // Explicit basic constructors - GLM_FUNC_DECL explicit tvec2( - ctor); - GLM_FUNC_DECL explicit tvec2( - T const & s); - GLM_FUNC_DECL tvec2( - T const & s1, - T const & s2); + GLM_FUNC_DECL explicit tvec2(ctor); + GLM_FUNC_DECL explicit tvec2(T const & s); + GLM_FUNC_DECL tvec2(T const & s1, T const & s2); ////////////////////////////////////// // Swizzle constructors @@ -130,9 +126,9 @@ namespace detail //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL tvec2( - U const & x, - V const & y); + GLM_FUNC_DECL tvec2(U const & x, V const & y); + template + GLM_FUNC_DECL tvec2(tvec1 const & v1, tvec1 const & v2); ////////////////////////////////////// // Conversion vector constructors @@ -152,23 +148,31 @@ namespace detail GLM_FUNC_DECL tvec2 & operator= (tvec2 const & v); - template + template GLM_FUNC_DECL tvec2 & operator= (tvec2 const & v); - template + template GLM_FUNC_DECL tvec2 & operator+=(U s); - template + template + GLM_FUNC_DECL tvec2 & operator+=(tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator+=(tvec2 const & v); - template + template GLM_FUNC_DECL tvec2 & operator-=(U s); - template + template + GLM_FUNC_DECL tvec2 & operator-=(tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator-=(tvec2 const & v); - template + template GLM_FUNC_DECL tvec2 & operator*=(U s); - template + template + GLM_FUNC_DECL tvec2 & operator*=(tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator*=(tvec2 const & v); - template + template GLM_FUNC_DECL tvec2 & operator/=(U s); - template + template + GLM_FUNC_DECL tvec2 & operator/=(tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator/=(tvec2 const & v); ////////////////////////////////////// @@ -185,62 +189,98 @@ namespace detail template GLM_FUNC_DECL tvec2 & operator%= (U s); template + GLM_FUNC_DECL tvec2 & operator%= (tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator%= (tvec2 const & v); template GLM_FUNC_DECL tvec2 & operator&= (U s); template + GLM_FUNC_DECL tvec2 & operator&= (tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator&= (tvec2 const & v); template GLM_FUNC_DECL tvec2 & operator|= (U s); template + GLM_FUNC_DECL tvec2 & operator|= (tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator|= (tvec2 const & v); template GLM_FUNC_DECL tvec2 & operator^= (U s); template + GLM_FUNC_DECL tvec2 & operator^= (tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator^= (tvec2 const & v); template GLM_FUNC_DECL tvec2 & operator<<=(U s); template + GLM_FUNC_DECL tvec2 & operator<<=(tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator<<=(tvec2 const & v); template GLM_FUNC_DECL tvec2 & operator>>=(U s); template + GLM_FUNC_DECL tvec2 & operator>>=(tvec1 const & v); + template GLM_FUNC_DECL tvec2 & operator>>=(tvec2 const & v); }; template GLM_FUNC_DECL tvec2 operator+(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator+(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator+(T const & s, tvec2 const & v); + template + GLM_FUNC_DECL tvec2 operator+(tvec1 const & v1, tvec2 const & v2); + template GLM_FUNC_DECL tvec2 operator+(tvec2 const & v1, tvec2 const & v2); template GLM_FUNC_DECL tvec2 operator-(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator-(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator-(T const & s, tvec2 const & v); template - GLM_FUNC_DECL tvec2 operator- (tvec2 const & v1, tvec2 const & v2); + GLM_FUNC_DECL tvec2 operator-(tvec1 const & v1, tvec2 const & v2); + + template + GLM_FUNC_DECL tvec2 operator-(tvec2 const & v1, tvec2 const & v2); template GLM_FUNC_DECL tvec2 operator*(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator*(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator*(T const & s, tvec2 const & v); + template + GLM_FUNC_DECL tvec2 operator*(tvec1 const & v1, tvec2 const & v2); + template GLM_FUNC_DECL tvec2 operator*(tvec2 const & v1, tvec2 const & v2); template GLM_FUNC_DECL tvec2 operator/(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator/(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator/(T const & s, tvec2 const & v); + template + GLM_FUNC_DECL tvec2 operator/(tvec1 const & v1, tvec2 const & v2); + template GLM_FUNC_DECL tvec2 operator/(tvec2 const & v1, tvec2 const & v2); @@ -250,54 +290,90 @@ namespace detail template GLM_FUNC_DECL tvec2 operator%(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator%(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator%(T const & s, tvec2 const & v); + template + GLM_FUNC_DECL tvec2 operator%(tvec1 const & v1, tvec2 const & v2); + template GLM_FUNC_DECL tvec2 operator%(tvec2 const & v1, tvec2 const & v2); template GLM_FUNC_DECL tvec2 operator&(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator&(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator&(T const & s, tvec2 const & v); + template + GLM_FUNC_DECL tvec2 operator&(tvec1 const & v1, tvec2 const & v2); + template GLM_FUNC_DECL tvec2 operator&(tvec2 const & v1, tvec2 const & v2); template GLM_FUNC_DECL tvec2 operator|(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator|(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator|(T const & s, tvec2 const & v); + template + GLM_FUNC_DECL tvec2 operator|(tvec1 const & v1, tvec2 const & v2); + template GLM_FUNC_DECL tvec2 operator|(tvec2 const & v1, tvec2 const & v2); template GLM_FUNC_DECL tvec2 operator^(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator^(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator^(T const & s, tvec2 const & v); + template + GLM_FUNC_DECL tvec2 operator^(tvec1 const & v1, tvec2 const & v2); + template GLM_FUNC_DECL tvec2 operator^(tvec2 const & v1, tvec2 const & v2); template GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator<<(T const & s, tvec2 const & v); + template + GLM_FUNC_DECL tvec2 operator<<(tvec1 const & v1, tvec2 const & v2); + template GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v1, tvec2 const & v2); template GLM_FUNC_DECL tvec2 operator>>(tvec2 const & v, T const & s); + template + GLM_FUNC_DECL tvec2 operator>>(tvec2 const & v1, tvec1 const & v2); + template GLM_FUNC_DECL tvec2 operator>>(T const & s, tvec2 const & v); + template + GLM_FUNC_DECL tvec2 operator>>(tvec1 const & v1, tvec2 const & v2); + template GLM_FUNC_DECL tvec2 operator>>(tvec2 const & v1, tvec2 const & v2); diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index 0935e59f..1f878b59 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -88,11 +88,7 @@ namespace detail {} template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - T const & s1, - T const & s2 - ) : + GLM_FUNC_QUALIFIER tvec2::tvec2(T const & s1, T const & s2) : x(s1), y(s2) {} @@ -102,44 +98,38 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - U const & a, - V const & b - ) : + GLM_FUNC_QUALIFIER tvec2::tvec2(U const & a, V const & b) : x(static_cast(a)), y(static_cast(b)) {} + template + template + GLM_FUNC_QUALIFIER tvec2::tvec2(tvec1 const & v1, tvec1 const & v2) : + x(v1.x), + y(v2.x) + {} + ////////////////////////////////////// // Conversion vector constructors template template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec2 const & v - ) : + GLM_FUNC_QUALIFIER tvec2::tvec2(tvec2 const & v) : x(static_cast(v.x)), y(static_cast(v.y)) {} template template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec3 const & v - ) : + GLM_FUNC_QUALIFIER tvec2::tvec2(tvec3 const & v) : x(static_cast(v.x)), y(static_cast(v.y)) {} template template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec4 const & v - ) : + GLM_FUNC_QUALIFIER tvec2::tvec2(tvec4 const & v) : x(static_cast(v.x)), y(static_cast(v.y)) {} @@ -148,10 +138,7 @@ namespace detail // Unary arithmetic operators template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator= - ( - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) { this->x = v.x; this->y = v.y; @@ -160,10 +147,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator= - ( - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) { this->x = static_cast(v.x); this->y = static_cast(v.y); @@ -172,10 +156,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+= - ( - U s - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+=(U s) { this->x += static_cast(s); this->y += static_cast(s); @@ -184,10 +165,16 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+= - ( - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+=(tvec1 const & v) + { + this->x += static_cast(v.x); + this->y += static_cast(v.x); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+=(tvec2 const & v) { this->x += static_cast(v.x); this->y += static_cast(v.y); @@ -196,10 +183,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-= - ( - U s - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-=(U s) { this->x -= static_cast(s); this->y -= static_cast(s); @@ -208,10 +192,16 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-= - ( - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-=(tvec1 const & v) + { + this->x -= static_cast(v.x); + this->y -= static_cast(v.x); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-=(tvec2 const & v) { this->x -= static_cast(v.x); this->y -= static_cast(v.y); @@ -220,10 +210,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*= - ( - U s - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*=(U s) { this->x *= static_cast(s); this->y *= static_cast(s); @@ -232,10 +219,16 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*= - ( - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*=(tvec1 const & v) + { + this->x *= static_cast(v.x); + this->y *= static_cast(v.x); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*=(tvec2 const & v) { this->x *= static_cast(v.x); this->y *= static_cast(v.y); @@ -244,10 +237,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/= - ( - U s - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/=(U s) { this->x /= static_cast(s); this->y /= static_cast(s); @@ -256,10 +246,16 @@ namespace detail template template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/= - ( - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/=(tvec1 const & v) + { + this->x /= static_cast(v.x); + this->y /= static_cast(v.x); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/=(tvec2 const & v) { this->x /= static_cast(v.x); this->y /= static_cast(v.y); @@ -336,6 +332,15 @@ namespace detail return *this; } + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator%= (tvec1 const & v) + { + this->x %= static_cast(v.x); + this->y %= static_cast(v.x); + return *this; + } + template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator%= (tvec2 const & v) @@ -354,6 +359,15 @@ namespace detail return *this; } + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator&= (tvec1 const & v) + { + this->x &= static_cast(v.x); + this->y &= static_cast(v.x); + return *this; + } + template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator&= (tvec2 const & v) @@ -372,6 +386,15 @@ namespace detail return *this; } + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator|= (tvec1 const & v) + { + this->x |= static_cast(v.x); + this->y |= static_cast(v.x); + return *this; + } + template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator|= (tvec2 const & v) @@ -390,6 +413,15 @@ namespace detail return *this; } + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator^= (tvec1 const & v) + { + this->x ^= static_cast(v.x); + this->y ^= static_cast(v.x); + return *this; + } + template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator^= (tvec2 const & v) @@ -408,6 +440,15 @@ namespace detail return *this; } + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator<<= (tvec1 const & v) + { + this->x <<= static_cast(v.x); + this->y <<= static_cast(v.x); + return *this; + } + template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator<<= (tvec2 const & v) @@ -426,6 +467,15 @@ namespace detail return *this; } + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator>>= (tvec1 const & v) + { + this->x >>= static_cast(v.x); + this->y >>= static_cast(v.x); + return *this; + } + template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator>>= (tvec2 const & v) @@ -439,11 +489,7 @@ namespace detail // Binary arithmetic operators template - GLM_FUNC_QUALIFIER tvec2 operator+ - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v, T const & s) { return tvec2( v.x + s, @@ -451,11 +497,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator+ - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x + v2.x, + v1.y + v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator+(T const & s, tvec2 const & v) { return tvec2( s + v.x, @@ -463,11 +513,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator+ - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator+(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x + v2.x, + v1.x + v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x + v2.x, @@ -476,11 +530,7 @@ namespace detail //operator- template - GLM_FUNC_QUALIFIER tvec2 operator- - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v, T const & s) { return tvec2( v.x - s, @@ -488,11 +538,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator- - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x - v2.x, + v1.y - v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator-(T const & s, tvec2 const & v) { return tvec2( s - v.x, @@ -500,11 +554,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator- - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator-(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x - v2.x, + v1.x - v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x - v2.x, @@ -513,23 +571,23 @@ namespace detail //operator* template - GLM_FUNC_QUALIFIER tvec2 operator* - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v1, T const & v2) { return tvec2( - v.x * s, - v.y * s); + v1.x * v2, + v1.y * v2); } template - GLM_FUNC_QUALIFIER tvec2 operator* - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x * v2.x, + v1.y * v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator*(T const & s, tvec2 const & v) { return tvec2( s * v.x, @@ -537,11 +595,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator* - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator*(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x * v2.x, + v1.x * v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x * v2.x, @@ -550,11 +612,7 @@ namespace detail //operator/ template - GLM_FUNC_QUALIFIER tvec2 operator/ - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v, T const & s) { return tvec2( v.x / s, @@ -562,11 +620,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator/ - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x / v2.x, + v1.y / v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator/(T const & s, tvec2 const & v) { return tvec2( s / v.x, @@ -574,11 +636,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator/ - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator/(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x / v2.x, + v1.x / v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x / v2.x, @@ -587,10 +653,7 @@ namespace detail // Unary constant operators template - GLM_FUNC_QUALIFIER tvec2 operator- - ( - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v) { return tvec2( -v.x, @@ -601,11 +664,7 @@ namespace detail // Binary bit operators template - GLM_FUNC_QUALIFIER tvec2 operator% - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v, T const & s) { return tvec2( v.x % s, @@ -613,11 +672,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator% - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x % v2.x, + v1.y % v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator%(T const & s, tvec2 const & v) { return tvec2( s % v.x, @@ -625,11 +688,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator% - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator%(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x % v2.x, + v1.x % v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x % v2.x, @@ -637,11 +704,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator& - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v, T const & s) { return tvec2( v.x & s, @@ -649,11 +712,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator& - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x & v2.x, + v1.y & v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator&(T const & s, tvec2 const & v) { return tvec2( s & v.x, @@ -661,11 +728,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator& - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator&(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x & v2.x, + v1.x & v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x & v2.x, @@ -673,11 +744,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator| - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v, T const & s) { return tvec2( v.x | s, @@ -685,11 +752,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator| - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x | v2.x, + v1.y | v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator|(T const & s, tvec2 const & v) { return tvec2( s | v.x, @@ -697,23 +768,23 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator| - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator|(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x | v2.x, + v1.x | v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x | v2.x, v1.y | v2.y); } - + template - GLM_FUNC_QUALIFIER tvec2 operator^ - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v, T const & s) { return tvec2( v.x ^ s, @@ -721,11 +792,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator^ - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x ^ v2.x, + v1.y ^ v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator^(T const & s, tvec2 const & v) { return tvec2( s ^ v.x, @@ -733,11 +808,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator^ - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator^(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x ^ v2.x, + v1.x ^ v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x ^ v2.x, @@ -745,11 +824,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator<< - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v, T const & s) { return tvec2( v.x << s, @@ -757,11 +832,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator<< - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x << v2.x, + v1.y << v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator<<(T const & s, tvec2 const & v) { return tvec2( s << v.x, @@ -769,11 +848,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator<< - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator<<(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x << v2.x, + v1.x << v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x << v2.x, @@ -781,11 +864,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator>> - ( - tvec2 const & v, - T const & s - ) + GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v, T const & s) { return tvec2( v.x >> s, @@ -793,11 +872,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator>> - ( - T const & s, - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v1, tvec1 const & v2) + { + return tvec2( + v1.x >> v2.x, + v1.y >> v2.x); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator>>(T const & s, tvec2 const & v) { return tvec2( s >> v.x, @@ -805,11 +888,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator>> - ( - tvec2 const & v1, - tvec2 const & v2 - ) + GLM_FUNC_QUALIFIER tvec2 operator>>(tvec1 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x >> v2.x, + v1.x >> v2.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x >> v2.x, @@ -817,10 +904,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec2 operator~ - ( - tvec2 const & v - ) + GLM_FUNC_QUALIFIER tvec2 operator~(tvec2 const & v) { return tvec2( ~v.x,