From d75db9b8e4be6358e1e0b74a589d9de03bfa0a53 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 30 Sep 2011 16:16:55 +0100 Subject: [PATCH] Fixed ticket #111, missing swizzle operations --- glm/core/type_vec3.hpp | 1 + glm/core/type_vec3.inl | 12 ++++++++++++ glm/core/type_vec4.hpp | 2 ++ glm/core/type_vec4.inl | 26 ++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index 1afb844f..281809dd 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -178,6 +178,7 @@ namespace detail GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; + GLM_FUNC_DECL tref2 swizzle(comp X, comp Y); GLM_FUNC_DECL tref3 swizzle(comp X, comp Y, comp Z); }; diff --git a/glm/core/type_vec3.inl b/glm/core/type_vec3.inl index f06d541f..f112a4ad 100644 --- a/glm/core/type_vec3.inl +++ b/glm/core/type_vec3.inl @@ -575,6 +575,18 @@ namespace detail (*this)[w]); } + template + GLM_FUNC_QUALIFIER tref2 tvec3::swizzle + ( + comp x, + comp y + ) + { + return tref2( + (*this)[x], + (*this)[y]); + } + template GLM_FUNC_QUALIFIER tref3 tvec3::swizzle ( diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp index 9ea08606..4ec85c05 100644 --- a/glm/core/type_vec4.hpp +++ b/glm/core/type_vec4.hpp @@ -190,6 +190,8 @@ namespace detail GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; + GLM_FUNC_DECL tref2 swizzle(comp X, comp Y); + GLM_FUNC_DECL tref3 swizzle(comp X, comp Y, comp Z); GLM_FUNC_DECL tref4 swizzle(comp X, comp Y, comp Z, comp W); }; diff --git a/glm/core/type_vec4.inl b/glm/core/type_vec4.inl index 6750beae..567be01c 100644 --- a/glm/core/type_vec4.inl +++ b/glm/core/type_vec4.inl @@ -632,6 +632,32 @@ namespace detail (*this)[w]); } + template + GLM_FUNC_QUALIFIER tref2 tvec4::swizzle + ( + comp x, + comp y + ) + { + return tref2( + (*this)[x], + (*this)[y]); + } + + template + GLM_FUNC_QUALIFIER tref3 tvec4::swizzle + ( + comp x, + comp y, + comp z + ) + { + return tref3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + template GLM_FUNC_QUALIFIER tref4 tvec4::swizzle (