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 );
59 float m00,
float m01,
float m02,
float m03,
60 float m10,
float m11,
float m12,
float m13,
61 float m20,
float m21,
float m22,
float m23,
62 float m30,
float m31,
float m32,
float m33);
70 void load(
const scalar* ptr);
72 void loadu(
const scalar* ptr);
74 void store(
scalar* ptr)
const;
76 void store3(
scalar* ptr)
const;
78 void storeu(
scalar* ptr)
const;
80 void stream(
scalar* ptr)
const;
86 float m00,
float m01,
float m02,
float m03,
87 float m10,
float m11,
float m12,
float m13,
88 float m20,
float m21,
float m22,
float m23,
89 float m30,
float m31,
float m32,
float m33);
92 void get_scale(
vec4& scale)
const;
94 void translate(
const vec3& t);
96 void translate(
const float x,
const float y,
const float z);
106 void scale(
const vec3& v);
108 void scale(
const float x,
const float y,
const float z);
170mat4::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)
172 this->
r[0] =
vec4(m00, m01, m02, m03);
173 this->
r[1] =
vec4(m10, m11, m12, m13);
174 this->
r[2] =
vec4(m20, m21, m22, m23);
175 this->
r[3] =
vec4(m30, m31, m32, m33);
196 return !(*
this == rhs);
205 r[0] = _mm_load_ps(ptr);
206 r[1] = _mm_load_ps(ptr + 4);
207 r[2] = _mm_load_ps(ptr + 8);
208 r[3] = _mm_load_ps(ptr + 12);
217 r[0] = _mm_loadu_ps(ptr);
218 r[1] = _mm_loadu_ps(ptr + 4);
219 r[2] = _mm_loadu_ps(ptr + 8);
220 r[3] = _mm_loadu_ps(ptr + 12);
229 _mm_store_ps(ptr,
r[0].vec);
230 _mm_store_ps((ptr + 4),
r[1].vec);
231 _mm_store_ps((ptr + 8),
r[2].vec);
232 _mm_store_ps((ptr + 12),
r[3].vec);
241 _mm_store_ps(ptr,
r[0].vec);
242 _mm_store_ps((ptr + 4),
r[1].vec);
243 _mm_store_ps((ptr + 8),
r[2].vec);
252 _mm_storeu_ps(ptr,
r[0].vec);
253 _mm_storeu_ps((ptr + 4),
r[1].vec);
254 _mm_storeu_ps((ptr + 8),
r[2].vec);
255 _mm_storeu_ps((ptr + 12),
r[3].vec);
284mat4::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)
286 this->
r[0] =
vec4(m00, m01, m02, m03);
287 this->
r[1] =
vec4(m10, m11, m12, m13);
288 this->
r[2] =
vec4(m20, m21, m22, m23);
289 this->
r[3] =
vec4(m30, m31, m32, m33);
305 v =
vec4(xScale, yScale, zScale, 1.0f);
350 this->
r[3] = _mm_add_ps(
r[3].vec, t.
vec);
387 __m128 r1,r2,r3,tt,tt2;
390 __m128 _L1 = m.
r[0].
vec;
391 __m128 _L2 = m.
r[1].
vec;
392 __m128 _L3 = m.
r[2].
vec;
393 __m128 _L4 = m.
r[3].
vec;
407 Va =
mm_ror_ps(tt,1); sum = _mm_mul_ps(Va,r1);
408 Vb =
mm_ror_ps(tt,2); sum = _mm_add_ps(sum,_mm_mul_ps(Vb,r2));
409 Vc =
mm_ror_ps(tt,3); sum = _mm_add_ps(sum,_mm_mul_ps(Vc,r3));
412 Det = _mm_mul_ps(sum,_L1);
413 Det = _mm_add_ps(Det,_mm_movehl_ps(Det,Det));
416 tt =
mm_ror_ps(_L1,1); sum = _mm_mul_ps(tt,r1);
417 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r2));
418 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r3));
421 Det = _mm_sub_ss(Det,_mm_shuffle_ps(Det,Det,1));
432 __m128 r1,r2,r3,tt,tt2;
434 __m128 trns0,trns1,trns2,trns3;
436 const __m128i pnpn = _mm_setr_epi32(0x00000000,
static_cast<int>(0x80000000), 0x00000000,
static_cast<int>(0x80000000));
437 const __m128i npnp = _mm_setr_epi32(
static_cast<int>(0x80000000), 0x00000000,
static_cast<int>(0x80000000), 0x00000000);
438 const __m128 zeroone = _mm_setr_ps(1.0f, 0.0f, 0.0f, 1.0f);
440 __m128 _L1 = m.
r[0].
vec;
441 __m128 _L2 = m.
r[1].
vec;
442 __m128 _L3 = m.
r[2].
vec;
443 __m128 _L4 = m.
r[3].
vec;
457 Va =
mm_ror_ps(tt,1); sum = _mm_mul_ps(Va,r1);
458 Vb =
mm_ror_ps(tt,2); sum = _mm_add_ps(sum,_mm_mul_ps(Vb,r2));
459 Vc =
mm_ror_ps(tt,3); sum = _mm_add_ps(sum,_mm_mul_ps(Vc,r3));
462 Det = _mm_mul_ps(sum,_L1);
463 Det = _mm_add_ps(Det,_mm_movehl_ps(Det,Det));
466 __m128 mtL1 = _mm_xor_ps(sum, _mm_castsi128_ps(pnpn));
469 tt =
mm_ror_ps(_L1,1); sum = _mm_mul_ps(tt,r1);
470 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r2));
471 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r3));
472 __m128 mtL2 = _mm_xor_ps(sum, _mm_castsi128_ps(npnp));
475 Det = _mm_sub_ss(Det,_mm_shuffle_ps(Det,Det,1));
479 Va = _mm_mul_ps(tt,Vb);
480 Vb = _mm_mul_ps(tt,Vc);
481 Vc = _mm_mul_ps(tt,_L2);
487 tt =
mm_ror_ps(_L4,1); sum = _mm_mul_ps(tt,r1);
488 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r2));
489 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r3));
490 __m128 mtL3 = _mm_xor_ps(sum, _mm_castsi128_ps(pnpn));
493 RDet = _mm_div_ss(zeroone, Det);
494 RDet = _mm_shuffle_ps(RDet,RDet,0x00);
497 mtL1 = _mm_mul_ps(mtL1, RDet);
498 mtL2 = _mm_mul_ps(mtL2, RDet);
499 mtL3 = _mm_mul_ps(mtL3, RDet);
502 tt =
mm_ror_ps(_L3,1); sum = _mm_mul_ps(tt,r1);
503 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r2));
504 tt =
mm_ror_ps(tt,1); sum = _mm_add_ps(sum,_mm_mul_ps(tt,r3));
505 __m128 mtL4 = _mm_xor_ps(sum, _mm_castsi128_ps(npnp));
506 mtL4 = _mm_mul_ps(mtL4, RDet);
509 trns0 = _mm_unpacklo_ps(mtL1,mtL2);
510 trns1 = _mm_unpacklo_ps(mtL3,mtL4);
511 trns2 = _mm_unpackhi_ps(mtL1,mtL2);
512 trns3 = _mm_unpackhi_ps(mtL3,mtL4);
513 _L1 = _mm_movelh_ps(trns0,trns1);
514 _L2 = _mm_movehl_ps(trns1,trns0);
515 _L3 = _mm_movelh_ps(trns2,trns3);
516 _L4 = _mm_movehl_ps(trns3,trns2);
540 normUp =
permute(normUp, normUp, 1, 2, 0);
544 return mat4(xaxis, yaxis, zaxis, eye);
566 normUp =
permute(normUp, normUp, 1, 2, 0);
570 return mat4(xaxis, yaxis, zaxis, eye);
575static inline __m256 twolincomb_AVX_8(__m256 A01,
const mat4 &B)
578 result = _mm256_mul_ps(_mm256_shuffle_ps(A01, A01, 0x00), _mm256_broadcast_ps(&B.r[0].vec));
579 result = _mm256_add_ps(result, _mm256_mul_ps(_mm256_shuffle_ps(A01, A01, 0x55), _mm256_broadcast_ps(&B.r[1].vec)));
580 result = _mm256_add_ps(result, _mm256_mul_ps(_mm256_shuffle_ps(A01, A01, 0xaa), _mm256_broadcast_ps(&B.r[2].vec)));
581 result = _mm256_add_ps(result, _mm256_mul_ps(_mm256_shuffle_ps(A01, A01, 0xff), _mm256_broadcast_ps(&B.r[3].vec)));
594 __m256 A01 = _mm256_loadu_ps(&m1.m[0][0]);
595 __m256 A23 = _mm256_loadu_ps(&m1.m[2][0]);
597 __m256 out01x = twolincomb_AVX_8(A01, m0);
598 __m256 out23x = twolincomb_AVX_8(A23, m0);
600 _mm256_storeu_ps(&out.m[0][0], out01x);
601 _mm256_storeu_ps(&out.m[2][0], out23x);
605__forceinline mat4 operator%(
const mat4& m1,
const mat4& m0) =
delete;
698 __m128 x = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(0, 0, 0, 0));
699 __m128 y = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(1, 1, 1, 1));
700 __m128 z = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(2, 2, 2, 2));
701 __m128 w = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(3, 3, 3, 3));
707 _mm_mul_ps(w, m.
r[3].
vec))));
716 __m128 x = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(0, 0, 0, 0));
718 __m128 y = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(1, 1, 1, 1));
720 __m128 z = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(2, 2, 2, 2));
726 _mm_mul_ps(z, m.
r[2].
vec)));
735 __m128 x = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(0, 0, 0, 0));
736 __m128 y = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(1, 1, 1, 1));
737 __m128 z = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(2, 2, 2, 2));
738 __m128 w = _mm_shuffle_ps(p.
vec, p.
vec, _MM_SHUFFLE(3, 3, 3, 3));
744 _mm_mul_ps(w, m.
r[3].
vec))));
753 __m128 x = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(0, 0, 0, 0));
755 __m128 y = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(1, 1, 1, 1));
757 __m128 z = _mm_shuffle_ps(v.
vec, v.
vec, _MM_SHUFFLE(2, 2, 2, 2));
763 _mm_mul_ps(z, m.
r[2].
vec)));
773 scalar dist = 1.0f / (zf - zn);
774 m.
r[0] =
vec4(2.0f / w, 0.0f, 0.0f, 0.0f);
775 m.
r[1] =
vec4(0.0f, 2.0f / h, 0.0f, 0.0f);
776 m.
r[2] =
vec4(0.0f, 0.0f, dist, 0.0f);
777 m.
r[3] =
vec4(0.0f, 0.0, -dist * zn, 1.0f);
788 scalar dist = 1.0f / (zn - zf);
789 m.
r[0] =
vec4(2.0f / w, 0.0f, 0.0f, 0.0f);
790 m.
r[1] =
vec4(0.0f, 2.0f / h, 0.0f, 0.0f);
791 m.
r[2] =
vec4(0.0f, 0.0f, dist, 0.0f);
792 m.
r[3] =
vec4(0.0f, 0.0, dist * zn, 1.0f);
803 scalar divwidth = 1.0f / (r - l);
804 scalar divheight = 1.0f / (t - b);
805 scalar dist = 1.0f / (zf - zn);
806 m.
r[0] =
vec4(2.0f * divwidth, 0.0f, 0.0f, 0.0f);
807 m.
r[1] =
vec4(0.0f, 2.0f * divheight, 0.0f, 0.0f);
808 m.
r[2] =
vec4(0.0f, 0.0f, dist, 0.0f);
809 m.
r[3] =
vec4(-(l+r) * divwidth, - (b+t) * divheight, -dist * zn, 1.0f);
820 scalar divwidth = 1.0f / (r - l);
821 scalar divheight = 1.0f / (t - b);
822 scalar dist = 1.0f / (zn - zf);
823 m.
r[0] =
vec4(2.0f * divwidth, 0.0f, 0.0f, 0.0f);
824 m.
r[1] =
vec4(0.0f, 2.0f * divheight, 0.0f, 0.0f);
825 m.
r[2] =
vec4(0.0f, 0.0f, dist, 0.0f);
826 m.
r[3] =
vec4(-(l+r) * divwidth, - (b+t) * divheight, dist * zn, 1.0f);
837 scalar halfFov = 0.5f * fovy;
841 scalar height = cosfov / sinfov;
842 scalar width = height / aspect;
844 scalar dist = zf / (zf - zn);
845 m.
r[0] =
vec4(width, 0.0f, 0.0f, 0.0f);
846 m.
r[1] =
vec4(0.0f, height, 0.0f, 0.0f);
847 m.
r[2] =
vec4(0.0f, 0.0f, dist, 1.0f);
848 m.
r[3] =
vec4(0.0f, 0.0f, -dist * zn, 0.0f);
860 scalar halfFov = 0.5f * fovy;
864 scalar height = cosfov / sinfov;
865 scalar width = height / aspect;
867 scalar dist = zf / (zn - zf);
869 m.
r[0] =
vec4(width, 0.0f, 0.0f, 0.0f);
870 m.
r[1] =
vec4(0.0f, height, 0.0f, 0.0f);
871 m.
r[2] =
vec4(0.0f, 0.0f, dist, -1.0f);
872 m.
r[3] =
vec4(0.0f, 0.0f, dist * zn, 0.0f);
884 scalar dist = zf / (zf - zn);
886 m.
r[0] =
vec4(2.0f * zn / w, 0.0f, 0.0f, 0.0f);
887 m.
r[1] =
vec4(0.0f, 2.0f * zn / h, 0.0f, 0.0f);
888 m.
r[2] =
vec4(0.0f, 0.0f, dist, 1.0f);
889 m.
r[3] =
vec4(0.0f, 0.0, -dist * zn, 0.0f);
900 scalar dist = zf / (zn - zf);
902 m.
r[0] =
vec4(2.0f * zn / w, 0.0f, 0.0f, 0.0f);
903 m.
r[1] =
vec4(0.0f, 2.0f * zn / h, 0.0f, 0.0f);
904 m.
r[2] =
vec4(0.0f, 0.0f, dist, -1.0f);
905 m.
r[3] =
vec4(0.0f, 0.0, dist * zn, 0.0f);
916 scalar divwidth = 1.0f / (r - l);
917 scalar divheight = 1.0f / (t - b);
918 scalar dist = zf / (zf - zn);
920 m.
r[0] =
vec4(2.0f * zn * divwidth, 0.0f, 0.0f, 0.0f);
921 m.
r[1] =
vec4(0.0f, 2.0f * zn * divheight, 0.0f, 0.0f);
922 m.
r[2] =
vec4(-(l + r) * divwidth, -(b + t) * divheight, dist, 1.0f);
923 m.
r[3] =
vec4(0.0f, 0.0f, -dist * zn, 0.0f);
934 scalar divwidth = 1.0f / (r - l);
935 scalar divheight = 1.0f / (t - b);
936 scalar dist = zf / (zn - zf);
938 m.
r[0] =
vec4(2.0f * zn * divwidth, 0.0f, 0.0f, 0.0f);
939 m.
r[1] =
vec4(0.0f, 2.0f * zn * divheight, 0.0f, 0.0f);
940 m.
r[2] =
vec4((l + r) * divwidth, (b + t) * divheight, dist, -1.0f);
941 m.
r[3] =
vec4(0.0f, 0.0f, dist * zn, 0.0f);
956 __m128 m1_c = _mm_set_ps1(1.0f - cangle);
957 __m128 c = _mm_set_ps1(cangle);
958 __m128 s = _mm_set_ps1(sangle);
960 __m128 nn1 = _mm_shuffle_ps(norm,norm,_MM_SHUFFLE(3,0,2,1));
961 __m128 nn2 = _mm_shuffle_ps(norm,norm,_MM_SHUFFLE(3,1,0,2));
963 __m128 v = _mm_mul_ps(nn1,m1_c);
964 v = _mm_mul_ps(nn2,v);
966 __m128 nn3 = _mm_mul_ps(norm, m1_c);
967 nn3 = _mm_mul_ps(norm, nn3);
968 nn3 = _mm_add_ps(nn3, c);
970 __m128 nn4 = _mm_mul_ps(norm,s);
971 nn4 = _mm_add_ps(nn4, v);
972 __m128 nn5 = _mm_mul_ps(s, norm);
973 nn5 = _mm_sub_ps(v,nn5);
977 __m128 v1 = _mm_shuffle_ps(nn4,nn5,_MM_SHUFFLE(2,1,2,0));
978 v1 = _mm_shuffle_ps(v1,v1,_MM_SHUFFLE(0,3,2,1));
980 __m128 v2 = _mm_shuffle_ps(nn4,nn5,_MM_SHUFFLE(0,0,1,1));
981 v2 = _mm_shuffle_ps(v2,v2,_MM_SHUFFLE(2,0,2,0));
984 nn5 = _mm_shuffle_ps(v,v1,_MM_SHUFFLE(1,0,3,0));
985 nn5 = _mm_shuffle_ps(nn5,nn5,_MM_SHUFFLE(1,3,2,0));
990 nn5 = _mm_shuffle_ps(v,v1,_MM_SHUFFLE(3,2,3,1));
991 nn5 = _mm_shuffle_ps(nn5,nn5,_MM_SHUFFLE(1,3,0,2));
994 v2 = _mm_shuffle_ps(v2,v,_MM_SHUFFLE(3,2,1,0));
1017 m.
m[2][1] = -sangle;
1034 m.
m[0][2] = -sangle;
1055 m.
m[1][0] = -sangle;
1077 m.
r[0] = _mm_setr_ps(scale, 0.0f, 0.0f, 0.0f);
1078 m.
r[1] = _mm_setr_ps(0.0f, scale, 0.0f, 0.0f);
1079 m.
r[2] = _mm_setr_ps(0.0f, 0.0f, scale, 0.0f);
1080 m.
r[3] = _mm_setr_ps(0.0f, 0.0f, 0.0f, 1.0f);
1092 m.
r[0] = _mm_setr_ps(sx, 0.0f, 0.0f, 0.0f);
1093 m.
r[1] = _mm_setr_ps(0.0f, sy, 0.0f, 0.0f);
1094 m.
r[2] = _mm_setr_ps(0.0f, 0.0f, sz, 0.0f);
1095 m.
r[3] = _mm_setr_ps(0.0f, 0.0f, 0.0f, 1.0f);
1107 m.
r[0] = _mm_and_ps(s.
vec, _mm_castsi128_ps(
maskX));
1108 m.
r[1] = _mm_and_ps(s.
vec, _mm_castsi128_ps(
maskY));
1109 m.
r[2] = _mm_and_ps(s.
vec, _mm_castsi128_ps(
maskZ));
1121 m.
r[3] = _mm_set_ps(1.0f,z,y,x);
1153 __m128 tmp3, tmp2, tmp1, tmp0;
1154 tmp0 = _mm_unpacklo_ps(m.
r[0].
vec, m.
r[1].
vec);
1155 tmp2 = _mm_unpacklo_ps(m.
r[2].
vec, m.
r[3].
vec);
1156 tmp1 = _mm_unpackhi_ps(m.
r[0].
vec, m.
r[1].
vec);
1157 tmp3 = _mm_unpackhi_ps(m.
r[2].
vec, m.
r[3].
vec);
1159 ret.
r[0] = _mm_movelh_ps(tmp0, tmp2);
1160 ret.
r[1] = _mm_movehl_ps(tmp2, tmp0);
1161 ret.
r[2] = _mm_movelh_ps(tmp1, tmp3);
1162 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
Different curves.
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:417
static const __m128 _id_x
Definition vec3.h:29
__forceinline mat4 rotationz(scalar angle)
Definition mat4.h:1045
__forceinline mat4 rotationyawpitchroll(scalar yaw, scalar pitch, scalar roll)
Definition mat4.h:1064
__forceinline mat4 ortholh(scalar w, scalar h, scalar zn, scalar zf)
Definition mat4.h:770
__forceinline vec3 splat_z(const vec3 &v)
Definition vec3.h:823
__forceinline scalar length3(const vec4 &v)
Definition vec4.h:395
__forceinline mat4 rotationy(scalar angle)
Definition mat4.h:1026
__forceinline vec3 splat_x(const vec3 &v)
Definition vec3.h:801
__forceinline mat4 perspoffcenterlh(scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
Definition mat4.h:913
__forceinline mat4 orthooffcenterlh(scalar l, scalar r, scalar t, scalar b, scalar zn, scalar zf)
Definition mat4.h:800
mat4 reflect(const vec4 &p)
based on this http://www.opengl.org/discussion_boards/showthread.php/169605-reflection-matrix-how-to-...
Definition mat4.cc:22
__forceinline mat4 persprh(scalar w, scalar h, scalar zn, scalar zf)
Definition mat4.h:897
__forceinline vec3 multiply(const vec3 &v0, const vec3 &v1)
Definition vec3.h:375
__forceinline scalar angle(const vec3 &v0, const vec3 &v1)
Definition vec3.h:508
__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:1142
__forceinline mat4 rotationaxis(const vec3 &axis, scalar angle)
Definition mat4.h:949
mat4 rotationquat(const quat &q)
TODO: rewrite using SSE.
Definition mat4.cc:178
__forceinline mat4 translation(scalar x, scalar y, scalar z)
Definition mat4.h:1118
__forceinline scalar length(const quat &q)
Definition quat.h:259
mat4 fromeuler(const vec3 &v)
Definition mat4.cc:237
__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:834
__forceinline mat4 orthorh(scalar w, scalar h, scalar zn, scalar zf)
Definition mat4.h:785
void decompose(const mat4 &mat, vec3 &outScale, quat &outRotation, vec3 &outTranslation)
Definition mat4.cc:50
__forceinline mat4 lookatrh(const point &eye, const point &at, const vector &up)
Definition mat4.h:551
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:1007
__forceinline mat4 persplh(scalar w, scalar h, scalar zn, scalar zf)
Definition mat4.h:881
__forceinline mat4 scaling(scalar scale)
Definition mat4.h:1074
__forceinline mat4 perspfovrh(scalar fovy, scalar aspect, scalar zn, scalar zf)
Definition mat4.h:857
static const __m128 _id_w
Definition vec3.h:32
__forceinline mat4 perspfovlh(scalar fovy, scalar aspect, scalar zn, scalar zf)
Definition mat4.h:834
__forceinline vec3 splat_y(const vec3 &v)
Definition vec3.h:812
__forceinline bool isidentity(const mat4 &m)
Definition mat4.h:372
__forceinline scalar determinant(const mat4 &m)
Definition mat4.h:384
mat4 skewsymmetric(const vec3 &v)
Definition mat4.h:1170
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:199
__forceinline mat4 orthooffcenterrh(scalar l, scalar r, scalar t, scalar b, scalar zn, scalar zf)
Definition mat4.h:817
__forceinline mat4 lookatlh(const point &eye, const point &at, const vector &up)
Definition mat4.h:525
vec3 aseuler(const mat4 &m)
Definition mat4.cc:270
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:117
__forceinline scalar cos(scalar x)
Definition scalar.h:191
bool ispointinside(const vec4 &p, const mat4 &m)
Definition mat4.cc:224
static const __m128 _mask_xyz
Definition vec3.h:37
__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:1151
__forceinline mat4 perspoffcenterrh(scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
Definition mat4.h:931
__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:166
__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:429
Nebula's scalar datatype.
A 4x4 single point precision float matrix.
Definition mat4.h:49
vec4 y_axis
Definition mat4.h:116
vec4 row3
Definition mat4.h:138
vec4 position
Definition mat4.h:118
void translate(const vec3 &t)
add a translation to pos_component
Definition mat4.h:348
mat4(const mat4 &rhs)=default
copy constructor
vec4 get_w() const
Definition mat4.h:339
vec4 row1
Definition mat4.h:136
bool operator==(const mat4 &rhs) const
equality operator
Definition mat4.h:182
vec4 get_x() const
Definition mat4.h:312
void stream(scalar *ptr) const
stream content to 16-byte-aligned memory circumventing the write-cache
Definition mat4.h:262
vec4 z_axis
Definition mat4.h:117
float _21
Definition mat4.h:125
void store3(scalar *ptr) const
write 3 columns to 16-byte aligned memory through the write cache
Definition mat4.h:239
vec4 row0
Definition mat4.h:135
void scale(const vec3 &v)
scale matrix
Definition mat4.h:357
void load(const scalar *ptr)
load content from 16-byte-aligned memory
Definition mat4.h:203
vec4 r[4]
as a two-dimensional array
Definition mat4.h:132
float _31
Definition mat4.h:126
vec4 x_axis
Definition mat4.h:115
vec4 row2
Definition mat4.h:137
float _41
Definition mat4.h:127
vec4 get_y() const
Definition mat4.h:321
void store(scalar *ptr) const
write content to 16-byte-aligned memory through the write cache
Definition mat4.h:227
float m[4][4]
Definition mat4.h:129
void loadu(const scalar *ptr)
load content from unaligned memory
Definition mat4.h:215
void set(const vec4 &r0, const vec4 &r1, const vec4 &r2, const vec4 &r3)
set content from row vectors
Definition mat4.h:272
float _11
Definition mat4.h:124
bool operator!=(const mat4 &rhs) const
inequality operator
Definition mat4.h:194
vec4 get_z() const
Definition mat4.h:330
static const mat4 identity
Definition mat4.h:142
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:250
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:296
mat4()
default constructor. returns identity matrix
Definition mat4.h:149
__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:40
float x
Definition vec3.h:94
float z
Definition vec3.h:94
__m128 vec
Definition vec3.h:96
float y
Definition vec3.h:94
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:154