Updated swizzle operator API

This commit is contained in:
Christophe Riccio 2011-01-28 14:24:33 +00:00
parent a099b74c0a
commit e8b35cc58c
2 changed files with 27 additions and 28 deletions

View File

@ -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

View File

@ -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
///////////////////////////////////////////////////////////////////////////////////////////////////