From e8b35cc58cb330708ec03ae37c50a71dfb0d5d98 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 28 Jan 2011 14:24:33 +0000 Subject: [PATCH] Updated swizzle operator API --- glm/core/_swizzle.hpp | 36 ++++++++++++++++++------------------ glm/setup.hpp | 19 +++++++++---------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/glm/core/_swizzle.hpp b/glm/core/_swizzle.hpp index ed7bcf9b..f0ba22ad 100644 --- a/glm/core/_swizzle.hpp +++ b/glm/core/_swizzle.hpp @@ -29,7 +29,7 @@ namespace glm }; }//namespace glm -#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) +#if(defined(GLM_FORCE_SWIZZLE_XYZW) || defined(GLM_FORCE_SWIZZLE)) #define xx swizzle(glm::X, glm::X) #define yx swizzle(glm::Y, glm::X) @@ -48,9 +48,9 @@ namespace glm #define zw swizzle(glm::Z, glm::W) #define ww swizzle(glm::W, glm::W) -#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) +#endif -#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) +#if(defined(GLM_FORCE_SWIZZLE_RGBA) || defined(GLM_FORCE_SWIZZLE)) #define rr swizzle(glm::X, glm::X) #define gr swizzle(glm::Y, glm::X) @@ -69,9 +69,9 @@ namespace glm #define ba swizzle(glm::Z, glm::W) #define aa swizzle(glm::W, glm::W) -#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) +#endif -#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) +#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_FORCE_SWIZZLE)) #define ss swizzle(glm::X, glm::X) #define ts swizzle(glm::Y, glm::X) @@ -90,9 +90,9 @@ namespace glm #define pq swizzle(glm::Z, glm::W) #define qq swizzle(glm::W, glm::W) -#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) +#endif -#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) +#if(defined(GLM_FORCE_SWIZZLE_XYZW) || defined(GLM_FORCE_SWIZZLE)) #define xxx swizzle(glm::X, glm::X, glm::X) #define yxx swizzle(glm::Y, glm::X, glm::X) @@ -159,9 +159,9 @@ namespace glm #define zww swizzle(glm::Z, glm::W, glm::W) #define www swizzle(glm::W, glm::W, glm::W) -#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) +#endif -#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) +#if(defined(GLM_FORCE_SWIZZLE_RGBA) || defined(GLM_FORCE_SWIZZLE)) #define rrr swizzle(glm::X, glm::X, glm::X) #define grr swizzle(glm::Y, glm::X, glm::X) @@ -228,9 +228,9 @@ namespace glm #define baa swizzle(glm::Z, glm::W, glm::W) #define aaa swizzle(glm::W, glm::W, glm::W) -#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) +#endif -#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) +#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_FORCE_SWIZZLE)) #define sss swizzle(glm::X, glm::X, glm::X) #define tss swizzle(glm::Y, glm::X, glm::X) @@ -297,9 +297,9 @@ namespace glm #define pqq swizzle(glm::Z, glm::W, glm::W) #define qqq swizzle(glm::W, glm::W, glm::W) -#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) +#endif -#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) +#if(defined(GLM_FORCE_SWIZZLE_XYZW) || defined(GLM_FORCE_SWIZZLE)) #define xxxx swizzle(glm::X, glm::X, glm::X, glm::X) #define yxxx swizzle(glm::Y, glm::X, glm::X, glm::X) @@ -558,9 +558,9 @@ namespace glm #define zwww swizzle(glm::Z, glm::W, glm::W, glm::W) #define wwww swizzle(glm::W, glm::W, glm::W, glm::W) -#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) +#endif -#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) +#if(defined(GLM_FORCE_SWIZZLE_RGBA) || defined(GLM_FORCE_SWIZZLE)) #define rrrr swizzle(glm::X, glm::X, glm::X, glm::X) #define grrr swizzle(glm::Y, glm::X, glm::X, glm::X) @@ -819,9 +819,9 @@ namespace glm #define baaa swizzle(glm::Z, glm::W, glm::W, glm::W) #define aaaa swizzle(glm::W, glm::W, glm::W, glm::W) -#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) +#endif -#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) +#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_FORCE_SWIZZLE)) #define ssss swizzle(glm::X, glm::X, glm::X, glm::X) #define tsss swizzle(glm::Y, glm::X, glm::X, glm::X) @@ -1080,6 +1080,6 @@ namespace glm #define pqqq swizzle(glm::Z, glm::W, glm::W, glm::W) #define qqqq swizzle(glm::W, glm::W, glm::W, glm::W) -#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) +#endif #endif//glm_core_swizzle diff --git a/glm/setup.hpp b/glm/setup.hpp index 9e51c0bf..6bd2e591 100644 --- a/glm/setup.hpp +++ b/glm/setup.hpp @@ -373,21 +373,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // Swizzle operators -#define GLM_SWIZZLE_NONE 0x00000000 -#define GLM_SWIZZLE_XYZW 0x00000002 -#define GLM_SWIZZLE_RGBA 0x00000004 -#define GLM_SWIZZLE_STQP 0x00000008 -#define GLM_SWIZZLE_FULL (GLM_SWIZZLE_XYZW | GLM_SWIZZLE_RGBA | GLM_SWIZZLE_STQP) +//#define GLM_FORCE_SWIZZLE_XYZW +//#define GLM_FORCE_SWIZZLE_RGBA +//#define GLM_FORCE_SWIZZLE_STQP +//#define GLM_FORCE_SWIZZLE #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)) # define GLM_MESSAGE_SWIZZLE_DISPLAYED -# if !defined(GLM_SWIZZLE)|| (defined(GLM_SWIZZLE) && GLM_SWIZZLE == GLM_SWIZZLE_NONE) -# pragma message("GLM: No swizzling operator enabled") -# elif(defined(GLM_SWIZZLE) && GLM_SWIZZLE == GLM_SWIZZLE_FULL) +# if(defined(GLM_FORCE_SWIZZLE)) # pragma message("GLM: Full swizzling operator enabled") -# elif(defined(GLM_SWIZZLE) && GLM_SWIZZLE & GLM_SWIZZLE_FULL) +# elif(!defined(GLM_FORCE_SWIZZLE_XYZW) && !defined(GLM_FORCE_SWIZZLE_RGBA) && !defined(GLM_FORCE_SWIZZLE_STQP) && !defined(GLM_FORCE_SWIZZLE)) +# pragma message("GLM: No swizzling operator enabled") +# else # pragma message("GLM: Partial swizzling operator enabled") -# endif//GLM_SWIZZLE +# endif #endif//GLM_MESSAGE ///////////////////////////////////////////////////////////////////////////////////////////////////