Add additional swizzle constructors

This commit is contained in:
Ben
2011-10-05 11:14:59 -07:00
parent 5f287430f4
commit bcc8926ebf
4 changed files with 84 additions and 3 deletions

View File

@@ -158,6 +158,18 @@ namespace detail
*this = that();
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & s)
{
*this = tvec3<T>(v(), s);
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & s, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v)
{
*this = tvec3<T>(s, v());
}
//////////////////////////////////////
// Unary arithmetic operators

View File

@@ -159,6 +159,42 @@ namespace detail
*this = that();
}
template <int E0, int E1, int F0, int F1>
GLM_FUNC_DECL tvec4(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, glm::detail::swizzle<2, T, tvec2<T>, F0, F1, -1, -2> const & u)
{
*this = tvec4<T>(v(), u());
}
template <int E0, int E1>
GLM_FUNC_DECL tvec4(T const & x, T const & y, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v)
{
*this = tvec4<T>(x, y, v());
}
template <int E0, int E1>
GLM_FUNC_DECL tvec4(T const & x, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & w)
{
*this = tvec4<T>(x, v(), w);
}
template <int E0, int E1>
GLM_FUNC_DECL tvec4(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & z, T const & w)
{
*this = tvec4<T>(v(), z, w);
}
template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec4(glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & v, T const & w)
{
*this = tvec4<T>(v(), w);
}
template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec4(T const & x, glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & v)
{
*this = tvec4<T>(x, v());
}
//////////////////////////////////////
// Swizzle constructors