38 #ifndef GLM_GTX_simd_vec4
39 #define GLM_GTX_simd_vec4
44 #if(GLM_ARCH != GLM_ARCH_PURE)
46 #if(GLM_ARCH & GLM_ARCH_SSE2)
47 # include "../detail/intrinsic_common.hpp"
48 # include "../detail/intrinsic_geometric.hpp"
49 # include "../detail/intrinsic_integer.hpp"
51 # error "GLM: GLM_GTX_simd_vec4 requires compiler support of SSE2 through intrinsics"
54 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
55 # pragma message("GLM: GLM_GTX_simd_vec4 extension included")
60 #if (GLM_COMPILER & GLM_COMPILER_VC)
61 # pragma warning(push)
62 # pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
90 GLM_ALIGNED_STRUCT(16) fvec4SIMD
93 typedef __m128 value_type;
94 typedef std::size_t size_type;
95 static size_type value_size();
97 typedef fvec4SIMD type;
98 typedef tvec4<bool, highp> bool_type;
100 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
104 struct {
float x, y, z, w;};
114 fvec4SIMD(__m128
const & Data);
115 fvec4SIMD(fvec4SIMD
const & v);
135 fvec4SIMD(
vec2 const & v,
float const & s1,
float const & s2);
136 fvec4SIMD(
float const & s1,
vec2 const & v,
float const & s2);
137 fvec4SIMD(
float const & s1,
float const & s2,
vec2 const & v);
138 fvec4SIMD(
vec3 const & v,
float const & s);
139 fvec4SIMD(
float const & s,
vec3 const & v);
140 fvec4SIMD(
vec2 const & v1,
vec2 const & v2);
146 fvec4SIMD& operator= (fvec4SIMD
const & v);
147 fvec4SIMD& operator+=(fvec4SIMD
const & v);
148 fvec4SIMD& operator-=(fvec4SIMD
const & v);
149 fvec4SIMD& operator*=(fvec4SIMD
const & v);
150 fvec4SIMD& operator/=(fvec4SIMD
const & v);
152 fvec4SIMD& operator+=(
float const & s);
153 fvec4SIMD& operator-=(
float const & s);
154 fvec4SIMD& operator*=(
float const & s);
155 fvec4SIMD& operator/=(
float const & s);
157 fvec4SIMD& operator++();
158 fvec4SIMD& operator--();
163 template <comp X, comp Y, comp Z, comp W>
164 fvec4SIMD& swizzle();
165 template <comp X, comp Y, comp Z, comp W>
166 fvec4SIMD swizzle()
const;
167 template <comp X, comp Y, comp Z>
168 fvec4SIMD swizzle()
const;
169 template <comp X, comp Y>
170 fvec4SIMD swizzle()
const;
172 fvec4SIMD swizzle()
const;
176 typedef glm::detail::fvec4SIMD simdVec4;
184 detail::fvec4SIMD
const & x);
188 detail::fvec4SIMD
abs(detail::fvec4SIMD
const & x);
192 detail::fvec4SIMD
sign(detail::fvec4SIMD
const & x);
196 detail::fvec4SIMD
floor(detail::fvec4SIMD
const & x);
201 detail::fvec4SIMD
trunc(detail::fvec4SIMD
const & x);
210 detail::fvec4SIMD
round(detail::fvec4SIMD
const & x);
222 detail::fvec4SIMD
ceil(detail::fvec4SIMD
const & x);
227 detail::fvec4SIMD
fract(detail::fvec4SIMD
const & x);
233 detail::fvec4SIMD
mod(
234 detail::fvec4SIMD
const & x,
235 detail::fvec4SIMD
const & y);
241 detail::fvec4SIMD
mod(
242 detail::fvec4SIMD
const & x,
257 detail::fvec4SIMD
min(
258 detail::fvec4SIMD
const & x,
259 detail::fvec4SIMD
const & y);
261 detail::fvec4SIMD
min(
262 detail::fvec4SIMD
const & x,
268 detail::fvec4SIMD
max(
269 detail::fvec4SIMD
const & x,
270 detail::fvec4SIMD
const & y);
272 detail::fvec4SIMD
max(
273 detail::fvec4SIMD
const & x,
280 detail::fvec4SIMD
clamp(
281 detail::fvec4SIMD
const & x,
282 detail::fvec4SIMD
const & minVal,
283 detail::fvec4SIMD
const & maxVal);
285 detail::fvec4SIMD
clamp(
286 detail::fvec4SIMD
const & x,
287 float const & minVal,
288 float const & maxVal);
316 detail::fvec4SIMD
mix(
317 detail::fvec4SIMD
const & x,
318 detail::fvec4SIMD
const & y,
319 detail::fvec4SIMD
const & a);
324 detail::fvec4SIMD
step(
325 detail::fvec4SIMD
const & edge,
326 detail::fvec4SIMD
const & x);
328 detail::fvec4SIMD
step(
330 detail::fvec4SIMD
const & x);
344 detail::fvec4SIMD
const & edge0,
345 detail::fvec4SIMD
const & edge1,
346 detail::fvec4SIMD
const & x);
351 detail::fvec4SIMD
const & x);
390 detail::fvec4SIMD
fma(
391 detail::fvec4SIMD
const & a,
392 detail::fvec4SIMD
const & b,
393 detail::fvec4SIMD
const & c);
420 detail::fvec4SIMD
const & x);
427 detail::fvec4SIMD
const & x);
434 detail::fvec4SIMD
const & x);
439 detail::fvec4SIMD length4(
440 detail::fvec4SIMD
const & x);
446 detail::fvec4SIMD fastLength4(
447 detail::fvec4SIMD
const & x);
453 detail::fvec4SIMD niceLength4(
454 detail::fvec4SIMD
const & x);
460 detail::fvec4SIMD
const & p0,
461 detail::fvec4SIMD
const & p1);
466 detail::fvec4SIMD distance4(
467 detail::fvec4SIMD
const & p0,
468 detail::fvec4SIMD
const & p1);
474 detail::fvec4SIMD
const & x,
475 detail::fvec4SIMD
const & y);
480 detail::fvec4SIMD dot4(
481 detail::fvec4SIMD
const & x,
482 detail::fvec4SIMD
const & y);
487 detail::fvec4SIMD
cross(
488 detail::fvec4SIMD
const & x,
489 detail::fvec4SIMD
const & y);
495 detail::fvec4SIMD
const & x);
502 detail::fvec4SIMD
const & x);
507 detail::fvec4SIMD simdFaceforward(
508 detail::fvec4SIMD
const & N,
509 detail::fvec4SIMD
const & I,
510 detail::fvec4SIMD
const & Nref);
517 detail::fvec4SIMD
const & I,
518 detail::fvec4SIMD
const & N);
526 detail::fvec4SIMD
const & I,
527 detail::fvec4SIMD
const & N,
533 detail::fvec4SIMD
sqrt(
534 detail::fvec4SIMD
const & x);
540 detail::fvec4SIMD niceSqrt(
541 detail::fvec4SIMD
const & x);
548 detail::fvec4SIMD
const & x);
554 detail::fvec4SIMD
const & x);
560 detail::fvec4SIMD fastInversesqrt(
561 detail::fvec4SIMD
const & x);
566 #include "simd_vec4.inl"
568 #if (GLM_COMPILER & GLM_COMPILER_VC)
569 # pragma warning(pop)
572 #endif//(GLM_ARCH != GLM_ARCH_PURE)
574 #endif//GLM_GTX_simd_vec4
GLM_FUNC_DECL genType sqrt(genType const &x)
Returns the positive square root of x.
highp_vec3 vec3
3 components vector of floating-point numbers.
GLM_FUNC_DECL genType floor(genType const &x)
Returns a value equal to the nearest integer that is less then or equal to x.
GLM_FUNC_DECL detail::tvec3< T, P > cross(detail::tvec3< T, P > const &x, detail::tvec3< T, P > const &y)
Returns the cross product of x and y.
GLM_FUNC_DECL genTypeT mix(genTypeT const &x, genTypeT const &y, genTypeU const &a)
If genTypeU is a floating scalar or vector: Returns x * (1.0 - a) + y * a, i.e., the linear blend of ...
highp_vec4 vec4
4 components vector of floating-point numbers.
genType fastSqrt(genType const &x)
Faster than the common sqrt function but less accurate.
GLM_FUNC_DECL genType mod(genType const &x, genType const &y)
Modulus.
GLM_FUNC_DECL genType inversesqrt(genType const &x)
Returns the reciprocal of the positive square root of x.
GLM_FUNC_DECL genType normalize(genType const &x)
Returns a vector in the same direction as x but with length of 1.
GLM_FUNC_DECL genType fract(genType const &x)
Return x - floor(x).
GLM_FUNC_DECL genType ceil(genType const &x)
Returns a value equal to the nearest integer that is greater than or equal to x.
GLM_FUNC_DECL genType fma(genType const &a, genType const &b, genType const &c)
Computes and returns a * b + c.
genType fastNormalize(genType const &x)
Faster than the common normalize function but less accurate.
GLM_FUNC_DECL genType step(genType const &edge, genType const &x)
Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.
GLM_FUNC_DECL genType trunc(genType const &x)
Returns a value equal to the nearest integer to x whose absolute value is not larger than the absolut...
GLM_FUNC_DECL genType::value_type length(genType const &x)
Returns the length of x, i.e., sqrt(x * x).
GLM_FUNC_DECL genType round(genType const &x)
Returns a value equal to the nearest integer to x.
GLM_FUNC_DECL vecType< T, P > refract(vecType< T, P > const &I, vecType< T, P > const &N, T const &eta)
For the incident vector I and surface normal N, and the ratio of indices of refraction eta...
GLM_FUNC_DECL genType abs(genType const &x)
Returns x if x >= 0; otherwise, it returns -x.
GLM_FUNC_DECL genType smoothstep(genType const &edge0, genType const &edge1, genType const &x)
Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and performs smooth Hermite interpolation between 0 a...
GLM_FUNC_DECL genType clamp(genType const &x, genType const &minVal, genType const &maxVal)
Returns min(max(x, minVal), maxVal) for each component in x using the floating-point values minVal an...
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_FUNC_DECL genType max(genType const &x, genType const &y)
Returns y if x < y; otherwise, it returns x.
GLM_FUNC_DECL genType::value_type distance(genType const &p0, genType const &p1)
Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
GLM_FUNC_DECL genType sign(genType const &x)
Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
genType::value_type fastLength(genType const &x)
Faster than the common length function but less accurate.
GLM_FUNC_DECL genType min(genType const &x, genType const &y)
Returns y if y < x; otherwise, it returns x.
highp_vec2 vec2
2 components vector of floating-point numbers.