Browse Source

Added vector type operator declarations

Christophe Riccio 12 years ago
parent
commit
a2583caa0f
5 changed files with 306 additions and 10 deletions
  1. 96 0
      glm/core/type_vec2.hpp
  2. 5 5
      glm/core/type_vec2.inl
  3. 97 0
      glm/core/type_vec3.hpp
  4. 103 0
      glm/core/type_vec4.hpp
  5. 5 5
      glm/core/type_vec4.inl

+ 96 - 0
glm/core/type_vec2.hpp

@@ -235,6 +235,102 @@ namespace detail
 
 
 	GLM_DETAIL_IS_VECTOR(tvec2);
 	GLM_DETAIL_IS_VECTOR(tvec2);
 
 
+	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+(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);
+
+	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-(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);
+
+	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*(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);
+
+	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/(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);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, 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%(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);
+
+	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&(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);
+
+	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|(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);
+
+	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^(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);
+
+	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<<(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);
+
+	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>>(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);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec2<T, P> operator~(tvec2<T, P> const & v);
+
 }//namespace detail
 }//namespace detail
 }//namespace glm
 }//namespace glm
 
 

+ 5 - 5
glm/core/type_vec2.inl

@@ -957,7 +957,7 @@ namespace detail
 	// tref definition
 	// tref definition
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
-	tref2<T, P>::tref2
+	GLM_FUNC_QUALIFIER tref2<T, P>::tref2
 	(
 	(
 		T & x, 
 		T & x, 
 		T & y
 		T & y
@@ -967,7 +967,7 @@ namespace detail
 	{}
 	{}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
-	tref2<T, P>::tref2
+	GLM_FUNC_QUALIFIER tref2<T, P>::tref2
 	(
 	(
 		tref2<T, P> const & r
 		tref2<T, P> const & r
 	) :
 	) :
@@ -976,7 +976,7 @@ namespace detail
 	{}
 	{}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
-	tref2<T, P>::tref2
+	GLM_FUNC_QUALIFIER tref2<T, P>::tref2
 	(
 	(
 		tvec2<T, P> const & v
 		tvec2<T, P> const & v
 	) :
 	) :
@@ -985,7 +985,7 @@ namespace detail
 	{}
 	{}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
-	tref2<T, P>& tref2<T, P>::operator=
+	GLM_FUNC_QUALIFIER tref2<T, P>& tref2<T, P>::operator=
 	(
 	(
 		tref2<T, P> const & r
 		tref2<T, P> const & r
 	)
 	)
@@ -996,7 +996,7 @@ namespace detail
 	}
 	}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
-	tref2<T, P>& tref2<T, P>::operator=
+	GLM_FUNC_QUALIFIER tref2<T, P>& tref2<T, P>::operator=
 	(
 	(
 		tvec2<T, P> const & v
 		tvec2<T, P> const & v
 	)
 	)

+ 97 - 0
glm/core/type_vec3.hpp

@@ -260,6 +260,103 @@ namespace detail
 	};
 	};
 
 
 	GLM_DETAIL_IS_VECTOR(tvec3);
 	GLM_DETAIL_IS_VECTOR(tvec3);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator+(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v, 	T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator-(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator-	(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator*(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator/(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator%(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator&(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator|(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+		
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator^(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator<<(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator>>(T const & s, tvec3<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
+
+	template <typename T, precision P> 
+	GLM_FUNC_DECL tvec3<T, P> operator~(tvec3<T, P> const & v);
+
 }//namespace detail
 }//namespace detail
 }//namespace glm
 }//namespace glm
 
 

+ 103 - 0
glm/core/type_vec4.hpp

@@ -317,6 +317,109 @@ namespace detail
 	};
 	};
 
 
 	GLM_DETAIL_IS_VECTOR(tvec4);
 	GLM_DETAIL_IS_VECTOR(tvec4);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator+(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, 	typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator-(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator-	(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator*(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator/(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL bool operator==(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator%(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator&(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator|(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator^(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator<<(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator>>(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
+
+	template <typename T, precision P> 
+	GLM_FUNC_DECL tvec4<T, P> operator~(tvec4<T, P> const & v);
+
 }//namespace detail
 }//namespace detail
 }//namespace glm
 }//namespace glm
 
 

+ 5 - 5
glm/core/type_vec4.inl

@@ -1294,7 +1294,7 @@ namespace detail
 	// tref definition
 	// tref definition
 
 
 	template <typename T, precision P> 
 	template <typename T, precision P> 
-	tref4<T, P>::tref4
+	GLM_FUNC_QUALIFIER tref4<T, P>::tref4
 	(
 	(
 		T & x, 
 		T & x, 
 		T & y, 
 		T & y, 
@@ -1308,7 +1308,7 @@ namespace detail
 	{}
 	{}
 
 
 	template <typename T, precision P> 
 	template <typename T, precision P> 
-	tref4<T, P>::tref4
+	GLM_FUNC_QUALIFIER tref4<T, P>::tref4
 	(
 	(
 		tref4<T, P> const & r
 		tref4<T, P> const & r
 	) :
 	) :
@@ -1319,7 +1319,7 @@ namespace detail
 	{}
 	{}
 
 
 	template <typename T, precision P> 
 	template <typename T, precision P> 
-	tref4<T, P>::tref4
+	GLM_FUNC_QUALIFIER tref4<T, P>::tref4
 	(
 	(
 		tvec4<T, P> const & v
 		tvec4<T, P> const & v
 	) :
 	) :
@@ -1330,7 +1330,7 @@ namespace detail
 	{}
 	{}
 
 
 	template <typename T, precision P> 
 	template <typename T, precision P> 
-	tref4<T, P>& tref4<T, P>::operator= 
+	GLM_FUNC_QUALIFIER tref4<T, P>& tref4<T, P>::operator= 
 	(
 	(
 		tref4<T, P> const & r
 		tref4<T, P> const & r
 	)
 	)
@@ -1343,7 +1343,7 @@ namespace detail
 	}
 	}
 
 
 	template <typename T, precision P> 
 	template <typename T, precision P> 
-	tref4<T, P>& tref4<T, P>::operator= 
+	GLM_FUNC_QUALIFIER tref4<T, P>& tref4<T, P>::operator= 
 	(
 	(
 		tvec4<T, P> const & v
 		tvec4<T, P> const & v
 	)
 	)