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