Browse Source

Added full tvec1 support to tvec2

Christophe Riccio 11 years ago
parent
commit
a0743f94aa
2 changed files with 403 additions and 243 deletions
  1. 96 20
      glm/detail/type_vec2.hpp
  2. 307 223
      glm/detail/type_vec2.inl

+ 96 - 20
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 <typename U, typename V>
-		GLM_FUNC_DECL tvec2(
-			U const & x,
-			V const & y);
+		GLM_FUNC_DECL tvec2(U const & x, V const & y);
+		template <typename U, typename V>
+		GLM_FUNC_DECL tvec2(tvec1<U, P> const & v1, tvec1<V, P> const & v2);
 
 		//////////////////////////////////////
 		// Conversion vector constructors
@@ -152,23 +148,31 @@ namespace detail
 
 		GLM_FUNC_DECL tvec2<T, P> & operator= (tvec2<T, P> const & v);
 
-		template <typename U> 
+		template <typename U>
 		GLM_FUNC_DECL tvec2<T, P> & operator= (tvec2<U, P> const & v);
-		template <typename U> 
+		template <typename U>
 		GLM_FUNC_DECL tvec2<T, P> & operator+=(U s);
-		template <typename U> 
+		template <typename U>
+		GLM_FUNC_DECL tvec2<T, P> & operator+=(tvec1<U, P> const & v);
+		template <typename U>
 		GLM_FUNC_DECL tvec2<T, P> & operator+=(tvec2<U, P> const & v);
-		template <typename U> 
+		template <typename U>
 		GLM_FUNC_DECL tvec2<T, P> & operator-=(U s);
-		template <typename U> 
+		template <typename U>
+		GLM_FUNC_DECL tvec2<T, P> & operator-=(tvec1<U, P> const & v);
+		template <typename U>
 		GLM_FUNC_DECL tvec2<T, P> & operator-=(tvec2<U, P> const & v);
-		template <typename U> 
+		template <typename U>
 		GLM_FUNC_DECL tvec2<T, P> & operator*=(U s);
-		template <typename U> 
+		template <typename U>
+		GLM_FUNC_DECL tvec2<T, P> & operator*=(tvec1<U, P> const & v);
+		template <typename U>
 		GLM_FUNC_DECL tvec2<T, P> & operator*=(tvec2<U, P> const & v);
-		template <typename U> 
+		template <typename U>
 		GLM_FUNC_DECL tvec2<T, P> & operator/=(U s);
-		template <typename U> 
+		template <typename U>
+		GLM_FUNC_DECL tvec2<T, P> & operator/=(tvec1<U, P> const & v);
+		template <typename U>
 		GLM_FUNC_DECL tvec2<T, P> & operator/=(tvec2<U, P> const & v);
 
 		//////////////////////////////////////
@@ -185,62 +189,98 @@ namespace detail
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator%= (U s);
 		template <typename U> 
+		GLM_FUNC_DECL tvec2<T, P> & operator%= (tvec1<U, P> const & v);
+		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator%= (tvec2<U, P> const & v);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator&= (U s);
 		template <typename U> 
+		GLM_FUNC_DECL tvec2<T, P> & operator&= (tvec1<U, P> const & v);
+		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator&= (tvec2<U, P> const & v);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator|= (U s);
 		template <typename U> 
+		GLM_FUNC_DECL tvec2<T, P> & operator|= (tvec1<U, P> const & v);
+		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator|= (tvec2<U, P> const & v);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator^= (U s);
 		template <typename U> 
+		GLM_FUNC_DECL tvec2<T, P> & operator^= (tvec1<U, P> const & v);
+		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator^= (tvec2<U, P> const & v);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator<<=(U s);
 		template <typename U> 
+		GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec1<U, P> const & v);
+		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec2<U, P> const & v);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator>>=(U s);
 		template <typename U> 
+		GLM_FUNC_DECL tvec2<T, P> & operator>>=(tvec1<U, P> const & v);
+		template <typename U> 
 		GLM_FUNC_DECL tvec2<T, P> & operator>>=(tvec2<U, P> const & v);
 	};
 
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator+(T const & s, tvec2<T, P> const & v);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator+(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator-(T const & s, tvec2<T, P> const & v);
 
 	template <typename T, precision P>
-	GLM_FUNC_DECL tvec2<T, P> operator-	(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
+	GLM_FUNC_DECL tvec2<T, P> operator-(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator*(T const & s, tvec2<T, P> const & v);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator*(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator/(T const & s, tvec2<T, P> const & v);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator/(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 
@@ -250,54 +290,90 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator%(T const & s, tvec2<T, P> const & v);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator%(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator&(T const & s, tvec2<T, P> const & v);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator&(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator|(T const & s, tvec2<T, P> const & v);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator|(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator^(T const & s, tvec2<T, P> const & v);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator^(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator<<(T const & s, tvec2<T, P> const & v);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator<<(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v, T const & s);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator>>(T const & s, tvec2<T, P> const & v);
 
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator>>(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
+
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
 

+ 307 - 223
glm/detail/type_vec2.inl

@@ -88,11 +88,7 @@ namespace detail
 	{}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
-	(
-		T const & s1,
-		T const & s2
-	) :
+	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(T const & s1, T const & s2) :
 		x(s1),
 		y(s2)
 	{}
@@ -102,44 +98,38 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U, typename V>
-	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
-	(
-		U const & a,
-		V const & b
-	) :
+	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(U const & a, V const & b) :
 		x(static_cast<T>(a)),
 		y(static_cast<T>(b))
 	{}
 
+	template <typename T, precision P>
+	template <typename U, typename V>
+	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec1<U, P> const & v1, tvec1<V, P> const & v2) :
+		x(v1.x),
+		y(v2.x)
+	{}
+
 	//////////////////////////////////////
 	// Conversion vector constructors
 
 	template <typename T, precision P>
 	template <typename U, precision Q>
-	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
-	(
-		tvec2<U, Q> const & v
-	) :
+	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec2<U, Q> const & v) :
 		x(static_cast<T>(v.x)),
 		y(static_cast<T>(v.y))
 	{}
 
 	template <typename T, precision P>
 	template <typename U, precision Q>
-	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
-	(
-		tvec3<U, Q> const & v
-	) :
+	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec3<U, Q> const & v) :
 		x(static_cast<T>(v.x)),
 		y(static_cast<T>(v.y))
 	{}
 
 	template <typename T, precision P>
 	template <typename U, precision Q>
-	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
-	(
-		tvec4<U, Q> const & v
-	) :
+	GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec4<U, Q> const & v) :
 		x(static_cast<T>(v.x)),
 		y(static_cast<T>(v.y))
 	{}
@@ -148,10 +138,7 @@ namespace detail
 	// Unary arithmetic operators
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=
-	(
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=(tvec2<T, P> const & v)
 	{
 		this->x = v.x;
 		this->y = v.y;
@@ -160,10 +147,7 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=
-	(
-		tvec2<U, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=(tvec2<U, P> const & v)
 	{
 		this->x = static_cast<T>(v.x);
 		this->y = static_cast<T>(v.y);
@@ -172,10 +156,7 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=
-	(
-		U s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(U s)
 	{
 		this->x += static_cast<T>(s);
 		this->y += static_cast<T>(s);
@@ -184,10 +165,16 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=
-	(
-		tvec2<U, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(tvec1<U, P> const & v)
+	{
+		this->x += static_cast<T>(v.x);
+		this->y += static_cast<T>(v.x);
+		return *this;
+	}
+
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(tvec2<U, P> const & v)
 	{
 		this->x += static_cast<T>(v.x);
 		this->y += static_cast<T>(v.y);
@@ -196,10 +183,7 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=
-	(
-		U s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(U s)
 	{
 		this->x -= static_cast<T>(s);
 		this->y -= static_cast<T>(s);
@@ -208,10 +192,16 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=
-	(
-		tvec2<U, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(tvec1<U, P> const & v)
+	{
+		this->x -= static_cast<T>(v.x);
+		this->y -= static_cast<T>(v.x);
+		return *this;
+	}
+
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(tvec2<U, P> const & v)
 	{
 		this->x -= static_cast<T>(v.x);
 		this->y -= static_cast<T>(v.y);
@@ -220,10 +210,7 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=
-	(
-		U s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(U s)
 	{
 		this->x *= static_cast<T>(s);
 		this->y *= static_cast<T>(s);
@@ -232,10 +219,16 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=
-	(
-		tvec2<U, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(tvec1<U, P> const & v)
+	{
+		this->x *= static_cast<T>(v.x);
+		this->y *= static_cast<T>(v.x);
+		return *this;
+	}
+
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(tvec2<U, P> const & v)
 	{
 		this->x *= static_cast<T>(v.x);
 		this->y *= static_cast<T>(v.y);
@@ -244,10 +237,7 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=
-	(
-		U s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(U s)
 	{
 		this->x /= static_cast<T>(s);
 		this->y /= static_cast<T>(s);
@@ -256,10 +246,16 @@ namespace detail
 
 	template <typename T, precision P>
 	template <typename U>
-	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=
-	(
-		tvec2<U, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(tvec1<U, P> const & v)
+	{
+		this->x /= static_cast<T>(v.x);
+		this->y /= static_cast<T>(v.x);
+		return *this;
+	}
+
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(tvec2<U, P> const & v)
 	{
 		this->x /= static_cast<T>(v.x);
 		this->y /= static_cast<T>(v.y);
@@ -336,6 +332,15 @@ namespace detail
 		return *this;
 	}
 
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%= (tvec1<U, P> const & v)
+	{
+		this->x %= static_cast<T>(v.x);
+		this->y %= static_cast<T>(v.x);
+		return *this;
+	}
+
 	template <typename T, precision P>
 	template <typename U>
 	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%= (tvec2<U, P> const & v)
@@ -354,6 +359,15 @@ namespace detail
 		return *this;
 	}
 
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&= (tvec1<U, P> const & v)
+	{
+		this->x &= static_cast<T>(v.x);
+		this->y &= static_cast<T>(v.x);
+		return *this;
+	}
+
 	template <typename T, precision P>
 	template <typename U>
 	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&= (tvec2<U, P> const & v)
@@ -372,6 +386,15 @@ namespace detail
 		return *this;
 	}
 
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|= (tvec1<U, P> const & v)
+	{
+		this->x |= static_cast<T>(v.x);
+		this->y |= static_cast<T>(v.x);
+		return *this;
+	}
+
 	template <typename T, precision P>
 	template <typename U>
 	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|= (tvec2<U, P> const & v)
@@ -390,6 +413,15 @@ namespace detail
 		return *this;
 	}
 
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^= (tvec1<U, P> const & v)
+	{
+		this->x ^= static_cast<T>(v.x);
+		this->y ^= static_cast<T>(v.x);
+		return *this;
+	}
+
 	template <typename T, precision P>
 	template <typename U>
 	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^= (tvec2<U, P> const & v)
@@ -408,6 +440,15 @@ namespace detail
 		return *this;
 	}
 
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<= (tvec1<U, P> const & v)
+	{
+		this->x <<= static_cast<T>(v.x);
+		this->y <<= static_cast<T>(v.x);
+		return *this;
+	}
+
 	template <typename T, precision P>
 	template <typename U>
 	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<= (tvec2<U, P> const & v)
@@ -426,6 +467,15 @@ namespace detail
 		return *this;
 	}
 
+	template <typename T, precision P>
+	template <typename U>
+	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>= (tvec1<U, P> const & v)
+	{
+		this->x >>= static_cast<T>(v.x);
+		this->y >>= static_cast<T>(v.x);
+		return *this;
+	}
+
 	template <typename T, precision P>
 	template <typename U>
 	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>= (tvec2<U, P> const & v)
@@ -439,11 +489,7 @@ namespace detail
 	// Binary arithmetic operators
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator+
-	(
-		tvec2<T, P> const & v,
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v, T const & s)
 	{
 		return tvec2<T, P>(
 			v.x + s,
@@ -451,11 +497,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator+
-	(
-		T const & s,
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x + v2.x,
+			v1.y + v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s + v.x,
@@ -463,11 +513,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator+
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x + v2.x,
+			v1.x + v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x + v2.x,
@@ -476,11 +530,7 @@ namespace detail
 
 	//operator-
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator-
-	(
-		tvec2<T, P> const & v, 
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v, T const & s)
 	{
 		return tvec2<T, P>(
 			v.x - s,
@@ -488,11 +538,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator- 
-	(
-		T const & s, 
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x - v2.x,
+			v1.y - v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s - v.x,
@@ -500,11 +554,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator-
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x - v2.x,
+			v1.x - v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x - v2.x,
@@ -513,23 +571,23 @@ namespace detail
 
 	//operator*
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator*
-	(
-		tvec2<T, P> const & v,
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec2<T, P> const & v1, T const & v2)
 	{
 		return tvec2<T, P>(
-			v.x * s,
-			v.y * s);
+			v1.x * v2,
+			v1.y * v2);
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator*
-	(
-		T const & s,
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x * v2.x,
+			v1.y * v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s * v.x,
@@ -537,11 +595,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator*
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x * v2.x,
+			v1.x * v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x * v2.x,
@@ -550,11 +612,7 @@ namespace detail
 
 	//operator/
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator/
-	(
-		tvec2<T, P> const & v,
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v, T const & s)
 	{
 		return tvec2<T, P>(
 			v.x / s,
@@ -562,11 +620,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator/
-	(
-		T const & s,
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x / v2.x,
+			v1.y / v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s / v.x,
@@ -574,11 +636,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator/
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x / v2.x,
+			v1.x / v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x / v2.x,
@@ -587,10 +653,7 @@ namespace detail
 
 	// Unary constant operators
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator-
-	(
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			-v.x, 
@@ -601,11 +664,7 @@ namespace detail
 	// Binary bit operators
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator%
-	(
-		tvec2<T, P> const & v,
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v, T const & s)
 	{
 		return tvec2<T, P>(
 			v.x % s,
@@ -613,11 +672,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator%
-	(
-		T const & s,
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x % v2.x,
+			v1.y % v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s % v.x,
@@ -625,11 +688,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator%
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x % v2.x,
+			v1.x % v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x % v2.x,
@@ -637,11 +704,7 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator&
-	(
-		tvec2<T, P> const & v,
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v, T const & s)
 	{
 		return tvec2<T, P>(
 			v.x & s,
@@ -649,11 +712,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator&
-	(
-		T const & s,
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x & v2.x,
+			v1.y & v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s & v.x,
@@ -661,11 +728,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator&
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x & v2.x,
+			v1.x & v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x & v2.x,
@@ -673,11 +744,7 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator|
-	(
-		tvec2<T, P> const & v,
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v, T const & s)
 	{
 		return tvec2<T, P>(
 			v.x | s,
@@ -685,11 +752,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator|
-	(
-		T const & s,
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x | v2.x,
+			v1.y | v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s | v.x,
@@ -697,23 +768,23 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator|
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x | v2.x,
+			v1.x | v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x | v2.x,
 			v1.y | v2.y);
 	}
-		
+
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator^
-	(
-		tvec2<T, P> const & v,
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v, T const & s)
 	{
 		return tvec2<T, P>(
 			v.x ^ s,
@@ -721,11 +792,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator^
-	(
-		T const & s,
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x ^ v2.x,
+			v1.y ^ v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s ^ v.x,
@@ -733,11 +808,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator^
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x ^ v2.x,
+			v1.x ^ v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x ^ v2.x,
@@ -745,11 +824,7 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<
-	(
-		tvec2<T, P> const & v,
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v, T const & s)
 	{
 		return tvec2<T, P>(
 			v.x << s,
@@ -757,11 +832,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<
-	(
-		T const & s,
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x << v2.x,
+			v1.y << v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s << v.x,
@@ -769,11 +848,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x << v2.x,
+			v1.x << v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x << v2.x,
@@ -781,11 +864,7 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>
-	(
-		tvec2<T, P> const & v,
-		T const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v, T const & s)
 	{
 		return tvec2<T, P>(
 			v.x >> s,
@@ -793,11 +872,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>
-	(
-		T const & s,
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x >> v2.x,
+			v1.y >> v2.x);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(T const & s, tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			s >> v.x,
@@ -805,11 +888,15 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>
-	(
-		tvec2<T, P> const & v1,
-		tvec2<T, P> const & v2
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
+	{
+		return tvec2<T, P>(
+			v1.x >> v2.x,
+			v1.x >> v2.y);
+	}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
 	{
 		return tvec2<T, P>(
 			v1.x >> v2.x,
@@ -817,10 +904,7 @@ namespace detail
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec2<T, P> operator~
-	(
-		tvec2<T, P> const & v
-	)
+	GLM_FUNC_QUALIFIER tvec2<T, P> operator~(tvec2<T, P> const & v)
 	{
 		return tvec2<T, P>(
 			~v.x,