mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 12:41:54 +00:00
Updated swizzle implementation
This commit is contained in:
parent
a7c7645c99
commit
866db89305
@ -59,11 +59,6 @@ namespace glm
|
||||
float const & z,
|
||||
float const & w);
|
||||
|
||||
////////////////////////////////////////
|
||||
//// Swizzle constructors
|
||||
|
||||
//fvec4SIMD(ref4<float> const & r);
|
||||
|
||||
////////////////////////////////////////
|
||||
//// Convertion vector constructors
|
||||
|
||||
@ -95,12 +90,16 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
//float swizzle(comp X) const;
|
||||
//vec2 const swizzle(comp X, comp Y) const;
|
||||
//vec3 const swizzle(comp X, comp Y, comp Z) const;
|
||||
//fvec4SIMD const swizzle(comp X, comp Y, comp Z, comp W) const;
|
||||
//fvec4SIMD const swizzle(int X, int Y, int Z, int W) const;
|
||||
//ref4<float> swizzle(comp X, comp Y, comp Z, comp W);
|
||||
template <comp A, comp B, comp C, comp D>
|
||||
fvec4SIMD& swizzle();
|
||||
template <comp A, comp B, comp C, comp D>
|
||||
fvec4SIMD swizzle() const;
|
||||
template <comp A, comp B, comp C>
|
||||
fvec4SIMD swizzle() const;
|
||||
template <comp A, comp B>
|
||||
fvec4SIMD swizzle() const;
|
||||
template <comp A>
|
||||
fvec4SIMD swizzle() const;
|
||||
};
|
||||
|
||||
}//namespace detail
|
||||
@ -109,7 +108,7 @@ namespace glm
|
||||
//! GLM_GTX_simd_vec4 extension: SIMD implementation of vec4 type.
|
||||
namespace simd_vec4
|
||||
{
|
||||
typedef detail::fvec4SIMD vec4SIMD;
|
||||
typedef detail::fvec4SIMD simd_vec4;
|
||||
|
||||
}//namespace simd_vec4
|
||||
}//namespace gtx
|
||||
|
@ -11,8 +11,6 @@ namespace glm
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
//__m128 fvec4SIMD::one = _mm_set_ps1(1.f);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
@ -155,13 +153,21 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
//inline fvec4SIMD const fvec4SIMD::swizzle(int d, int c, int b, int a) const
|
||||
//{
|
||||
// int const Mask = ((d << 6) | (c << 4) | (b << 2) | (a << 0));
|
||||
template <comp a, comp b, comp c, comp d>
|
||||
inline fvec4SIMD fvec4SIMD::swizzle() const
|
||||
{
|
||||
int const Mask = ((int(d) << 6) | (int(c) << 4) | (int(b) << 2) | (int(a) << 0));
|
||||
|
||||
// __m128 Data = _mm_shuffle_ps(this->Data, this->Data, Mask);
|
||||
// return fvec4SIMD(Data);
|
||||
//}
|
||||
__m128 Data = _mm_shuffle_ps(this->Data, this->Data, Mask);
|
||||
return fvec4SIMD(Data);
|
||||
}
|
||||
|
||||
template <comp a, comp b, comp c, comp d>
|
||||
inline fvec4SIMD& fvec4SIMD::swizzle()
|
||||
{
|
||||
this->Data = _mm_shuffle_ps(this->Data, this->Data, (((int(d) << 6) | (int(c) << 4) | (int(b) << 2) | (int(a) << 0))));
|
||||
return *this;
|
||||
}
|
||||
|
||||
// operator+
|
||||
inline fvec4SIMD operator+ (fvec4SIMD const & v, float s)
|
||||
|
Loading…
Reference in New Issue
Block a user