mirror of
https://github.com/g-truc/glm.git
synced 2024-11-12 21:31:47 +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
|
struct tvec4
|
||||||
{
|
{
|
||||||
enum ctor{null};
|
enum ctor{null};
|
||||||
|
enum {_size = 4};
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef std::size_t size_type;
|
typedef std::size_t size_type;
|
||||||
static size_type value_size();
|
static size_type value_size();
|
||||||
|
@ -26,9 +26,9 @@ namespace glm
|
|||||||
//! GLM_GTC_swizzle extension
|
//! GLM_GTC_swizzle extension
|
||||||
namespace swizzle{
|
namespace swizzle{
|
||||||
|
|
||||||
template <typename T>
|
template <typename T, template <typename> class vecType>
|
||||||
T swizzle(
|
T swizzle(
|
||||||
detail::tvec4<T> const & v,
|
vecType<T> const & v,
|
||||||
comp x);
|
comp x);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -46,6 +46,21 @@ namespace glm
|
|||||||
detail::tvec4<T> const & v,
|
detail::tvec4<T> const & v,
|
||||||
comp x, comp y, comp z, comp w);
|
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>
|
template <typename T>
|
||||||
detail::tref4<T> swizzle(
|
detail::tref4<T> swizzle(
|
||||||
detail::tvec4<T> & v,
|
detail::tvec4<T> & v,
|
||||||
|
@ -2,13 +2,14 @@ namespace glm{
|
|||||||
namespace gtc{
|
namespace gtc{
|
||||||
namespace swizzle
|
namespace swizzle
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T, template <typename> class vecType>
|
||||||
inline T swizzle
|
inline T swizzle
|
||||||
(
|
(
|
||||||
detail::tvec4<T> const & v,
|
vecType<T> const & v,
|
||||||
comp x
|
comp x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
assert(int(x) < int(typename vecType<T>::_size));
|
||||||
return v[x];
|
return v[x];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user