00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef GLM_GTX_simd_vec4
00039 #define GLM_GTX_simd_vec4 50
00040
00041
00042 #include "../glm.hpp"
00043
00044 #if(GLM_ARCH & GLM_ARCH_SSE2)
00045 # include "../core/intrinsic_common.hpp"
00046 # include "../core/intrinsic_geometric.hpp"
00047 #else
00048 # error "GLM: GLM_GTX_simd_vec4 requires compiler support of SSE2 through intrinsics"
00049 #endif
00050
00051 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
00052 # pragma message("GLM: GLM_GTX_simd_vec4 extension included")
00053 #endif
00054
00055 namespace glm{
00056 namespace detail
00057 {
00060 GLM_ALIGNED_STRUCT(16) fvec4SIMD
00061 {
00062 enum ctor{null};
00063 typedef __m128 value_type;
00064 typedef std::size_t size_type;
00065 static size_type value_size();
00066
00067 typedef fvec4SIMD type;
00068 typedef tvec4<bool> bool_type;
00069
00070 __m128 Data;
00071
00073
00074
00075 fvec4SIMD();
00076 fvec4SIMD(__m128 const & Data);
00077 fvec4SIMD(fvec4SIMD const & v);
00078
00080
00081
00082 explicit fvec4SIMD(
00083 ctor);
00084 explicit fvec4SIMD(
00085 float const & s);
00086 explicit fvec4SIMD(
00087 float const & x,
00088 float const & y,
00089 float const & z,
00090 float const & w);
00091 explicit fvec4SIMD(
00092 tvec4<float> const & v);
00093
00096
00097 fvec4SIMD(vec2 const & v, float const & s1, float const & s2);
00098 fvec4SIMD(float const & s1, vec2 const & v, float const & s2);
00099 fvec4SIMD(float const & s1, float const & s2, vec2 const & v);
00100 fvec4SIMD(vec3 const & v, float const & s);
00101 fvec4SIMD(float const & s, vec3 const & v);
00102 fvec4SIMD(vec2 const & v1, vec2 const & v2);
00103
00104
00106
00107
00108 fvec4SIMD& operator= (fvec4SIMD const & v);
00109 fvec4SIMD& operator+=(fvec4SIMD const & v);
00110 fvec4SIMD& operator-=(fvec4SIMD const & v);
00111 fvec4SIMD& operator*=(fvec4SIMD const & v);
00112 fvec4SIMD& operator/=(fvec4SIMD const & v);
00113
00114 fvec4SIMD& operator+=(float const & s);
00115 fvec4SIMD& operator-=(float const & s);
00116 fvec4SIMD& operator*=(float const & s);
00117 fvec4SIMD& operator/=(float const & s);
00118
00119 fvec4SIMD& operator++();
00120 fvec4SIMD& operator--();
00121
00123
00124
00125 template <comp X, comp Y, comp Z, comp W>
00126 fvec4SIMD& swizzle();
00127 template <comp X, comp Y, comp Z, comp W>
00128 fvec4SIMD swizzle() const;
00129 template <comp X, comp Y, comp Z>
00130 fvec4SIMD swizzle() const;
00131 template <comp X, comp Y>
00132 fvec4SIMD swizzle() const;
00133 template <comp X>
00134 fvec4SIMD swizzle() const;
00135 };
00136 }
00137
00138 typedef glm::detail::fvec4SIMD simdVec4;
00139
00142
00145 detail::tvec4<float> vec4_cast(
00146 detail::fvec4SIMD const & x);
00147
00150 detail::fvec4SIMD abs(detail::fvec4SIMD const & x);
00151
00154 detail::fvec4SIMD sign(detail::fvec4SIMD const & x);
00155
00158 detail::fvec4SIMD floor(detail::fvec4SIMD const & x);
00159
00163 detail::fvec4SIMD trunc(detail::fvec4SIMD const & x);
00164
00171 detail::fvec4SIMD round(detail::fvec4SIMD const & x);
00172
00177
00178
00182 detail::fvec4SIMD ceil(detail::fvec4SIMD const & x);
00183
00186 detail::fvec4SIMD fract(detail::fvec4SIMD const & x);
00187
00191 detail::fvec4SIMD mod(
00192 detail::fvec4SIMD const & x,
00193 detail::fvec4SIMD const & y);
00194
00198 detail::fvec4SIMD mod(
00199 detail::fvec4SIMD const & x,
00200 float const & y);
00201
00207
00208
00209
00210
00213 detail::fvec4SIMD min(
00214 detail::fvec4SIMD const & x,
00215 detail::fvec4SIMD const & y);
00216
00217 detail::fvec4SIMD min(
00218 detail::fvec4SIMD const & x,
00219 float const & y);
00220
00223 detail::fvec4SIMD max(
00224 detail::fvec4SIMD const & x,
00225 detail::fvec4SIMD const & y);
00226
00227 detail::fvec4SIMD max(
00228 detail::fvec4SIMD const & x,
00229 float const & y);
00230
00234 detail::fvec4SIMD clamp(
00235 detail::fvec4SIMD const & x,
00236 detail::fvec4SIMD const & minVal,
00237 detail::fvec4SIMD const & maxVal);
00238
00239 detail::fvec4SIMD clamp(
00240 detail::fvec4SIMD const & x,
00241 float const & minVal,
00242 float const & maxVal);
00243
00267
00269 detail::fvec4SIMD mix(
00270 detail::fvec4SIMD const & x,
00271 detail::fvec4SIMD const & y,
00272 detail::fvec4SIMD const & a);
00273
00276 detail::fvec4SIMD step(
00277 detail::fvec4SIMD const & edge,
00278 detail::fvec4SIMD const & x);
00279
00280 detail::fvec4SIMD step(
00281 float const & edge,
00282 detail::fvec4SIMD const & x);
00283
00294 detail::fvec4SIMD smoothstep(
00295 detail::fvec4SIMD const & edge0,
00296 detail::fvec4SIMD const & edge1,
00297 detail::fvec4SIMD const & x);
00298
00299 detail::fvec4SIMD smoothstep(
00300 float const & edge0,
00301 float const & edge1,
00302 detail::fvec4SIMD const & x);
00303
00310
00311
00318
00319
00324
00325
00332
00333
00336 detail::fvec4SIMD fma(
00337 detail::fvec4SIMD const & a,
00338 detail::fvec4SIMD const & b,
00339 detail::fvec4SIMD const & c);
00340
00350
00351
00358
00359
00362 float length(
00363 detail::fvec4SIMD const & x);
00364
00368 float fastLength(
00369 detail::fvec4SIMD const & x);
00370
00374 float niceLength(
00375 detail::fvec4SIMD const & x);
00376
00379 detail::fvec4SIMD length4(
00380 detail::fvec4SIMD const & x);
00381
00385 detail::fvec4SIMD fastLength4(
00386 detail::fvec4SIMD const & x);
00387
00391 detail::fvec4SIMD niceLength4(
00392 detail::fvec4SIMD const & x);
00393
00396 float distance(
00397 detail::fvec4SIMD const & p0,
00398 detail::fvec4SIMD const & p1);
00399
00402 detail::fvec4SIMD distance4(
00403 detail::fvec4SIMD const & p0,
00404 detail::fvec4SIMD const & p1);
00405
00408 float simdDot(
00409 detail::fvec4SIMD const & x,
00410 detail::fvec4SIMD const & y);
00411
00414 detail::fvec4SIMD dot4(
00415 detail::fvec4SIMD const & x,
00416 detail::fvec4SIMD const & y);
00417
00420 detail::fvec4SIMD cross(
00421 detail::fvec4SIMD const & x,
00422 detail::fvec4SIMD const & y);
00423
00426 detail::fvec4SIMD normalize(
00427 detail::fvec4SIMD const & x);
00428
00432 detail::fvec4SIMD fastNormalize(
00433 detail::fvec4SIMD const & x);
00434
00437 detail::fvec4SIMD simdFaceforward(
00438 detail::fvec4SIMD const & N,
00439 detail::fvec4SIMD const & I,
00440 detail::fvec4SIMD const & Nref);
00441
00445 detail::fvec4SIMD reflect(
00446 detail::fvec4SIMD const & I,
00447 detail::fvec4SIMD const & N);
00448
00453 detail::fvec4SIMD refract(
00454 detail::fvec4SIMD const & I,
00455 detail::fvec4SIMD const & N,
00456 float const & eta);
00457
00460 detail::fvec4SIMD sqrt(
00461 detail::fvec4SIMD const & x);
00462
00466 detail::fvec4SIMD niceSqrt(
00467 detail::fvec4SIMD const & x);
00468
00472 detail::fvec4SIMD fastSqrt(
00473 detail::fvec4SIMD const & x);
00474
00477 detail::fvec4SIMD inversesqrt(
00478 detail::fvec4SIMD const & x);
00479
00483 detail::fvec4SIMD fastInversesqrt(
00484 detail::fvec4SIMD const & x);
00485
00487 }
00488
00489 #include "simd_vec4.inl"
00490
00491 #endif//GLM_GTX_simd_vec4