NW4F G3d
Loading...
Searching...
No Matches
g3d_Matrix34-inl.h
Go to the documentation of this file.
1#include <nw/g3d/math/g3d_MathCommon.h>
2#include <nw/g3d/math/g3d_Vector3.h>
3#include <nw/g3d/math/g3d_Vector4.h>
4#include <nw/g3d/math/g3d_Quaternion.h>
5
6namespace nw { namespace g3d { namespace math {
7
10 float m00, float m01, float m02, float m03,
11 float m10, float m11, float m12, float m13,
12 float m20, float m21, float m22, float m23)
13{
14 return Mtx34().Set(
15 m00, m01, m02, m03,
16 m10, m11, m12, m13,
17 m20, m21, m22, m23);
18}
19
21Mtx34* Mtx34::Cast(float* a)
22{
23 return reinterpret_cast<Mtx34*>(a);
24}
25
27const Mtx34* Mtx34::Cast(const float* a)
28{
29 return reinterpret_cast<const Mtx34*>(a);
30}
31
34 float m00, float m01, float m02, float m03,
35 float m10, float m11, float m12, float m13,
36 float m20, float m21, float m22, float m23)
37{
38 v[0].Set(m00, m01, m02, m03);
39 v[1].Set(m10, m11, m12, m13);
40 v[2].Set(m20, m21, m22, m23);
41 return *this;
42}
43
45Mtx34& Mtx34::Set(const float* a)
46{
48 for (int i = 0; i < DIM; ++i)
49 {
50 this->a[i] = a[i];
51 }
52 return *this;
53}
54
56Mtx34& Mtx34::Set(const Mtx34& m)
57{
58 for (int i = 0; i < DIM_MAJOR; ++i)
59 {
60 v[i].Set(m.v[i]);
61 }
62 return *this;
63}
64
66Mtx34& Mtx34::Set(const Vec3& x, const Vec3& y, const Vec3& z, const Vec3& w)
67{
68 Set(x.x, y.x, z.x, w.x, x.y, y.y, z.y, w.y, x.z, y.z, z.z, w.z);
69 return *this;
70}
71
74{
75 for (int i = 0; i < DIM; ++i)
76 {
77 a[i] = 0.0f;
78 }
79 return *this;
80}
81
84{
85 v[0].Set(1.0f, 0.0f, 0.0f, 0.0f);
86 v[1].Set(0.0f, 1.0f, 0.0f, 0.0f);
87 v[2].Set(0.0f, 0.0f, 1.0f, 0.0f);
88 return *this;
89}
90
92Mtx34& Mtx34::Neg(const Mtx34& m)
93{
94#if defined( __ghs__ )
95 ps[0] = __PS_NEG(m.ps[0]);
96 ps[1] = __PS_NEG(m.ps[1]);
97 ps[2] = __PS_NEG(m.ps[2]);
98 ps[3] = __PS_NEG(m.ps[3]);
99 ps[4] = __PS_NEG(m.ps[4]);
100 ps[5] = __PS_NEG(m.ps[5]);
101#else
102 for (int i = 0; i < DIM; ++i)
103 {
104 a[i] = -m.a[i];
105 }
106#endif
107 return *this;
108}
109
111Mtx34& Mtx34::SetS(const Vec3& s)
112{
113 this->m00 = s.x;
114 this->m11 = s.y;
115 this->m22 = s.z;
116 this->m01 = this->m02 = this->m10 = this->m12 = this->m20 = this->m21 = 0.0f;
117
118 return *this;
119}
120
122Mtx34& Mtx34::SetR(const Vec3& r)
123{
124 float sx, sy, sz, cx, cy, cz;
125
126 Math::SinCos(&sx, &cx, r.x);
127 Math::SinCos(&sy, &cy, r.y);
128 Math::SinCos(&sz, &cz, r.z);
129
130 float cxcz = cx * cz;
131 float sxsy = sx * sy;
132 float cxsz = cx * sz;
133
134 this->m00 = cy * cz;
135 this->m10 = cy * sz;
136 this->m20 = -sy;
137
138 this->m01 = sxsy * cz - cxsz;
139 this->m11 = sxsy * sz + cxcz;
140 this->m21 = sx * cy;
141
142 this->m02 = cxcz * sy + sx * sz;
143 this->m12 = cxsz * sy - sx * cz;
144 this->m22 = cx * cy;
145
146 return *this;
147}
148
150Mtx34& Mtx34::SetR(const Quat& r)
151{
152 float yy2 = 2 * r.y * r.y;
153 float zz2 = 2 * r.z * r.z;
154 float xx2 = 2 * r.x * r.x;
155 float xy2 = 2 * r.x * r.y;
156 float xz2 = 2 * r.x * r.z;
157 float yz2 = 2 * r.y * r.z;
158 float wz2 = 2 * r.w * r.z;
159 float wx2 = 2 * r.w * r.x;
160 float wy2 = 2 * r.w * r.y;
161
162 this->m00 = 1.0f - yy2 - zz2;
163 this->m01 = xy2 - wz2;
164 this->m02 = xz2 + wy2;
165
166 this->m10 = xy2 + wz2;
167 this->m11 = 1.0f - xx2 - zz2;
168 this->m12 = yz2 - wx2;
169
170 this->m20 = xz2 - wy2;
171 this->m21 = yz2 + wx2;
172 this->m22 = 1.0f - xx2 - yy2;
173
174 return *this;
175}
176
178Mtx34& Mtx34::SetT(const Vec3& t)
179{
180 this->m03 = t.x;
181 this->m13 = t.y;
182 this->m23 = t.z;
183
184 return *this;
185}
186
188Mtx34& Mtx34::SetSR(const Vec3& s, const Vec3& r)
189{
190 float sx, sy, sz, cx, cy, cz;
191
192 Math::SinCos(&sx, &cx, r.x);
193 Math::SinCos(&sy, &cy, r.y);
194 Math::SinCos(&sz, &cz, r.z);
195
196 float cxcz = cx * cz;
197 float sxsy = sx * sy;
198 float cxsz = cx * sz;
199
200 this->m00 = s.x * cy * cz;
201 this->m10 = s.y * cy * sz;
202 this->m20 = s.z * (-sy);
203
204 this->m01 = s.x * (sxsy * cz - cxsz);
205 this->m11 = s.y * (sxsy * sz + cxcz);
206 this->m21 = s.z * sx * cy;
207
208 this->m02 = s.x * (cxcz * sy + sx * sz);
209 this->m12 = s.y * (cxsz * sy - sx * cz);
210 this->m22 = s.z * cx * cy;
211
212 return *this;
213}
214
216Mtx34& Mtx34::SetSR(const Vec3& s, const Quat& r)
217{
218 float yy2 = 2 * r.y * r.y;
219 float zz2 = 2 * r.z * r.z;
220 float xx2 = 2 * r.x * r.x;
221 float xy2 = 2 * r.x * r.y;
222 float xz2 = 2 * r.x * r.z;
223 float yz2 = 2 * r.y * r.z;
224 float wz2 = 2 * r.w * r.z;
225 float wx2 = 2 * r.w * r.x;
226 float wy2 = 2 * r.w * r.y;
227
228 this->m00 = s.x * (1.0f - yy2 - zz2);
229 this->m01 = s.y * (xy2 - wz2);
230 this->m02 = s.z * (xz2 + wy2);
231
232 this->m10 = s.x * (xy2 + wz2);
233 this->m11 = s.y * (1.0f - xx2 - zz2);
234 this->m12 = s.z * (yz2 - wx2);
235
236 this->m20 = s.x * (xz2 - wy2);
237 this->m21 = s.y * (yz2 + wx2);
238 this->m22 = s.z * (1.0f - xx2 - yy2);
239
240 return *this;
241}
242
243//--------------------------------------------------------------------------------------------------
244
246Mtx34& Mtx34::Add(const Mtx34& lhs, const Mtx34& rhs)
247{
248#if defined( __ghs__ )
249 ps[0] = __PS_ADD(lhs.ps[0], rhs.ps[0]);
250 ps[1] = __PS_ADD(lhs.ps[1], rhs.ps[1]);
251 ps[2] = __PS_ADD(lhs.ps[2], rhs.ps[2]);
252 ps[3] = __PS_ADD(lhs.ps[3], rhs.ps[3]);
253 ps[4] = __PS_ADD(lhs.ps[4], rhs.ps[4]);
254 ps[5] = __PS_ADD(lhs.ps[5], rhs.ps[5]);
255#else
256 for (int i = 0; i < DIM; ++i)
257 {
258 a[i] = lhs.a[i] + rhs.a[i];
259 }
260#endif
261 return *this;
262}
263
265Mtx34& Mtx34::Sub(const Mtx34& lhs, const Mtx34& rhs)
266{
267#if defined( __ghs__ )
268 ps[0] = __PS_SUB(lhs.ps[0], rhs.ps[0]);
269 ps[1] = __PS_SUB(lhs.ps[1], rhs.ps[1]);
270 ps[2] = __PS_SUB(lhs.ps[2], rhs.ps[2]);
271 ps[3] = __PS_SUB(lhs.ps[3], rhs.ps[3]);
272 ps[4] = __PS_SUB(lhs.ps[4], rhs.ps[4]);
273 ps[5] = __PS_SUB(lhs.ps[5], rhs.ps[5]);
274#else
275 for (int i = 0; i < DIM; ++i)
276 {
277 a[i] = lhs.a[i] - rhs.a[i];
278 }
279#endif
280 return *this;
281}
282
284Mtx34& Mtx34::Mul(const Mtx34& lhs, const Mtx34& rhs)
285{
286#if defined( __ghs__ )
287 const int ROW = 16;
288
289 f32x2 f0 = __PSQ_LX(&rhs, 0, 0, 0);
290 f32x2 f1 = __PSQ_LX(&rhs, 16, 0, 0);
291 f32x2 f2 = __PSQ_LX(&rhs, 32, 0, 0);
292 f32x2 f4 = __PSQ_LX(&rhs, 8, 0, 0);
293 f32x2 f5 = __PSQ_LX(&rhs, 24, 0, 0);
294 f32x2 f6 = __PSQ_LX(&rhs, 40, 0, 0);
295 f32x2 f7 = { 0, 1 };
296
297 f32x2 f8, f9, f10;
298
299 f8 = __PSQ_LX(&lhs, 0 * ROW + 0, 0, 0);
300 f9 = __PS_MULS0(f0, f8);
301 f10 = __PS_MULS0(f4, f8);
302 f9 = __PS_MADDS1(f1, f8, f9);
303 f10 = __PS_MADDS1(f5, f8, f10);
304 f8 = __PSQ_LX(&lhs, 0 * ROW + 8, 0, 0);
305 f9 = __PS_MADDS0(f2, f8, f9);
306 f10 = __PS_MADDS0(f6, f8, f10);
307 f10 = __PS_MADDS1(f7, f8, f10);
308 __PSQ_STX(this, 0 * ROW + 0, f9, 0, 0);
309 __PSQ_STX(this, 0 * ROW + 8, f10, 0, 0);
310
311 f8 = __PSQ_LX(&lhs, 1 * ROW + 0, 0, 0);
312 f9 = __PS_MULS0(f0, f8);
313 f10 = __PS_MULS0(f4, f8);
314 f9 = __PS_MADDS1(f1, f8, f9);
315 f10 = __PS_MADDS1(f5, f8, f10);
316 f8 = __PSQ_LX(&lhs, 1 * ROW + 8, 0, 0);
317 f9 = __PS_MADDS0(f2, f8, f9);
318 f10 = __PS_MADDS0(f6, f8, f10);
319 f10 = __PS_MADDS1(f7, f8, f10);
320 __PSQ_STX(this, 1 * ROW + 0, f9, 0, 0);
321 __PSQ_STX(this, 1 * ROW + 8, f10, 0, 0);
322
323 f8 = __PSQ_LX(&lhs, 2 * ROW + 0, 0, 0);
324 f9 = __PS_MULS0(f0, f8);
325 f10 = __PS_MULS0(f4, f8);
326 f9 = __PS_MADDS1(f1, f8, f9);
327 f10 = __PS_MADDS1(f5, f8, f10);
328 f8 = __PSQ_LX(&lhs, 2 * ROW + 8, 0, 0);
329 f9 = __PS_MADDS0(f2, f8, f9);
330 f10 = __PS_MADDS0(f6, f8, f10);
331 f10 = __PS_MADDS1(f7, f8, f10);
332 __PSQ_STX(this, 2 * ROW + 0, f9, 0, 0);
333 __PSQ_STX(this, 2 * ROW + 8, f10, 0, 0);
334
335 return *this;
336#else
337 Mtx34 out;
338
339 out.m00 = lhs.m00 * rhs.m00 + lhs.m01 * rhs.m10 + lhs.m02 * rhs.m20;
340 out.m01 = lhs.m00 * rhs.m01 + lhs.m01 * rhs.m11 + lhs.m02 * rhs.m21;
341 out.m02 = lhs.m00 * rhs.m02 + lhs.m01 * rhs.m12 + lhs.m02 * rhs.m22;
342 out.m03 = lhs.m00 * rhs.m03 + lhs.m01 * rhs.m13 + lhs.m02 * rhs.m23 + lhs.m03;
343 out.m10 = lhs.m10 * rhs.m00 + lhs.m11 * rhs.m10 + lhs.m12 * rhs.m20;
344 out.m11 = lhs.m10 * rhs.m01 + lhs.m11 * rhs.m11 + lhs.m12 * rhs.m21;
345 out.m12 = lhs.m10 * rhs.m02 + lhs.m11 * rhs.m12 + lhs.m12 * rhs.m22;
346 out.m13 = lhs.m10 * rhs.m03 + lhs.m11 * rhs.m13 + lhs.m12 * rhs.m23 + lhs.m13;
347 out.m20 = lhs.m20 * rhs.m00 + lhs.m21 * rhs.m10 + lhs.m22 * rhs.m20;
348 out.m21 = lhs.m20 * rhs.m01 + lhs.m21 * rhs.m11 + lhs.m22 * rhs.m21;
349 out.m22 = lhs.m20 * rhs.m02 + lhs.m21 * rhs.m12 + lhs.m22 * rhs.m22;
350 out.m23 = lhs.m20 * rhs.m03 + lhs.m21 * rhs.m13 + lhs.m22 * rhs.m23 + lhs.m23;
351
352 return *this = out;
353#endif
354}
355
357Mtx34& Mtx34::Mul(const Mtx34& lhs, float rhs)
358{
359#if defined( __ghs__ )
360 ps[0] = __PS_MULS0F(lhs.ps[0], rhs);
361 ps[1] = __PS_MULS0F(lhs.ps[1], rhs);
362 ps[2] = __PS_MULS0F(lhs.ps[2], rhs);
363 ps[3] = __PS_MULS0F(lhs.ps[3], rhs);
364 ps[4] = __PS_MULS0F(lhs.ps[4], rhs);
365 ps[5] = __PS_MULS0F(lhs.ps[5], rhs);
366#else
367 for (int i = 0; i < DIM; ++i)
368 {
369 a[i] = lhs.a[i] * rhs;
370 }
371#endif
372 return *this;
373}
374
376Mtx34& Mtx34::Div(const Mtx34& lhs, float rhs)
377{
378 float rcp = Math::Rcp(rhs);
379 this->Mul(lhs, rcp);
380 return *this;
381}
382
383//--------------------------------------------------------------------------------------------------
384
386float Mtx34::Det(const Mtx34& m)
387{
388 float det =
389 m.m00 * (m.m11 * m.m22 - m.m21 * m.m12) +
390 m.m01 * (m.m12 * m.m20 - m.m10 * m.m22) +
391 m.m02 * (m.m10 * m.m21 - m.m20 * m.m11);
392 return det;
393}
394
397{
398 float tmp;
399 tmp = m.m01; m01 = m.m10; m10 = tmp;
400 tmp = m.m02; m02 = m.m20; m20 = tmp;
401 tmp = m.m12; m12 = m.m21; m21 = tmp;
402 m00 = m.m00; m11 = m.m11; m22 = m.m22;
403 m03 = m13 = m23 = 0.0f;
404 return *this;
405}
406
409{
410 float r00, r01, r02, r10, r11, r12, r20, r21, r22;
411
412 r00 = (m.m11 * m.m22 - m.m21 * m.m12);
413 r01 = -(m.m01 * m.m22 - m.m21 * m.m02);
414 r02 = (m.m01 * m.m12 - m.m11 * m.m02);
415
416 r10 = -(m.m10 * m.m22 - m.m20 * m.m12);
417 r11 = (m.m00 * m.m22 - m.m20 * m.m02);
418 r12 = -(m.m00 * m.m12 - m.m10 * m.m02);
419
420 r20 = (m.m10 * m.m21 - m.m20 * m.m11);
421 r21 = -(m.m00 * m.m21 - m.m20 * m.m01);
422 r22 = (m.m00 * m.m11 - m.m10 * m.m01);
423
424 m00 = r00; m01 = r01; m02 = r02;
425 m10 = r10; m11 = r11; m12 = r12;
426 m20 = r20; m21 = r21; m22 = r22;
427
428 m03 = -(r00 * m.m03 + r01 * m.m13 + r02 * m.m23);
429 m13 = -(r10 * m.m03 + r11 * m.m13 + r12 * m.m23);
430 m23 = -(r20 * m.m03 + r21 * m.m13 + r22 * m.m23);
431
432 return *this;
433}
434
437{
438 float r00, r01, r02, r10, r11, r12;
439
440 r00 = (m.m11 * m.m22 - m.m21 * m.m12);
441 r01 = -(m.m10 * m.m22 - m.m20 * m.m12);
442 r02 = (m.m10 * m.m21 - m.m20 * m.m11);
443
444 r10 = -(m.m01 * m.m22 - m.m21 * m.m02);
445 r11 = (m.m00 * m.m22 - m.m20 * m.m02);
446 r12 = -(m.m00 * m.m21 - m.m20 * m.m01);
447
448 m20 = (m.m01 * m.m12 - m.m11 * m.m02);
449 m21 = -(m.m00 * m.m12 - m.m10 * m.m02);
450 m22 = (m.m00 * m.m11 - m.m10 * m.m01);
451
452 m00 = r00; m01 = r01; m02 = r02;
453 m10 = r10; m11 = r11; m12 = r12;
454 m03 = m13 = m23 = 0.0f;
455
456 return *this;
457}
458
460Mtx34& Mtx34::Inverse(float* pDet, const Mtx34& m)
461{
463 float det = Det(m);
464 *pDet = det;
465 Adjugate(m);
466 Div(*this, det);
467 return *this;
468}
469
471Mtx34& Mtx34::InvTranspose(float* pDet, const Mtx34& m)
472{
474 float det = Det(m);
475 *pDet = det;
476 Cofactor(m);
477 Div(*this, det);
478 return *this;
479}
480
481//--------------------------------------------------------------------------------------------------
482
484Mtx34& Mtx34::ScaleBases(const Mtx34& m, const Vec3& s)
485{
486#if defined( __ghs__ )
487 f32x2 zw = { s.z, 1.0f };
488 ps[0] = __PS_MUL(m.ps[0], s.ps[0]);
489 ps[1] = __PS_MUL(m.ps[1], zw);
490 ps[2] = __PS_MUL(m.ps[2], s.ps[0]);
491 ps[3] = __PS_MUL(m.ps[3], zw);
492 ps[4] = __PS_MUL(m.ps[4], s.ps[0]);
493 ps[5] = __PS_MUL(m.ps[5], zw);
494#else
495 m00 = m.m00 * s.x; m01 = m.m01 * s.y; m02 = m.m02 * s.z; m03 = m.m03;
496 m10 = m.m10 * s.x; m11 = m.m11 * s.y; m12 = m.m12 * s.z; m13 = m.m13;
497 m20 = m.m20 * s.x; m21 = m.m21 * s.y; m22 = m.m22 * s.z; m23 = m.m23;
498#endif
499 return *this;
500}
501
503float Mtx34::ExtractBaseScale(const Mtx34& m, int axis)
504{
506}
507
509float Mtx34::ExtractBaseScaleSq(const Mtx34& m, int axis)
510{
512 float x = m.m[0][axis];
513 float y = m.m[1][axis];
514 float z = m.m[2][axis];
515 return x * x + y * y + z * z;
516}
517
519Mtx34& Mtx34::LookAt(const Vec3& camPos, const Vec3& camUp, const Vec3& target)
520{
521 Vec3 vLook;
522 vLook.Normalize(vLook.Sub(camPos, target));
523
524 Vec3 vRight;
525 vRight.Normalize(vRight.Cross(camUp, vLook));
526
527 Vec3 vUp;
528 vUp.Cross(vLook, vRight);
529
530 m[0][0] = vRight.x;
531 m[0][1] = vRight.y;
532 m[0][2] = vRight.z;
533 m[0][3] = -Vec3::Dot(camPos, vRight);
534
535 m[1][0] = vUp.x;
536 m[1][1] = vUp.y;
537 m[1][2] = vUp.z;
538 m[1][3] = -Vec3::Dot(camPos, vUp);
539
540 m[2][0] = vLook.x;
541 m[2][1] = vLook.y;
542 m[2][2] = vLook.z;
543 m[2][3] = -Vec3::Dot(camPos, vLook);
544
545 return *this;
546}
547
549Mtx34& Mtx34::TexProjFrustum(float l, float r, float b, float t, float n)
550{
551 static const float SCALE_S = 0.5f;
552 static const float SCALE_T = -0.5f;
553 static const float TRANSLATE_S = 0.5f;
554 static const float TRANSLATE_T = 0.5f;
555
556 NW_G3D_ASSERT(t != b);
557 NW_G3D_ASSERT(l != r);
558
559 float reverseWidth = 1.0f / (r - l);
560 m[0][0] = ((2.0f * n) * reverseWidth) * SCALE_S;
561 m[0][1] = 0.0f;
562 m[0][2] = (((r + l) * reverseWidth) * SCALE_S) - TRANSLATE_S;
563 m[0][3] = 0.0f;
564
565 float reverseHeight = 1.0f / (t - b);
566 m[1][0] = 0.0f;
567 m[1][1] = ((2.0f * n) * reverseHeight) * SCALE_T;
568 m[1][2] = (((t + b) * reverseHeight) * SCALE_T) - TRANSLATE_T;
569 m[1][3] = 0.0f;
570
571 m[2][0] = 0.0f;
572 m[2][1] = 0.0f;
573 m[2][2] = -1.0f;
574 m[2][3] = 0.0f;
575
576 return *this;
577}
578
581 float fovy,
582 float aspect)
583{
584 static const float SCALE_S = 0.5f;
585 static const float SCALE_T = -0.5f;
586 static const float TRANSLATE_S = 0.5f;
587 static const float TRANSLATE_T = 0.5f;
588
589 NW_G3D_ASSERT((fovy > 0.0f) && (fovy < Math::Pi()));
590 NW_G3D_ASSERT((aspect != 0.0f));
591
592 float angle = fovy * 0.5f;
593 float cot = 1.0f / Math::Tan(angle);
594
595 m[0][0] = (cot / aspect) * SCALE_S;
596 m[0][1] = 0.0f;
597 m[0][2] = -TRANSLATE_S;
598 m[0][3] = 0.0f;
599
600 m[1][0] = 0.0f;
601 m[1][1] = cot * SCALE_T;
602 m[1][2] = -TRANSLATE_T;
603 m[1][3] = 0.0f;
604
605 m[2][0] = 0.0f;
606 m[2][1] = 0.0f;
607 m[2][2] = -1.0f;
608 m[2][3] = 0.0f;
609
610 return *this;
611}
612
615 float l,
616 float r,
617 float b,
618 float t)
619{
620 static const float SCALE_S = 0.5f;
621 static const float SCALE_T = -0.5f;
622 static const float TRANSLATE_S = 0.5f;
623 static const float TRANSLATE_T = 0.5f;
624
625 NW_G3D_ASSERT(t != b);
626 NW_G3D_ASSERT(l != r);
627
628 float reverseWidth = 1.0f / (r - l);
629 m[0][0] = 2.0f * reverseWidth * SCALE_S;
630 m[0][1] = 0.0f;
631 m[0][2] = 0.0f;
632 m[0][3] = ((-(r + l) * reverseWidth) * SCALE_S) + TRANSLATE_S;
633
634 float reverseHeight = 1.0f / (t - b);
635 m[1][0] = 0.0f;
636 m[1][1] = (2.0f * reverseHeight) * SCALE_T;
637 m[1][2] = 0.0f;
638 m[1][3] = ((-(t + b) * reverseHeight) * SCALE_T) + TRANSLATE_T;
639
640 m[2][0] = 0.0f;
641 m[2][1] = 0.0f;
642 m[2][2] = 0.0f;
643 m[2][3] = 1.0f;
644
645 return *this;
646}
647
648} } } // namespace nw::g3d::math
Definition g3d_MathCommon.h:9
static void SinCos(float *pSin, float *pCos, float rad)
Definition g3d_MathCommon-inl.h:238
static float Sqrt(float x)
Definition g3d_MathCommon-inl.h:163
static float Tan(float rad)
Definition g3d_MathCommon-inl.h:205
static float Rcp(float x)
Definition g3d_MathCommon-inl.h:139
Definition g3d_Matrix34.h:34
Mtx34 & Mul(const Mtx34 &lhs, float rhs)
Definition g3d_Matrix34-inl.h:357
static float Det(const Mtx34 &m)
Definition g3d_Matrix34-inl.h:386
static float ExtractBaseScale(const Mtx34 &m, int axis)
Definition g3d_Matrix34-inl.h:503
Mtx34 & ScaleBases(const Mtx34 &m, const Vec3 &s)
Definition g3d_Matrix34-inl.h:484
Mtx34 & Inverse(float *pDet, const Mtx34 &m)
Definition g3d_Matrix34-inl.h:460
Mtx34 & Adjugate(const Mtx34 &m)
Definition g3d_Matrix34-inl.h:408
Mtx34 & InvTranspose(float *pDet, const Mtx34 &m)
Definition g3d_Matrix34-inl.h:471
Mtx34 & 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)
Definition g3d_Matrix34-inl.h:33
Mtx34 & Div(const Mtx34 &lhs, float rhs)
Definition g3d_Matrix34-inl.h:376
static Mtx34 * Cast(float *a)
Definition g3d_Matrix34-inl.h:21
Mtx34 & SetS(const Vec3 &s)
Definition g3d_Matrix34-inl.h:111
Mtx34 & Transpose(const Mtx34 &m)
Definition g3d_Matrix34-inl.h:396
Mtx34 & Set(const float *a)
Definition g3d_Matrix34-inl.h:45
Mtx34 & Add(const Mtx34 &lhs, const Mtx34 &rhs)
Definition g3d_Matrix34-inl.h:246
Mtx34 & SetR(const Quat &r)
Definition g3d_Matrix34-inl.h:150
Mtx34 & Mul(const Mtx34 &lhs, const Mtx34 &rhs)
Definition g3d_Matrix34-inl.h:284
Mtx34 & TexProjPerspective(float fovy, float aspect)
Definition g3d_Matrix34-inl.h:580
Mtx34 & SetSR(const Vec3 &s, const Quat &r)
Definition g3d_Matrix34-inl.h:216
Mtx34 & Neg(const Mtx34 &m)
Definition g3d_Matrix34-inl.h:92
Mtx34 & TexProjFrustum(float l, float r, float b, float t, float n)
Definition g3d_Matrix34-inl.h:549
Mtx34 & SetR(const Vec3 &r)
Definition g3d_Matrix34-inl.h:122
Mtx34 & Identity()
Definition g3d_Matrix34-inl.h:83
Mtx34 & Set(const Mtx34 &m)
Definition g3d_Matrix34-inl.h:56
Mtx34 & SetT(const Vec3 &t)
Definition g3d_Matrix34-inl.h:178
Mtx34 & Zero()
Definition g3d_Matrix34-inl.h:73
Mtx34 & LookAt(const Vec3 &camPos, const Vec3 &camUp, const Vec3 &target)
Definition g3d_Matrix34-inl.h:519
Mtx34 & Set(const Vec3 &x, const Vec3 &y, const Vec3 &z, const Vec3 &w)
Definition g3d_Matrix34-inl.h:66
static const Mtx34 * Cast(const float *a)
Definition g3d_Matrix34-inl.h:27
static Mtx34 Make(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23)
Definition g3d_Matrix34-inl.h:9
Mtx34 & Cofactor(const Mtx34 &m)
Definition g3d_Matrix34-inl.h:436
Mtx34 & Sub(const Mtx34 &lhs, const Mtx34 &rhs)
Definition g3d_Matrix34-inl.h:265
static float ExtractBaseScaleSq(const Mtx34 &m, int axis)
Definition g3d_Matrix34-inl.h:509
Mtx34 & TexProjOrtho(float l, float r, float b, float t)
Definition g3d_Matrix34-inl.h:614
Mtx34 & SetSR(const Vec3 &s, const Vec3 &r)
Definition g3d_Matrix34-inl.h:188
Definition g3d_Quaternion.h:28
Definition g3d_Vector3.h:30
Vec3 & Cross(const Vec3 &lhs, const Vec3 &rhs)
Definition g3d_Vector3-inl.h:276
float Normalize(const Vec3 &v)
Definition g3d_Vector3-inl.h:286
Vec3 & Sub(const Vec3 &lhs, const Vec3 &rhs)
Definition g3d_Vector3-inl.h:115
static float Dot(const Vec3 &lhs, const Vec3 &rhs)
Definition g3d_Vector3-inl.h:263
Vec4 & Set(const Vec4 &v)
Definition g3d_Vector4-inl.h:45
Vec4 & Set(float x, float y, float z, float w)
Definition g3d_Vector4-inl.h:24
#define NW_G3D_ASSERT_NOT_NULL(exp)
Definition g3d_assert.h:20
#define NW_G3D_ASSERT_INDEX_BOUNDS(index, size)
Definition g3d_assert.h:23
#define NW_G3D_ASSERT(exp)
Definition g3d_assert.h:17
#define NW_G3D_MATH_INLINE
Definition g3d_defs.h:69
Definition g3d_MathCommon.h:6
Definition g3d_GfxManage.cpp:10
Vec4 v[DIM_MAJOR]
Definition g3d_Matrix34.h:26
float m[DIM_MAJOR][DIM_MINOR]
Definition g3d_Matrix34.h:25
@ DIM_MAJOR
Definition g3d_Matrix34.h:14
@ DIM
Definition g3d_Matrix34.h:14
float a[DIM]
Definition g3d_Matrix34.h:24