simd_vec4.hpp
Go to the documentation of this file.
#pragma once
// Dependency:
#include "../glm.hpp"
#if(GLM_ARCH != GLM_ARCH_PURE)
#if(GLM_ARCH & GLM_ARCH_SSE2_BIT)
# include "../detail/intrinsic_common.hpp"
# include "../detail/intrinsic_geometric.hpp"
# include "../detail/intrinsic_integer.hpp"
#else
# error "GLM: GLM_GTX_simd_vec4 requires compiler support of SSE2 through intrinsics"
#endif
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTX_simd_vec4 extension included")
# pragma message("GLM: GLM_GTX_simd_vec4 extension is deprecated and will be removed in GLM 0.9.9. Use *vec4 types instead and use compiler SIMD arguments.")
#endif
// Warning silencer for nameless struct/union.
#if (GLM_COMPILER & GLM_COMPILER_VC)
# pragma warning(push)
# pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
#endif
namespace glm
{
enum comp
{
X = 0,
R = 0,
S = 0,
Y = 1,
G = 1,
T = 1,
Z = 2,
B = 2,
P = 2,
W = 3,
A = 3,
Q = 3
};
}//namespace glm
namespace glm{
namespace detail
{
GLM_ALIGNED_STRUCT(16) fvec4SIMD
{
typedef float value_type;
typedef std::size_t size_type;
typedef fvec4SIMD type;
typedef tvec4<float, defaultp> pure_type;
typedef tvec4<bool, highp> bool_type;
#ifdef GLM_SIMD_ENABLE_XYZW_UNION
union
{
__m128 Data;
struct {float x, y, z, w;};
};
#else
__m128 Data;
#endif
// Implicit basic constructors
fvec4SIMD() GLM_DEFAULT_CTOR;
fvec4SIMD(fvec4SIMD const & v) GLM_DEFAULT;
fvec4SIMD(__m128 const & Data);
// Explicit basic constructors
explicit fvec4SIMD(
ctor);
explicit fvec4SIMD(
float const & s);
explicit fvec4SIMD(
float const & x,
float const & y,
float const & z,
float const & w);
explicit fvec4SIMD(
vec4 const & v);
fvec4SIMD(vec2 const & v, float const & s1, float const & s2);
fvec4SIMD(float const & s1, vec2 const & v, float const & s2);
fvec4SIMD(float const & s1, float const & s2, vec2 const & v);
fvec4SIMD(vec3 const & v, float const & s);
fvec4SIMD(float const & s, vec3 const & v);
fvec4SIMD(vec2 const & v1, vec2 const & v2);
//fvec4SIMD(ivec4SIMD const & v);
// Unary arithmetic operators
fvec4SIMD& operator= (fvec4SIMD const & v) GLM_DEFAULT;
fvec4SIMD& operator+=(fvec4SIMD const & v);
fvec4SIMD& operator-=(fvec4SIMD const & v);
fvec4SIMD& operator*=(fvec4SIMD const & v);
fvec4SIMD& operator/=(fvec4SIMD const & v);
fvec4SIMD& operator+=(float const & s);
fvec4SIMD& operator-=(float const & s);
fvec4SIMD& operator*=(float const & s);
fvec4SIMD& operator/=(float const & s);
fvec4SIMD& operator++();
fvec4SIMD& operator--();
// Swizzle operators
template <comp X_, comp Y_, comp Z_, comp W_>
fvec4SIMD& swizzle();
template <comp X_, comp Y_, comp Z_, comp W_>
fvec4SIMD swizzle() const;
template <comp X_, comp Y_, comp Z_>
fvec4SIMD swizzle() const;
template <comp X_, comp Y_>
fvec4SIMD swizzle() const;
template <comp X_>
fvec4SIMD swizzle() const;
};
}//namespace detail
typedef glm::detail::fvec4SIMD simdVec4;
vec4 vec4_cast(
detail::fvec4SIMD const & x);
detail::fvec4SIMD abs(detail::fvec4SIMD const & x);
detail::fvec4SIMD sign(detail::fvec4SIMD const & x);
detail::fvec4SIMD floor(detail::fvec4SIMD const & x);
detail::fvec4SIMD trunc(detail::fvec4SIMD const & x);
detail::fvec4SIMD round(detail::fvec4SIMD const & x);
//detail::fvec4SIMD roundEven(detail::fvec4SIMD const & x);
detail::fvec4SIMD ceil(detail::fvec4SIMD const & x);
detail::fvec4SIMD fract(detail::fvec4SIMD const & x);
detail::fvec4SIMD mod(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y);
detail::fvec4SIMD mod(
detail::fvec4SIMD const & x,
float const & y);
//detail::fvec4SIMD modf(
// detail::fvec4SIMD const & x,
// detail::fvec4SIMD & i);
detail::fvec4SIMD min(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y);
detail::fvec4SIMD min(
detail::fvec4SIMD const & x,
float const & y);
detail::fvec4SIMD max(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y);
detail::fvec4SIMD max(
detail::fvec4SIMD const & x,
float const & y);
detail::fvec4SIMD clamp(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & minVal,
detail::fvec4SIMD const & maxVal);
detail::fvec4SIMD clamp(
detail::fvec4SIMD const & x,
float const & minVal,
float const & maxVal);
detail::fvec4SIMD mix(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y,
detail::fvec4SIMD const & a);
detail::fvec4SIMD step(
detail::fvec4SIMD const & edge,
detail::fvec4SIMD const & x);
detail::fvec4SIMD step(
float const & edge,
detail::fvec4SIMD const & x);
detail::fvec4SIMD smoothstep(
detail::fvec4SIMD const & edge0,
detail::fvec4SIMD const & edge1,
detail::fvec4SIMD const & x);
detail::fvec4SIMD smoothstep(
float const & edge0,
float const & edge1,
detail::fvec4SIMD const & x);
//bvec4 isnan(detail::fvec4SIMD const & x);
//bvec4 isinf(detail::fvec4SIMD const & x);
//detail::ivec4SIMD floatBitsToInt(detail::fvec4SIMD const & value);
//detail::fvec4SIMD intBitsToFloat(detail::ivec4SIMD const & value);
detail::fvec4SIMD fma(
detail::fvec4SIMD const & a,
detail::fvec4SIMD const & b,
detail::fvec4SIMD const & c);
//detail::fvec4SIMD frexp(detail::fvec4SIMD const & x, detail::ivec4SIMD & exp);
//detail::fvec4SIMD ldexp(detail::fvec4SIMD const & x, detail::ivec4SIMD const & exp);
float length(
detail::fvec4SIMD const & x);
float fastLength(
detail::fvec4SIMD const & x);
float niceLength(
detail::fvec4SIMD const & x);
detail::fvec4SIMD length4(
detail::fvec4SIMD const & x);
detail::fvec4SIMD fastLength4(
detail::fvec4SIMD const & x);
detail::fvec4SIMD niceLength4(
detail::fvec4SIMD const & x);
float distance(
detail::fvec4SIMD const & p0,
detail::fvec4SIMD const & p1);
detail::fvec4SIMD distance4(
detail::fvec4SIMD const & p0,
detail::fvec4SIMD const & p1);
float simdDot(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y);
detail::fvec4SIMD dot4(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y);
detail::fvec4SIMD cross(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y);
detail::fvec4SIMD normalize(
detail::fvec4SIMD const & x);
detail::fvec4SIMD fastNormalize(
detail::fvec4SIMD const & x);
detail::fvec4SIMD simdFaceforward(
detail::fvec4SIMD const & N,
detail::fvec4SIMD const & I,
detail::fvec4SIMD const & Nref);
detail::fvec4SIMD reflect(
detail::fvec4SIMD const & I,
detail::fvec4SIMD const & N);
detail::fvec4SIMD refract(
detail::fvec4SIMD const & I,
detail::fvec4SIMD const & N,
float const & eta);
detail::fvec4SIMD sqrt(
detail::fvec4SIMD const & x);
detail::fvec4SIMD niceSqrt(
detail::fvec4SIMD const & x);
detail::fvec4SIMD fastSqrt(
detail::fvec4SIMD const & x);
detail::fvec4SIMD inversesqrt(
detail::fvec4SIMD const & x);
detail::fvec4SIMD fastInversesqrt(
detail::fvec4SIMD const & x);
}//namespace glm
#include "simd_vec4.inl"
#if (GLM_COMPILER & GLM_COMPILER_VC)
# pragma warning(pop)
#endif
#endif//(GLM_ARCH != GLM_ARCH_PURE)
glm::fract
GLM_FUNC_DECL genType fract(genType x)
Return x - floor(x).
glm::ceil
GLM_FUNC_DECL vecType< T, P > ceil(vecType< T, P > const &x)
Returns a value equal to the nearest integer that is greater than or equal to x.
glm::fastNormalize
GLM_FUNC_DECL genType fastNormalize(genType const &x)
Faster than the common normalize function but less accurate.
glm::fastSqrt
GLM_FUNC_DECL genType fastSqrt(genType x)
Faster than the common sqrt function but less accurate.
glm::vec4
highp_vec4 vec4
4 components vector of floating-point numbers.
Definition: type_vec.hpp:466
glm::smoothstep
GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x)
Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and performs smooth Hermite interpolation between 0 a...
glm::max
GLM_FUNC_DECL genType max(genType x, genType y)
Returns y if x < y; otherwise, it returns x.
glm
Definition: _noise.hpp:11
glm::mod
GLM_FUNC_DECL genType mod(genType x, genType y)
Modulus.
glm::round
GLM_FUNC_DECL vecType< T, P > round(vecType< T, P > const &x)
Returns a value equal to the nearest integer to x.
glm::mix
GLM_FUNC_DECL vecType< T, P > mix(vecType< T, P > const &x, vecType< T, P > const &y, vecType< U, P > const &a)
If genTypeU is a floating scalar or vector: Returns x * (1.0 - a) + y * a, i.e., the linear blend of ...
glm::trunc
GLM_FUNC_DECL vecType< T, P > trunc(vecType< T, P > const &x)
Returns a value equal to the nearest integer to x whose absolute value is not larger than the absolut...
glm::abs
GLM_FUNC_DECL genType abs(genType x)
Returns x if x >= 0; otherwise, it returns -x.
glm::cross
GLM_FUNC_DECL tvec3< T, P > cross(tvec3< T, P > const &x, tvec3< T, P > const &y)
Returns the cross product of x and y.
glm::reflect
GLM_FUNC_DECL genType reflect(genType const &I, genType const &N)
For the incident vector I and surface orientation N, returns the reflection direction : result = I - ...
glm::sqrt
GLM_FUNC_DECL vecType< T, P > sqrt(vecType< T, P > const &v)
Returns the positive square root of v.
glm::normalize
GLM_FUNC_DECL vecType< T, P > normalize(vecType< T, P > const &x)
Returns a vector in the same direction as x but with length of 1.
glm::step
GLM_FUNC_DECL genType step(genType edge, genType x)
Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.
glm::distance
GLM_FUNC_DECL T distance(vecType< T, P > const &p0, vecType< T, P > const &p1)
Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
glm::length
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
glm::refract
GLM_FUNC_DECL vecType< T, P > refract(vecType< T, P > const &I, vecType< T, P > const &N, T eta)
For the incident vector I and surface normal N, and the ratio of indices of refraction eta...
glm::min
GLM_FUNC_DECL genType min(genType x, genType y)
Returns y if y < x; otherwise, it returns x.
glm::vec3
highp_vec3 vec3
3 components vector of floating-point numbers.
Definition: type_vec.hpp:461
glm::fma
GLM_FUNC_DECL genType fma(genType const &a, genType const &b, genType const &c)
Computes and returns a * b + c.
glm::vec2
highp_vec2 vec2
2 components vector of floating-point numbers.
Definition: type_vec.hpp:456
glm::floor
GLM_FUNC_DECL vecType< T, P > floor(vecType< T, P > const &x)
Returns a value equal to the nearest integer that is less then or equal to x.
glm::inversesqrt
GLM_FUNC_DECL vecType< T, P > inversesqrt(vecType< T, P > const &v)
Returns the reciprocal of the positive square root of v.
glm::fastLength
GLM_FUNC_DECL genType fastLength(genType x)
Faster than the common length function but less accurate.
glm::clamp
GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal)
Returns min(max(x, minVal), maxVal) for each component in x using the floating-point values minVal an...
glm::sign
GLM_FUNC_DECL vecType< T, P > sign(vecType< T, P > const &x)
Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.