Clean up formatting for components and swizzle code
This commit is contained in:
parent
093b8042f7
commit
b2ce1a726b
@ -56,18 +56,43 @@ namespace glm
|
|||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Helper
|
// Helper
|
||||||
|
|
||||||
#if GLM_FORCE_SIZE_FUNC
|
# if GLM_FORCE_SIZE_FUNC
|
||||||
/// Return the count of components of the vector
|
/// Return the count of components of the vector
|
||||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||||
#else
|
# else
|
||||||
/// Return the count of components of the vector
|
/// Return the count of components of the vector
|
||||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||||
#endif//GLM_FORCE_SIZE_FUNC
|
# endif//GLM_FORCE_SIZE_FUNC
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Data
|
// Data
|
||||||
|
|
||||||
union {T x, r, s;};
|
# if GLM_HAS_ANONYMOUS_UNION
|
||||||
|
union
|
||||||
|
{
|
||||||
|
T x;
|
||||||
|
T r;
|
||||||
|
T s;
|
||||||
|
/*
|
||||||
|
# ifdef GLM_SWIZZLE
|
||||||
|
_GLM_SWIZZLE1_2_MEMBERS(T, P, tvec2, x)
|
||||||
|
_GLM_SWIZZLE1_2_MEMBERS(T, P, tvec2, r)
|
||||||
|
_GLM_SWIZZLE1_2_MEMBERS(T, P, tvec2, s)
|
||||||
|
_GLM_SWIZZLE1_3_MEMBERS(T, P, tvec3, x)
|
||||||
|
_GLM_SWIZZLE1_3_MEMBERS(T, P, tvec3, r)
|
||||||
|
_GLM_SWIZZLE1_3_MEMBERS(T, P, tvec3, s)
|
||||||
|
_GLM_SWIZZLE1_4_MEMBERS(T, P, tvec4, x)
|
||||||
|
_GLM_SWIZZLE1_4_MEMBERS(T, P, tvec4, r)
|
||||||
|
_GLM_SWIZZLE1_4_MEMBERS(T, P, tvec4, s)
|
||||||
|
# endif//GLM_SWIZZLE*/
|
||||||
|
};
|
||||||
|
# else
|
||||||
|
union {T x, r, s;};
|
||||||
|
/*
|
||||||
|
# ifdef GLM_SWIZZLE
|
||||||
|
GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, P, tvec2, tvec2, tvec3, tvec4)
|
||||||
|
# endif//GLM_SWIZZLE*/
|
||||||
|
# endif
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Accesses
|
// Accesses
|
||||||
|
@ -57,33 +57,35 @@ namespace glm
|
|||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Helper
|
// Helper
|
||||||
|
|
||||||
#if GLM_FORCE_SIZE_FUNC
|
# if GLM_FORCE_SIZE_FUNC
|
||||||
/// Return the count of components of the vector
|
/// Return the count of components of the vector
|
||||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||||
#else
|
# else
|
||||||
/// Return the count of components of the vector
|
/// Return the count of components of the vector
|
||||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||||
#endif//GLM_FORCE_SIZE_FUNC
|
# endif//GLM_FORCE_SIZE_FUNC
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Data
|
// Data
|
||||||
|
|
||||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
# if GLM_HAS_ANONYMOUS_UNION
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct{ T x, y; };
|
struct{ T x, y; };
|
||||||
struct{ T r, g; };
|
struct{ T r, g; };
|
||||||
struct{ T s, t; };
|
struct{ T s, t; };
|
||||||
|
|
||||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
|
# ifdef GLM_SWIZZLE
|
||||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
|
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
|
||||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
|
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
|
||||||
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y)
|
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
|
||||||
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
|
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y)
|
||||||
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
|
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
|
||||||
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y)
|
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
|
||||||
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
|
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y)
|
||||||
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
|
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
|
||||||
|
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
|
||||||
|
# endif//GLM_SWIZZLE
|
||||||
};
|
};
|
||||||
# else
|
# else
|
||||||
union {T x, r, s;};
|
union {T x, r, s;};
|
||||||
@ -91,7 +93,7 @@ namespace glm
|
|||||||
|
|
||||||
# ifdef GLM_SWIZZLE
|
# ifdef GLM_SWIZZLE
|
||||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, tvec2, tvec2, tvec3, tvec4)
|
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, tvec2, tvec2, tvec3, tvec4)
|
||||||
# endif
|
# endif//GLM_SWIZZLE
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
@ -57,33 +57,35 @@ namespace glm
|
|||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Helper
|
// Helper
|
||||||
|
|
||||||
#if GLM_FORCE_SIZE_FUNC
|
# if GLM_FORCE_SIZE_FUNC
|
||||||
/// Return the count of components of the vector
|
/// Return the count of components of the vector
|
||||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||||
#else
|
# else
|
||||||
/// Return the count of components of the vector
|
/// Return the count of components of the vector
|
||||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||||
#endif//GLM_FORCE_SIZE_FUNC
|
# endif//GLM_FORCE_SIZE_FUNC
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Data
|
// Data
|
||||||
|
|
||||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
# if GLM_HAS_ANONYMOUS_UNION
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct{ T x, y, z; };
|
struct{ T x, y, z; };
|
||||||
struct{ T r, g, b; };
|
struct{ T r, g, b; };
|
||||||
struct{ T s, t, p; };
|
struct{ T s, t, p; };
|
||||||
|
|
||||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
|
# ifdef GLM_SWIZZLE
|
||||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
|
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
|
||||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
|
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
|
||||||
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
|
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
|
||||||
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
|
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
|
||||||
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
|
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
|
||||||
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
|
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
|
||||||
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
|
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
|
||||||
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
|
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
|
||||||
|
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
|
||||||
|
# endif//GLM_SWIZZLE
|
||||||
};
|
};
|
||||||
# else
|
# else
|
||||||
union { T x, r, s; };
|
union { T x, r, s; };
|
||||||
@ -92,7 +94,7 @@ namespace glm
|
|||||||
|
|
||||||
# ifdef GLM_SWIZZLE
|
# ifdef GLM_SWIZZLE
|
||||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, tvec3, tvec2, tvec3, tvec4)
|
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, tvec3, tvec2, tvec3, tvec4)
|
||||||
# endif
|
# endif//GLM_SWIZZLE
|
||||||
# endif//GLM_LANG
|
# endif//GLM_LANG
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
@ -80,18 +80,18 @@ namespace glm
|
|||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Helper
|
// Helper
|
||||||
|
|
||||||
#if GLM_FORCE_SIZE_FUNC
|
# if GLM_FORCE_SIZE_FUNC
|
||||||
/// Return the count of components of the vector
|
/// Return the count of components of the vector
|
||||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||||
#else
|
# else
|
||||||
/// Return the count of components of the vector
|
/// Return the count of components of the vector
|
||||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||||
#endif//GLM_FORCE_SIZE_FUNC
|
# endif//GLM_FORCE_SIZE_FUNC
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Data
|
// Data
|
||||||
|
|
||||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
# if GLM_HAS_ANONYMOUS_UNION
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
typename simd<T>::type data;
|
typename simd<T>::type data;
|
||||||
@ -99,18 +99,20 @@ namespace glm
|
|||||||
struct { T s, t, p, q; };
|
struct { T s, t, p, q; };
|
||||||
struct { T x, y, z, w;};
|
struct { T x, y, z, w;};
|
||||||
|
|
||||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)
|
# ifdef GLM_SWIZZLE
|
||||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a)
|
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)
|
||||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, s, t, p, q)
|
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a)
|
||||||
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, x, y, z, w)
|
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, s, t, p, q)
|
||||||
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, r, g, b, a)
|
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, x, y, z, w)
|
||||||
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, s, t, p, q)
|
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, r, g, b, a)
|
||||||
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, x, y, z, w)
|
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, s, t, p, q)
|
||||||
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, r, g, b, a)
|
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, x, y, z, w)
|
||||||
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q)
|
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, r, g, b, a)
|
||||||
|
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q)
|
||||||
|
# endif//GLM_SWIZZLE
|
||||||
};
|
};
|
||||||
# else
|
# else
|
||||||
# if(GLM_HAS_UNRESTRICTED_UNIONS)
|
# if GLM_HAS_UNRESTRICTED_UNIONS
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
typename simd<T>::type data;
|
typename simd<T>::type data;
|
||||||
@ -131,7 +133,7 @@ namespace glm
|
|||||||
|
|
||||||
# ifdef GLM_SWIZZLE
|
# ifdef GLM_SWIZZLE
|
||||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, tvec4, tvec2, tvec3, tvec4)
|
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, tvec4, tvec2, tvec3, tvec4)
|
||||||
# endif
|
# endif//GLM_SWIZZLE
|
||||||
# endif//GLM_LANG
|
# endif//GLM_LANG
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user