Added swizzle contructor tests

This commit is contained in:
Christophe Riccio
2014-08-03 23:40:45 +02:00
parent a0743f94aa
commit fa6bec2f3d
6 changed files with 95 additions and 32 deletions

View File

@@ -115,7 +115,7 @@ namespace detail
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
template <int E0, int E1>
GLM_FUNC_DECL tvec2(_swizzle<2,T, P, tvec2<T, P>, E0, E1,-1,-2> const & that)
GLM_FUNC_DECL tvec2(_swizzle<2, T, P, tvec2<T, P>, E0, E1,-1,-2> const & that)
{
*this = that();
}

View File

@@ -104,17 +104,35 @@ namespace detail
template <precision Q>
GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v);
//////////////////////////////////////
// Swizzle constructors
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec3(_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & that)
{
*this = that();
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & s)
{
*this = tvec3<T, P>(v(), s);
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & s, _swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
{
*this = tvec3<T, P>(s, v());
}
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
//////////////////////////////////////
// Explicit basic constructors
GLM_FUNC_DECL explicit tvec3(
ctor);
GLM_FUNC_DECL explicit tvec3(
T const & s);
GLM_FUNC_DECL tvec3(
T const & s1,
T const & s2,
T const & s3);
GLM_FUNC_DECL explicit tvec3(ctor);
GLM_FUNC_DECL explicit tvec3(T const & s);
GLM_FUNC_DECL tvec3(T const & s1, T const & s2, T const & s3);
//////////////////////////////////////
// Conversion scalar constructors
@@ -142,29 +160,6 @@ namespace detail
template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v);
//////////////////////////////////////
// Swizzle constructors
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec3(_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & that)
{
*this = that();
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & s)
{
*this = tvec3<T, P>(v(), s);
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & s, _swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
{
*this = tvec3<T, P>(s, v());
}
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
//////////////////////////////////////
// Unary arithmetic operators