Browse Source

Fixed ticket #111, missing swizzle operations

Christophe Riccio 14 years ago
parent
commit
d75db9b8e4
4 changed files with 41 additions and 0 deletions
  1. 1 0
      glm/core/type_vec3.hpp
  2. 12 0
      glm/core/type_vec3.inl
  3. 2 0
      glm/core/type_vec4.hpp
  4. 26 0
      glm/core/type_vec4.inl

+ 1 - 0
glm/core/type_vec3.hpp

@@ -178,6 +178,7 @@ namespace detail
 		GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
 		GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
 		GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
 		GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
 		GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
 		GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
+		GLM_FUNC_DECL tref2<T> swizzle(comp X, comp Y);
 		GLM_FUNC_DECL tref3<T> swizzle(comp X, comp Y, comp Z);
 		GLM_FUNC_DECL tref3<T> swizzle(comp X, comp Y, comp Z);
 	};
 	};
 
 

+ 12 - 0
glm/core/type_vec3.inl

@@ -575,6 +575,18 @@ namespace detail
 			(*this)[w]);
 			(*this)[w]);
 	}
 	}
 
 
+	template <typename T>
+	GLM_FUNC_QUALIFIER tref2<T> tvec3<T>::swizzle
+	(
+		comp x, 
+		comp y
+	)
+	{
+		return tref2<T>(
+			(*this)[x],
+			(*this)[y]);
+	}
+
 	template <typename T>
 	template <typename T>
 	GLM_FUNC_QUALIFIER tref3<T> tvec3<T>::swizzle
 	GLM_FUNC_QUALIFIER tref3<T> tvec3<T>::swizzle
 	(
 	(

+ 2 - 0
glm/core/type_vec4.hpp

@@ -190,6 +190,8 @@ namespace detail
 		GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
 		GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
 		GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
 		GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
 		GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
 		GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
+		GLM_FUNC_DECL tref2<T> swizzle(comp X, comp Y);
+		GLM_FUNC_DECL tref3<T> swizzle(comp X, comp Y, comp Z);
 		GLM_FUNC_DECL tref4<T> swizzle(comp X, comp Y, comp Z, comp W);
 		GLM_FUNC_DECL tref4<T> swizzle(comp X, comp Y, comp Z, comp W);
 	};
 	};
 
 

+ 26 - 0
glm/core/type_vec4.inl

@@ -632,6 +632,32 @@ namespace detail
 			(*this)[w]);
 			(*this)[w]);
 	}
 	}
 
 
+	template <typename T>
+	GLM_FUNC_QUALIFIER tref2<T> tvec4<T>::swizzle
+	(
+		comp x, 
+		comp y
+	)
+	{
+		return tref2<T>(
+			(*this)[x],
+			(*this)[y]);
+	}
+
+	template <typename T>
+	GLM_FUNC_QUALIFIER tref3<T> tvec4<T>::swizzle
+	(
+		comp x, 
+		comp y, 
+		comp z
+	)
+	{
+		return tref3<T>(
+			(*this)[x],
+			(*this)[y],
+			(*this)[z]);
+	}
+
 	template <typename T>
 	template <typename T>
 	GLM_FUNC_QUALIFIER tref4<T> tvec4<T>::swizzle
 	GLM_FUNC_QUALIFIER tref4<T> tvec4<T>::swizzle
 	(
 	(