Added GLM_GTC_swizzle

This commit is contained in:
Christophe Riccio 2010-04-30 09:52:38 +01:00
parent 872f23c5a9
commit d5c4dc0aeb
2 changed files with 17 additions and 27 deletions

View File

@ -24,11 +24,11 @@ namespace glm
namespace gtc{
//! GLM_GTC_swizzle extension
namespace glm_gtc_swizzle{
namespace swizzle{
}//namespace closest_point
}//namespace swizzle
}//namespace gtc
}//namespace glm

View File

@ -3,58 +3,48 @@ namespace gtc{
namespace glm_gtc_swizzle
{
template <typename T>
inline typename tvec4<T>::value_type swizzle
inline T swizzle
(
detail::tvec4<T> const & v,
comp x
) const
)
{
return v[x];
}
template <typename T>
inline tvec2<T> tvec4<T>::swizzle
inline detail::tvec2<T> swizzle
(
detail::tvec4<T> const & v,
comp x, comp y
) const
)
{
return tvec2<T>(
(*this)[x],
(*this)[y]);
return detail::tvec2<T>(
v[x],
v[y]);
}
template <typename T>
inline tvec3<T> tvec4<T>::swizzle
inline detail::tvec3<T> swizzle
(
detail::tvec4<T> const & v,
comp x, comp y, comp z
) const
)
{
return tvec3<T>(
(*this)[x],
(*this)[y],
(*this)[z]);
return detail::tvec3<T>(
v[x],
v[y],
v[z]);
}
template <typename T>
inline tvec4<T> tvec4<T>::swizzle
(
detail::tvec4<T> const & v,
comp x, comp y, comp z, comp w
) const
{
return tvec4<T>(v[x], v[y], v[z], v[w]);
}
template <typename T>
inline tref4<T> swizzle
inline detail::tref4<T> swizzle
(
detail::tvec4<T> const & v,
comp x, comp y, comp z, comp w
)
{
return tref4<T>(v[x], v[y], v[z], v[w]);
return detail::tref4<T>(v[x], v[y], v[z], v[w]);
}
}//namespace glm_gtc_swizzle