21#define mm_ror_ps(vec,i) \
22 (((i)%4) ? (_mm_shuffle_ps(vec,vec, _MM_SHUFFLE((unsigned char)(i+3)%4,(unsigned char)(i+2)%4,(unsigned char)(i+1)%4,(unsigned char)(i+0)%4))) : (vec))
30static const __m128i
maskX = _mm_setr_epi32( -1,0,0,0 );
31static const __m128i
maskY = _mm_setr_epi32( 0,-1,0,0 );
32static const __m128i
maskZ = _mm_setr_epi32( 0,0,-1,0 );
33static const __m128i
maskW = _mm_setr_epi32( 0,0,0,-1 );
57 float m00,
float m01,
float m02,
float m03,
58 float m10,
float m11,
float m12,
float m13,
59 float m20,
float m21,
float m22,
float m23,
60 float m30,
float m31,
float m32,
float m33);
68 void load(
const scalar* ptr);
70 void loadu(
const scalar* ptr);
72 void store(
scalar* ptr)
const;
74 void store3(
scalar* ptr)
const;
76 void storeu(
scalar* ptr)
const;
78 void stream(
scalar* ptr)
const;
84 float m00,
float m01,
float m02,
float m03,
85 float m10,
float m11,
float m12,
float m13,
86 float m20,
float m21,
float m22,
float m23,
87 float m30,
float m31,
float m32,
float m33);
90 void get_scale(
vec4& scale)
const;
92 void translate(
const vec3& t);
94 void translate(
const float x,
const float y,
const float z);
104 void scale(
const vec3& v);
106 void scale(
const float x,
const float y,
const float z);
168mat4::mat4(
float m00,
float m01,
float m02,
float m03,
float m10,
float m11,
float m12,
float m13,
float m20,
float m21,
float m22,
float m23,
float m30,
float m31,
float m32,
float m33)
170 this->
r[0] =
vec4(m00, m01, m02, m03);
171 this->
r[1] =
vec4(m10, m11, m12, m13);
172 this->
r[2] =
vec4(m20, m21, m22, m23);
173 this->
r[3] =
vec4(m30, m31, m32, m33);
194 return !(*
this == rhs);
203 r[0] = _mm_load_ps(ptr);
204 r[1] = _mm_load_ps(ptr + 4);
205 r[2] = _mm_load_ps(ptr + 8);
206 r[3] = _mm_load_ps(ptr + 12);
215 r[0] = _mm_loadu_ps(ptr);
216 r[1] = _mm_loadu_ps(ptr + 4);
217 r[2] = _mm_loadu_ps(ptr + 8);
218 r[3] = _mm_loadu_ps(ptr + 12);
227 _mm_store_ps(ptr,
r[0].vec);
228 _mm_store_ps((ptr + 4),
r[1].vec);
229 _mm_store_ps((ptr + 8),
r[2].vec);
230 _mm_store_ps((ptr + 12),
r[3].vec);
239 _mm_store_ps(ptr,
r[0].vec);
240 _mm_store_ps((ptr + 4),
r[1].vec);
241 _mm_store_ps((ptr + 8),
r[2].vec);
250 _mm_storeu_ps(ptr,
r[0].vec);
251 _mm_storeu_ps((ptr + 4),
r[1].vec);
252 _mm_storeu_ps((ptr + 8),
r[2].vec);
253 _mm_storeu_ps((ptr + 12),
r[3].vec);
282mat4::set(
float m00,
float m01,
float m02,
float m03,
float m10,
float m11,
float m12,
float m13,
float m20,
float m21,
float m22,
float m23,
float m30,
float m31,
float m32,
float m33)
284 this->
r[0] =
vec4(m00, m01, m02, m03);
285 this->
r[1] =
vec4(m10, m11, m12, m13);
286 this->
r[2] =
vec4(m20, m21, m22, m23);
287 this->
r[3] =
vec4(m30, m31, m32, m33);
303 v =
vec4(xScale, yScale, zScale, 1.0f);
348 this->
r[3] = _mm_add_ps(
r[3].vec, t.
vec);
385 __m128 r1,r2,r3,tt,tt2;
388 __m128 _L1 = m.
r[0].
vec;
389 __m128 _L2 = m.
r[1].
vec;
390 __m128 _L3 = m.
r[2].
vec;
391 __m128 _L4 = m.
r[3].
vec;
405 Va =
mm_ror_ps(tt,1); sum = _mm_mul_ps(Va,r1);
406 Vb =
mm_ror_ps(tt,2); sum = _mm_add_ps(sum,_mm_mul_ps(Vb,r2));
407 Vc =
mm_ror_ps(tt,3); sum = _mm_add_ps(sum,_mm_mul_ps(Vc,r3));
410 Det = _mm_mul_ps(sum,_L1);
411 Det = _mm_add_ps(Det,_mm_movehl_ps(Det,Det));
414 tt =
mm_ror_ps(_L1,1); sum = _mm_mul_ps(tt,r1);
415 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r2));
416 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r3));
419 Det = _mm_sub_ss(Det,_mm_shuffle_ps(Det,Det,1));
430 __m128 r1,r2,r3,tt,tt2;
432 __m128 trns0,trns1,trns2,trns3;
434 const __m128i pnpn = _mm_setr_epi32(0x00000000,
static_cast<int>(0x80000000), 0x00000000,
static_cast<int>(0x80000000));
435 const __m128i npnp = _mm_setr_epi32(
static_cast<int>(0x80000000), 0x00000000,
static_cast<int>(0x80000000), 0x00000000);
436 const __m128 zeroone = _mm_setr_ps(1.0f, 0.0f, 0.0f, 1.0f);
438 __m128 _L1 = m.
r[0].
vec;
439 __m128 _L2 = m.
r[1].
vec;
440 __m128 _L3 = m.
r[2].
vec;
441 __m128 _L4 = m.
r[3].
vec;
455 Va =
mm_ror_ps(tt,1); sum = _mm_mul_ps(Va,r1);
456 Vb =
mm_ror_ps(tt,2); sum = _mm_add_ps(sum,_mm_mul_ps(Vb,r2));
457 Vc =
mm_ror_ps(tt,3); sum = _mm_add_ps(sum,_mm_mul_ps(Vc,r3));
460 Det = _mm_mul_ps(sum,_L1);
461 Det = _mm_add_ps(Det,_mm_movehl_ps(Det,Det));
464 __m128 mtL1 = _mm_xor_ps(sum, _mm_castsi128_ps(pnpn));
467 tt =
mm_ror_ps(_L1,1); sum = _mm_mul_ps(tt,r1);
468 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r2));
469 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r3));
470 __m128 mtL2 = _mm_xor_ps(sum, _mm_castsi128_ps(npnp));
473 Det = _mm_sub_ss(Det,_mm_shuffle_ps(Det,Det,1));
477 Va = _mm_mul_ps(tt,Vb);
478 Vb = _mm_mul_ps(tt,Vc);
479 Vc = _mm_mul_ps(tt,_L2);
485 tt =
mm_ror_ps(_L4,1); sum = _mm_mul_ps(tt,r1);
486 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r2));
487 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r3));
488 __m128 mtL3 = _mm_xor_ps(sum, _mm_castsi128_ps(pnpn));
491 RDet = _mm_div_ss(zeroone, Det);
492 RDet = _mm_shuffle_ps(RDet,RDet,0x00);
495 mtL1 = _mm_mul_ps(mtL1, RDet);
496 mtL2 = _mm_mul_ps(mtL2, RDet);
497 mtL3 = _mm_mul_ps(mtL3, RDet);
500 tt =
mm_ror_ps(_L3,1); sum = _mm_mul_ps(tt,r1);
501 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r2));
502 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r3));
503 __m128 mtL4 = _mm_xor_ps(sum, _mm_castsi128_ps(npnp));
504 mtL4 = _mm_mul_ps(mtL4, RDet);
507 trns0 = _mm_unpacklo_ps(mtL1,mtL2);
508 trns1 = _mm_unpacklo_ps(mtL3,mtL4);
509 trns2 = _mm_unpackhi_ps(mtL1,mtL2);
510 trns3 = _mm_unpackhi_ps(mtL3,mtL4);
511 _L1 = _mm_movelh_ps(trns0,trns1);
512 _L2 = _mm_movehl_ps(trns1,trns0);
513 _L3 = _mm_movelh_ps(trns2,trns3);
514 _L4 = _mm_movehl_ps(trns3,trns2);
538 normUp =
permute(normUp, normUp, 1, 2, 0);
542 return mat4(xaxis, yaxis, zaxis, eye);
564 normUp =
permute(normUp, normUp, 1, 2, 0);
568 return mat4(xaxis, yaxis, zaxis, eye);
573static inline __m256 twolincomb_AVX_8(__m256 A01,
const mat4 &B)
576 result = _mm256_mul_ps(_mm256_shuffle_ps(A01, A01, 0x00), _mm256_broadcast_ps(&B.r[0].vec));
577 result = _mm256_add_ps(result, _mm256_mul_ps(_mm256_shuffle_ps(A01, A01, 0x55), _mm256_broadcast_ps(&B.r[1].vec)));
578 result = _mm256_add_ps(result, _mm256_mul_ps(_mm256_shuffle_ps(A01, A01, 0xaa), _mm256_broadcast_ps(&B.r[2].vec)));
579 result = _mm256_add_ps(result, _mm256_mul_ps(_mm256_shuffle_ps(A01, A01, 0xff), _mm256_broadcast_ps(&B.r[3].vec)));
592 __m256 A01 = _mm256_loadu_ps(&m1.m[0][0]);
593 __m256 A23 = _mm256_loadu_ps(&m1.m[2][0]);
595 __m256 out01x = twolincomb_AVX_8(A01, m0);
596 __m256 out23x = twolincomb_AVX_8(A23, m0);
598 _mm256_storeu_ps(&out.m[0][0], out01x);
599 _mm256_storeu_ps(&out.m[2][0], out23x);
603__forceinline mat4 operator%(
const mat4& m1,
const mat4& m0) =
delete;
696 __m128 x = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(0, 0, 0, 0));
697 __m128 y = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(1, 1, 1, 1));
698 __m128 z = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(2, 2, 2, 2));
699 __m128 w = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(3, 3, 3, 3));
705 _mm_mul_ps(w, m.
r[3].
vec))));
714 __m128 x = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(0, 0, 0, 0));
716 __m128 y = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(1, 1, 1, 1));
718 __m128 z = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(2, 2, 2, 2));
724 _mm_mul_ps(z, m.
r[2].
vec)));
733 __m128 x = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(0, 0, 0, 0));
734 __m128 y = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(1, 1, 1, 1));
735 __m128 z = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(2, 2, 2, 2));
736 __m128 w = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(3, 3, 3, 3));
742 _mm_mul_ps(w, m.
r[3].
vec))));
751 __m128 x = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(0, 0, 0, 0));
753 __m128 y = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(1, 1, 1, 1));
755 __m128 z = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(2, 2, 2, 2));
761 _mm_mul_ps(z, m.
r[2].
vec)));
771 scalar dist = 1.0f / (zf - zn);
772 m.
r[0] =
vec4(2.0f / w, 0.0f, 0.0f, 0.0f);
773 m.
r[1] =
vec4(0.0f, 2.0f / h, 0.0f, 0.0f);
774 m.
r[2] =
vec4(0.0f, 0.0f, dist, 0.0f);
775 m.
r[3] =
vec4(0.0f, 0.0, -dist * zn, 1.0f);
786 scalar dist = 1.0f / (zn - zf);
787 m.
r[0] =
vec4(2.0f / w, 0.0f, 0.0f, 0.0f);
788 m.
r[1] =
vec4(0.0f, 2.0f / h, 0.0f, 0.0f);
789 m.
r[2] =
vec4(0.0f, 0.0f, dist, 0.0f);
790 m.
r[3] =
vec4(0.0f, 0.0, dist * zn, 1.0f);
801 scalar divwidth = 1.0f / (r - l);
802 scalar divheight = 1.0f / (t - b);
803 scalar dist = 1.0f / (zf - zn);
804 m.
r[0] =
vec4(2.0f * divwidth, 0.0f, 0.0f, 0.0f);
805 m.
r[1] =
vec4(0.0f, 2.0f * divheight, 0.0f, 0.0f);
806 m.
r[2] =
vec4(0.0f, 0.0f, dist, 0.0f);
807 m.
r[3] =
vec4(-(l+r) * divwidth, - (b+t) * divheight, -dist * zn, 1.0f);
818 scalar divwidth = 1.0f / (r - l);
819 scalar divheight = 1.0f / (t - b);
820 scalar dist = 1.0f / (zn - zf);
821 m.
r[0] =
vec4(2.0f * divwidth, 0.0f, 0.0f, 0.0f);
822 m.
r[1] =
vec4(0.0f, 2.0f * divheight, 0.0f, 0.0f);
823 m.
r[2] =
vec4(0.0f, 0.0f, dist, 0.0f);
824 m.
r[3] =
vec4(-(l+r) * divwidth, - (b+t) * divheight, dist * zn, 1.0f);
835 scalar halfFov = 0.5f * fovy;
839 scalar height = cosfov / sinfov;
840 scalar width = height / aspect;
842 scalar dist = zf / (zf - zn);
843 m.
r[0] =
vec4(width, 0.0f, 0.0f, 0.0f);
844 m.
r[1] =
vec4(0.0f, height, 0.0f, 0.0f);
845 m.
r[2] =
vec4(0.0f, 0.0f, dist, 1.0f);
846 m.
r[3] =
vec4(0.0f, 0.0f, -dist * zn, 0.0f);
858 scalar halfFov = 0.5f * fovy;
862 scalar height = cosfov / sinfov;
863 scalar width = height / aspect;
865 scalar dist = zf / (zn - zf);
867 m.
r[0] =
vec4(width, 0.0f, 0.0f, 0.0f);
868 m.
r[1] =
vec4(0.0f, height, 0.0f, 0.0f);
869 m.
r[2] =
vec4(0.0f, 0.0f, dist, -1.0f);
870 m.
r[3] =
vec4(0.0f, 0.0f, dist * zn, 0.0f);
882 scalar dist = zf / (zf - zn);
884 m.
r[0] =
vec4(2.0f * zn / w, 0.0f, 0.0f, 0.0f);
885 m.
r[1] =
vec4(0.0f, 2.0f * zn / h, 0.0f, 0.0f);
886 m.
r[2] =
vec4(0.0f, 0.0f, dist, 1.0f);
887 m.
r[3] =
vec4(0.0f, 0.0, -dist * zn, 0.0f);
898 scalar dist = zf / (zn - zf);
900 m.
r[0] =
vec4(2.0f * zn / w, 0.0f, 0.0f, 0.0f);
901 m.
r[1] =
vec4(0.0f, 2.0f * zn / h, 0.0f, 0.0f);
902 m.
r[2] =
vec4(0.0f, 0.0f, dist, -1.0f);
903 m.
r[3] =
vec4(0.0f, 0.0, dist * zn, 0.0f);
914 scalar divwidth = 1.0f / (r - l);
915 scalar divheight = 1.0f / (t - b);
916 scalar dist = zf / (zf - zn);
918 m.
r[0] =
vec4(2.0f * zn * divwidth, 0.0f, 0.0f, 0.0f);
919 m.
r[1] =
vec4(0.0f, 2.0f * zn * divheight, 0.0f, 0.0f);
920 m.
r[2] =
vec4(-(l + r) * divwidth, -(b + t) * divheight, dist, 1.0f);
921 m.
r[3] =
vec4(0.0f, 0.0f, -dist * zn, 0.0f);
932 scalar divwidth = 1.0f / (r - l);
933 scalar divheight = 1.0f / (t - b);
934 scalar dist = zf / (zn - zf);
936 m.
r[0] =
vec4(2.0f * zn * divwidth, 0.0f, 0.0f, 0.0f);
937 m.
r[1] =
vec4(0.0f, 2.0f * zn * divheight, 0.0f, 0.0f);
938 m.
r[2] =
vec4((l + r) * divwidth, (b + t) * divheight, dist, -1.0f);
939 m.
r[3] =
vec4(0.0f, 0.0f, dist * zn, 0.0f);
954 __m128 m1_c = _mm_set_ps1(1.0f - cangle);
955 __m128 c = _mm_set_ps1(cangle);
956 __m128 s = _mm_set_ps1(sangle);
958 __m128 nn1 = _mm_shuffle_ps(norm,norm,_MM_SHUFFLE(3,0,2,1));
959 __m128 nn2 = _mm_shuffle_ps(norm,norm,_MM_SHUFFLE(3,1,0,2));
961 __m128 v = _mm_mul_ps(nn1,m1_c);
962 v = _mm_mul_ps(nn2,v);
964 __m128 nn3 = _mm_mul_ps(norm, m1_c);
965 nn3 = _mm_mul_ps(norm, nn3);
966 nn3 = _mm_add_ps(nn3, c);
968 __m128 nn4 = _mm_mul_ps(norm,s);
969 nn4 = _mm_add_ps(nn4, v);
970 __m128 nn5 = _mm_mul_ps(s, norm);
971 nn5 = _mm_sub_ps(v,nn5);
975 __m128 v1 = _mm_shuffle_ps(nn4,nn5,_MM_SHUFFLE(2,1,2,0));
976 v1 = _mm_shuffle_ps(v1,v1,_MM_SHUFFLE(0,3,2,1));
978 __m128 v2 = _mm_shuffle_ps(nn4,nn5,_MM_SHUFFLE(0,0,1,1));
979 v2 = _mm_shuffle_ps(v2,v2,_MM_SHUFFLE(2,0,2,0));
982 nn5 = _mm_shuffle_ps(v,v1,_MM_SHUFFLE(1,0,3,0));
983 nn5 = _mm_shuffle_ps(nn5,nn5,_MM_SHUFFLE(1,3,2,0));
988 nn5 = _mm_shuffle_ps(v,v1,_MM_SHUFFLE(3,2,3,1));
989 nn5 = _mm_shuffle_ps(nn5,nn5,_MM_SHUFFLE(1,3,0,2));
992 v2 = _mm_shuffle_ps(v2,v,_MM_SHUFFLE(3,2,1,0));
1015 m.
m[2][1] = -sangle;
1032 m.
m[0][2] = -sangle;
1053 m.
m[1][0] = -sangle;
1075 m.
r[0] = _mm_setr_ps(scale, 0.0f, 0.0f, 0.0f);
1076 m.
r[1] = _mm_setr_ps(0.0f, scale, 0.0f, 0.0f);
1077 m.
r[2] = _mm_setr_ps(0.0f, 0.0f, scale, 0.0f);
1078 m.
r[3] = _mm_setr_ps(0.0f, 0.0f, 0.0f, 1.0f);
1090 m.
r[0] = _mm_setr_ps(sx, 0.0f, 0.0f, 0.0f);
1091 m.
r[1] = _mm_setr_ps(0.0f, sy, 0.0f, 0.0f);
1092 m.
r[2] = _mm_setr_ps(0.0f, 0.0f, sz, 0.0f);
1093 m.
r[3] = _mm_setr_ps(0.0f, 0.0f, 0.0f, 1.0f);
1105 m.
r[0] = _mm_and_ps(s.
vec, _mm_castsi128_ps(
maskX));
1106 m.
r[1] = _mm_and_ps(s.
vec, _mm_castsi128_ps(
maskY));
1107 m.
r[2] = _mm_and_ps(s.
vec, _mm_castsi128_ps(
maskZ));
1119 m.
r[3] = _mm_set_ps(1.0f,z,y,x);
1151 __m128 tmp3, tmp2, tmp1, tmp0;
1152 tmp0 = _mm_unpacklo_ps(m.
r[0].
vec, m.
r[1].
vec);
1153 tmp2 = _mm_unpacklo_ps(m.
r[2].
vec, m.
r[3].
vec);
1154 tmp1 = _mm_unpackhi_ps(m.
r[0].
vec, m.
r[1].
vec);
1155 tmp3 = _mm_unpackhi_ps(m.
r[2].
vec, m.
r[3].
vec);
1157 ret.
r[0] = _mm_movelh_ps(tmp0, tmp2);
1158 ret.
r[1] = _mm_movehl_ps(tmp2, tmp0);
1159 ret.
r[2] = _mm_movelh_ps(tmp1, tmp3);
1160 ret.
r[3] = _mm_movehl_ps(tmp3, tmp1);
#define n_assert(exp)
Definition debug.h:50
#define mm_ror_ps(vec, i)
Definition mat4.h:21
Half precision (16 bit) float implementation.
Definition angularpfeedbackloop.h:17
static const __m128 _id_z
Definition vec3.h:31
__forceinline vec3 cross(const vec3 &v0, const vec3 &v1)
Definition vec3.h:416
static const __m128 _id_x
Definition vec3.h:29
__forceinline mat4 rotationz(scalar angle)
Definition mat4.h:1043
__forceinline mat4 rotationyawpitchroll(scalar yaw, scalar pitch, scalar roll)
Definition mat4.h:1062
__forceinline mat4 ortholh(scalar w, scalar h, scalar zn, scalar zf)
Definition mat4.h:768
__forceinline vec3 splat_z(const vec3 &v)
Definition vec3.h:822
__forceinline scalar length3(const vec4 &v)
Definition vec4.h:395
__forceinline mat4 rotationy(scalar angle)
Definition mat4.h:1024
__forceinline vec3 splat_x(const vec3 &v)
Definition vec3.h:800
__forceinline mat4 perspoffcenterlh(scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
Definition mat4.h:911
__forceinline mat4 orthooffcenterlh(scalar l, scalar r, scalar t, scalar b, scalar zn, scalar zf)
Definition mat4.h:798
mat4 reflect(const vec4 &p)
based on this http://www.opengl.org/discussion_boards/showthread.php/169605-reflection-matrix-how-to-...
Definition mat4.cc:21
__forceinline mat4 persprh(scalar w, scalar h, scalar zn, scalar zf)
Definition mat4.h:895
__forceinline vec3 multiply(const vec3 &v0, const vec3 &v1)
Definition vec3.h:374
__forceinline scalar angle(const vec3 &v0, const vec3 &v1)
Definition vec3.h:507
__forceinline mat4 trs(const vec3 &position, const quat &rotation, const vec3 &scale)
A short hand for creating a TRS (translation, rotation, scale) matrix from pos, rot and scale.
Definition mat4.h:1140
__forceinline mat4 rotationaxis(const vec3 &axis, scalar angle)
Definition mat4.h:947
mat4 rotationquat(const quat &q)
TODO: rewrite using SSE.
Definition mat4.cc:177
__forceinline mat4 translation(scalar x, scalar y, scalar z)
Definition mat4.h:1116
__forceinline scalar length(const quat &q)
Definition quat.h:259
__forceinline scalar dot(const plane &p, const vec4 &v1)
Definition plane.h:246
__forceinline vec3 permute(const vec3 &v0, const vec3 &v1, unsigned int i0, unsigned int i1, unsigned int i2)
Definition vec3.h:833
__forceinline mat4 orthorh(scalar w, scalar h, scalar zn, scalar zf)
Definition mat4.h:783
void decompose(const mat4 &mat, vec3 &outScale, quat &outRotation, vec3 &outTranslation)
Definition mat4.cc:49
__forceinline mat4 lookatrh(const point &eye, const point &at, const vector &up)
Definition mat4.h:549
static const __m128i maskZ
Definition mat4.h:32
__forceinline plane normalize(const plane &p)
Definition plane.h:255
__forceinline mat4 rotationx(scalar angle)
Definition mat4.h:1005
__forceinline mat4 persplh(scalar w, scalar h, scalar zn, scalar zf)
Definition mat4.h:879
__forceinline mat4 scaling(scalar scale)
Definition mat4.h:1072
__forceinline mat4 perspfovrh(scalar fovy, scalar aspect, scalar zn, scalar zf)
Definition mat4.h:855
static const __m128 _id_w
Definition vec3.h:32
__forceinline mat4 perspfovlh(scalar fovy, scalar aspect, scalar zn, scalar zf)
Definition mat4.h:832
__forceinline vec3 splat_y(const vec3 &v)
Definition vec3.h:811
__forceinline bool isidentity(const mat4 &m)
Definition mat4.h:370
__forceinline scalar determinant(const mat4 &m)
Definition mat4.h:382
mat4 skewsymmetric(const vec3 &v)
Definition mat4.h:1168
static const __m128i maskW
Definition mat4.h:33
float scalar
Definition scalar.h:45
mat4 transformation(const vec3 &scalingCenter, const quat &scalingRotation, const vec3 &scale, const vec3 &rotationCenter, const quat &rotation, const vec3 &trans)
Definition mat4.cc:198
__forceinline mat4 orthooffcenterrh(scalar l, scalar r, scalar t, scalar b, scalar zn, scalar zf)
Definition mat4.h:815
__forceinline mat4 lookatlh(const point &eye, const point &at, const vector &up)
Definition mat4.h:523
half operator*(half one, half two)
Definition half.h:123
quat quatyawpitchroll(scalar y, scalar x, scalar z)
Definition quat.cc:63
__forceinline scalar abs(scalar a)
Definition scalar.h:432
mat4 affine(const vec3 &scale, const vec3 &rotationCenter, const quat &rotation, const vec3 &translation)
Definition mat4.cc:116
__forceinline scalar cos(scalar x)
Definition scalar.h:191
bool ispointinside(const vec4 &p, const mat4 &m)
Definition mat4.cc:223
static const __m128 _mask_xyz
Definition vec3.h:36
__forceinline scalar sin(scalar x)
Definition scalar.h:182
static const __m128i maskY
Definition mat4.h:31
static const __m128 _id_y
Definition vec3.h:30
__forceinline mat4 transpose(const mat4 &m)
Definition mat4.h:1149
__forceinline mat4 perspoffcenterrh(scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
Definition mat4.h:929
__forceinline vec4 splat_w(const vec4 &v)
Definition vec4.h:1047
static const __m128i maskX
Definition mat4.h:30
mat4 affinetransformation(scalar scale, const vec3 &rotationCenter, const quat &rotation, const vec3 &translation)
Definition mat4.cc:165
__forceinline __m128 fmadd(__m128 a, __m128 b, __m128 c)
Fused multiply-add operation, (a * b) + c.
Definition sse.h:22
__forceinline mat4 inverse(const mat4 &m)
Definition mat4.h:427
Nebula's scalar datatype.
A 4x4 single point precision float matrix.
Definition mat4.h:47
vec4 y_axis
Definition mat4.h:114
vec4 row3
Definition mat4.h:136
vec4 position
Definition mat4.h:116
void translate(const vec3 &t)
add a translation to pos_component
Definition mat4.h:346
mat4(const mat4 &rhs)=default
copy constructor
vec4 get_w() const
Definition mat4.h:337
vec4 row1
Definition mat4.h:134
bool operator==(const mat4 &rhs) const
equality operator
Definition mat4.h:180
vec4 get_x() const
Definition mat4.h:310
void stream(scalar *ptr) const
stream content to 16-byte-aligned memory circumventing the write-cache
Definition mat4.h:260
vec4 z_axis
Definition mat4.h:115
float _21
Definition mat4.h:123
void store3(scalar *ptr) const
write 3 columns to 16-byte aligned memory through the write cache
Definition mat4.h:237
vec4 row0
Definition mat4.h:133
void scale(const vec3 &v)
scale matrix
Definition mat4.h:355
void load(const scalar *ptr)
load content from 16-byte-aligned memory
Definition mat4.h:201
vec4 r[4]
as a two-dimensional array
Definition mat4.h:130
float _31
Definition mat4.h:124
vec4 x_axis
Definition mat4.h:113
vec4 row2
Definition mat4.h:135
float _41
Definition mat4.h:125
vec4 get_y() const
Definition mat4.h:319
void store(scalar *ptr) const
write content to 16-byte-aligned memory through the write cache
Definition mat4.h:225
float m[4][4]
Definition mat4.h:127
void loadu(const scalar *ptr)
load content from unaligned memory
Definition mat4.h:213
void set(const vec4 &r0, const vec4 &r1, const vec4 &r2, const vec4 &r3)
set content from row vectors
Definition mat4.h:270
float _11
Definition mat4.h:122
bool operator!=(const mat4 &rhs) const
inequality operator
Definition mat4.h:192
vec4 get_z() const
Definition mat4.h:328
static const mat4 identity
Definition mat4.h:140
void translate(const float x, const float y, const float z)
add a translation to pos_component
void storeu(scalar *ptr) const
write content to unaligned memory through the write cache
Definition mat4.h:248
void scale(const float x, const float y, const float z)
scale matrix
void get_scale(vec4 &scale) const
extracts scale components to target vector
Definition mat4.h:294
mat4()
default constructor. returns identity matrix
Definition mat4.h:147
__m128 vec
Definition plane.h:45
Represents a 3D point in space.
Definition point.h:22
__m128 vec
Definition point.h:75
A quaternion is usually used to represent an orientation in 3D space.
Definition quat.h:30
A 3D vector.
Definition vec3.h:39
float x
Definition vec3.h:93
float z
Definition vec3.h:93
__m128 vec
Definition vec3.h:95
float y
Definition vec3.h:93
A 4D vector.
Definition vec4.h:24
__m128 vec
Definition vec4.h:95
float x
Definition vec4.h:93
A vector is a 3D direction in space.
Definition vector.h:22
__m128 vec
Definition vector.h:82
bool operator==(const TiXmlString &a, const TiXmlString &b)
Definition tinystr.h:272
bool operator!=(const TiXmlString &a, const TiXmlString &b)
Definition tinystr.h:282
#define NEBULA_ALIGN16
Definition types.h:181