diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index c1ecb5d4..abd38a83 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -51,13 +51,34 @@ namespace detail ////////////////////////////////////// // Data - union {value_type x, r, s;}; - union {value_type y, g, t;}; +# if(GLM_LANG & GLM_LANG_CXXMS_FLAG) + union + { + struct{ value_type x, y; }; + struct{ value_type r, g; }; + struct{ value_type s, t; }; -# ifdef GLM_SWIZZLE - GLM_SWIZZLE_GEN_REF_FROM_VEC2(value_type, P, detail::tvec2, detail::tref2) - GLM_SWIZZLE_GEN_VEC_FROM_VEC2(value_type, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4) -# endif//GLM_SWIZZLE +# if(defined(GLM_SWIZZLE)) + _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y) + _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g) + _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t) + _GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y) + _GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g) + _GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t) + _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y) + _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g) + _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t) +# endif//(defined(GLM_SWIZZLE)) + }; +# else + union {value_type x, r, s;}; + union {value_type y, g, t;}; + +# if(defined(GLM_SWIZZLE)) + GLM_SWIZZLE_GEN_REF_FROM_VEC2(value_type, P, detail::tvec2, detail::tref2) + GLM_SWIZZLE_GEN_VEC_FROM_VEC2(value_type, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4) +# endif//(defined(GLM_SWIZZLE)) +# endif//GLM_LANG ////////////////////////////////////// // Accesses diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index c64187d2..ddfe8865 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -51,14 +51,35 @@ namespace detail ////////////////////////////////////// // Data - union {value_type x, r, s;}; - union {value_type y, g, t;}; - union {value_type z, b, p;}; +# if(GLM_LANG & GLM_LANG_CXXMS_FLAG) + union + { + struct{ value_type x, y, z; }; + struct{ value_type r, g, b; }; + struct{ value_type s, t, p; }; -# if(defined(GLM_SWIZZLE)) - GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, P, detail::tvec3, detail::tref2, detail::tref3) - GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4) -# endif//(defined(GLM_SWIZZLE)) +# if(defined(GLM_SWIZZLE)) + _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z) + _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b) + _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p) + _GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z) + _GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b) + _GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p) + _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z) + _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b) + _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p) +# endif//(defined(GLM_SWIZZLE)) + }; +# else + union { value_type x, r, s; }; + union { value_type y, g, t; }; + union { value_type z, b, p; }; + +# if(defined(GLM_SWIZZLE)) + GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, P, detail::tvec3, detail::tref2, detail::tref3) + GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4) +# endif//(defined(GLM_SWIZZLE)) +# endif//GLM_LANG ////////////////////////////////////// // Accesses diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp index 0229adaa..f1cd1d17 100644 --- a/glm/core/type_vec4.hpp +++ b/glm/core/type_vec4.hpp @@ -51,15 +51,36 @@ namespace detail ////////////////////////////////////// // Data - union {value_type x, r, s;}; - union {value_type y, g, t;}; - union {value_type z, b, p;}; - union {value_type w, a, q;}; +# if(GLM_LANG & GLM_LANG_CXXMS_FLAG) + union + { + struct { value_type r, g, b, a; }; + struct { value_type s, t, p, q; }; + struct { value_type x, y, z, w;}; -# if(defined(GLM_SWIZZLE)) - GLM_SWIZZLE_GEN_REF_FROM_VEC4(T, P, detail::tvec4, detail::tref2, detail::tref3, detail::tref4) - GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, detail::tvec4, detail::tvec2, detail::tvec3, detail::tvec4) -# endif//(defined(GLM_SWIZZLE)) +# if(defined(GLM_SWIZZLE)) + _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w) + _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a) + _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, s, t, p, q) + _GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, x, y, z, w) + _GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, r, g, b, a) + _GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, s, t, p, q) + _GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, x, y, z, w) + _GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, r, g, b, a) + _GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q) +# endif//(defined(GLM_SWIZZLE)) + }; +# else + union { value_type x, r, s; }; + union { value_type y, g, t; }; + union { value_type z, b, p; }; + union { value_type w, a, q; }; + +# if(defined(GLM_SWIZZLE)) + GLM_SWIZZLE_GEN_REF_FROM_VEC4(T, P, detail::tvec4, detail::tref2, detail::tref3, detail::tref4) + GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, detail::tvec4, detail::tvec2, detail::tvec3, detail::tvec4) +# endif//(defined(GLM_SWIZZLE)) +# endif//GLM_LANG ////////////////////////////////////// // Accesses