Explorar o código

Added GLM_GTC_swizzle

Christophe Riccio %!s(int64=15) %!d(string=hai) anos
pai
achega
d5c4dc0aeb
Modificáronse 2 ficheiros con 17 adicións e 27 borrados
  1. 2 2
      glm/gtc/swizzle.hpp
  2. 15 25
      glm/gtc/swizzle.inl

+ 2 - 2
glm/gtc/swizzle.hpp

@@ -24,11 +24,11 @@ namespace glm
 
 	namespace gtc{
 	//! GLM_GTC_swizzle extension
-	namespace glm_gtc_swizzle{
+	namespace swizzle{
 
 
 
-	}//namespace closest_point
+	}//namespace swizzle
 	}//namespace gtc
 }//namespace glm
 

+ 15 - 25
glm/gtc/swizzle.inl

@@ -3,58 +3,48 @@ namespace gtc{
 namespace glm_gtc_swizzle
 {
 	template <typename T>
-	inline typename tvec4<T>::value_type swizzle
+	inline T swizzle
 	(	
 		detail::tvec4<T> const & v,
 		comp x
-	) const
+	)
 	{
 		return v[x];
 	}
 
 	template <typename T>
-	inline tvec2<T> tvec4<T>::swizzle
+	inline detail::tvec2<T> swizzle
 	(
 		detail::tvec4<T> const & v,
 		comp x, comp y
-	) const
+	)
 	{
-		return tvec2<T>(
-			(*this)[x],
-			(*this)[y]);
+		return detail::tvec2<T>(
+			v[x],
+			v[y]);
 	}
 
 	template <typename T>
-	inline tvec3<T> tvec4<T>::swizzle
+	inline detail::tvec3<T> swizzle
 	(
 		detail::tvec4<T> const & v,
 		comp x, comp y, comp z
-	) const
-	{
-		return tvec3<T>(
-			(*this)[x],
-			(*this)[y],
-			(*this)[z]);
-	}
-
-	template <typename T>
-	inline tvec4<T> tvec4<T>::swizzle
-	(
-		detail::tvec4<T> const & v,
-		comp x, comp y, comp z, comp w
-	) const
+	)
 	{
-		return tvec4<T>(v[x], v[y],	v[z], v[w]);
+		return detail::tvec3<T>(
+			v[x],
+			v[y],
+			v[z]);
 	}
 
 	template <typename T>
-	inline tref4<T> swizzle
+	inline detail::tref4<T> swizzle
 	(
 		detail::tvec4<T> const & v,
 		comp x, comp y, comp z, comp w
 	)
 	{
-		return tref4<T>(v[x], v[y],	v[z], v[w]);
+		return detail::tref4<T>(v[x], v[y],	v[z], v[w]);
 	}
 
 }//namespace glm_gtc_swizzle