mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 10:14:35 +00:00
Updated swizzle implementation, assert and static_assert draft
This commit is contained in:
parent
21c1fa14a7
commit
e145f7e389
@ -36,6 +36,7 @@ namespace glm
|
||||
struct tvec4
|
||||
{
|
||||
enum ctor{null};
|
||||
enum {_size = 4};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
static size_type value_size();
|
||||
|
@ -26,9 +26,9 @@ namespace glm
|
||||
//! GLM_GTC_swizzle extension
|
||||
namespace swizzle{
|
||||
|
||||
template <typename T>
|
||||
template <typename T, template <typename> class vecType>
|
||||
T swizzle(
|
||||
detail::tvec4<T> const & v,
|
||||
vecType<T> const & v,
|
||||
comp x);
|
||||
|
||||
template <typename T>
|
||||
@ -46,6 +46,21 @@ namespace glm
|
||||
detail::tvec4<T> const & v,
|
||||
comp x, comp y, comp z, comp w);
|
||||
|
||||
template <typename T>
|
||||
T& swizzle(
|
||||
detail::tvec4<T> & v,
|
||||
comp x);
|
||||
|
||||
template <typename T>
|
||||
detail::tref2<T> swizzle(
|
||||
detail::tvec4<T> & v,
|
||||
comp x, comp y);
|
||||
|
||||
template <typename T>
|
||||
detail::tref3<T> swizzle(
|
||||
detail::tvec4<T> & v,
|
||||
comp x, comp y, comp z);
|
||||
|
||||
template <typename T>
|
||||
detail::tref4<T> swizzle(
|
||||
detail::tvec4<T> & v,
|
||||
|
@ -2,13 +2,14 @@ namespace glm{
|
||||
namespace gtc{
|
||||
namespace swizzle
|
||||
{
|
||||
template <typename T>
|
||||
template <typename T, template <typename> class vecType>
|
||||
inline T swizzle
|
||||
(
|
||||
detail::tvec4<T> const & v,
|
||||
vecType<T> const & v,
|
||||
comp x
|
||||
)
|
||||
{
|
||||
assert(int(x) < int(typename vecType<T>::_size));
|
||||
return v[x];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user