38 memset(&
m_m,0,
sizeof(
m_m));
47 for(
int y=0;
y<4; ++
y)
49 for(
int x=0;
x<4; ++
x)
84 memcpy(
m_m,&_m.m_m,
sizeof(
m_m));
89 memcpy(
m_m,&_m.m_m,
sizeof(
m_m));
110 memset(&
m_m,0,
sizeof(
m_m));
116 memset(
m_m,0,
sizeof(
m_m));
192 temp.
m_m[0][0] =
m_m[0][0] * _m.m_m[0][0] +
m_m[0][1] * _m.m_m[1][0] +
m_m[0][2] * _m.m_m[2][0] +
m_m[0][3] * _m.m_m[3][0];
193 temp.
m_m[0][1] =
m_m[0][0] * _m.m_m[0][1] +
m_m[0][1] * _m.m_m[1][1] +
m_m[0][2] * _m.m_m[2][1] +
m_m[0][3] * _m.m_m[3][1];
194 temp.
m_m[0][2] =
m_m[0][0] * _m.m_m[0][2] +
m_m[0][1] * _m.m_m[1][2] +
m_m[0][2] * _m.m_m[2][2] +
m_m[0][3] * _m.m_m[3][2];
195 temp.
m_m[0][3] =
m_m[0][0] * _m.m_m[0][3] +
m_m[0][1] * _m.m_m[1][3] +
m_m[0][2] * _m.m_m[2][3] +
m_m[0][3] * _m.m_m[3][3];
196 temp.
m_m[1][0] =
m_m[1][0] * _m.m_m[0][0] +
m_m[1][1] * _m.m_m[1][0] +
m_m[1][2] * _m.m_m[2][0] +
m_m[1][3] * _m.m_m[3][0];
197 temp.
m_m[1][1] =
m_m[1][0] * _m.m_m[0][1] +
m_m[1][1] * _m.m_m[1][1] +
m_m[1][2] * _m.m_m[2][1] +
m_m[1][3] * _m.m_m[3][1];
198 temp.
m_m[1][2] =
m_m[1][0] * _m.m_m[0][2] +
m_m[1][1] * _m.m_m[1][2] +
m_m[1][2] * _m.m_m[2][2] +
m_m[1][3] * _m.m_m[3][2];
199 temp.
m_m[1][3] =
m_m[1][0] * _m.m_m[0][3] +
m_m[1][1] * _m.m_m[1][3] +
m_m[1][2] * _m.m_m[2][3] +
m_m[1][3] * _m.m_m[3][3];
200 temp.
m_m[2][0] =
m_m[2][0] * _m.m_m[0][0] +
m_m[2][1] * _m.m_m[1][0] +
m_m[2][2] * _m.m_m[2][0] +
m_m[2][3] * _m.m_m[3][0];
201 temp.
m_m[2][1] =
m_m[2][0] * _m.m_m[0][1] +
m_m[2][1] * _m.m_m[1][1] +
m_m[2][2] * _m.m_m[2][1] +
m_m[2][3] * _m.m_m[3][1];
202 temp.
m_m[2][2] =
m_m[2][0] * _m.m_m[0][2] +
m_m[2][1] * _m.m_m[1][2] +
m_m[2][2] * _m.m_m[2][2] +
m_m[2][3] * _m.m_m[3][2];
203 temp.
m_m[2][3] =
m_m[2][0] * _m.m_m[0][3] +
m_m[2][1] * _m.m_m[1][3] +
m_m[2][2] * _m.m_m[2][3] +
m_m[2][3] * _m.m_m[3][3];
204 temp.
m_m[3][0] =
m_m[3][0] * _m.m_m[0][0] +
m_m[3][1] * _m.m_m[1][0] +
m_m[3][2] * _m.m_m[2][0] +
m_m[3][3] * _m.m_m[3][0];
205 temp.
m_m[3][1] =
m_m[3][0] * _m.m_m[0][1] +
m_m[3][1] * _m.m_m[1][1] +
m_m[3][2] * _m.m_m[2][1] +
m_m[3][3] * _m.m_m[3][1];
206 temp.
m_m[3][2] =
m_m[3][0] * _m.m_m[0][2] +
m_m[3][1] * _m.m_m[1][2] +
m_m[3][2] * _m.m_m[2][2] +
m_m[3][3] * _m.m_m[3][2];
207 temp.
m_m[3][3] =
m_m[3][0] * _m.m_m[0][3] +
m_m[3][1] * _m.m_m[1][3] +
m_m[3][2] * _m.m_m[2][3] +
m_m[3][3] * _m.m_m[3][3];
312 const Real* iterB = &_m.m_openGL[0];
317 for( ; iterA !=
end; ++iterA, ++iterB, ++iterR)
319 *iterR = *iterA + *iterB;
337 const Real* iterB = &_m.m_openGL[0];
340 for( ; iterA !=
end; ++iterA, ++iterB)
354 for( ; iterA !=
end; ++iterA, ++iterB)
356 *iterB = (*iterA) * _i;
364 for(
int y=0;
y<4;
y++)
366 for(
int x=0;
x<4;
x++)
395 for(
int col=0; col<4; col++)
409 Real sr = sinf( beta );
410 Real cr = cosf( beta );
421 Real sr = sinf( beta );
422 Real cr = cosf( beta );
433 Real sr = sinf( beta );
434 Real cr = cosf( beta );
460 int ti, tj, idst=0, jdst=0;
462 for ( ti = 0; ti != 4; ++ti )
475 for ( tj = 0; tj != 4; ++tj )
485 if ( ti != _i && tj != _j )
487 o_mat[idst*3 + jdst] =
m_openGL[ti*4 + tj];
517 Real cosTheta = cosf((beta));
518 Real sinTheta = sinf((beta));
519 Real OneMinusCosTheta=1.0f-cosTheta;
527 m_m[0][0]=OneMinusCosTheta*(x*
x)+cosTheta;
528 m_m[0][1]=OneMinusCosTheta*(x*
y)-(z*sinTheta);
529 m_m[0][2]=OneMinusCosTheta*(x*
z)+(y*sinTheta);
533 m_m[1][0]=OneMinusCosTheta*(x*
y)+(z*sinTheta);
534 m_m[1][1]=OneMinusCosTheta*(y*
y)+cosTheta;
535 m_m[1][2]=OneMinusCosTheta*(y*
z)-(x*sinTheta);
542 m_m[2][0]=OneMinusCosTheta*(x*
z)-(y*sinTheta);
543 m_m[2][1]=OneMinusCosTheta*(y*
z)+(x*sinTheta);
544 m_m[2][2]=OneMinusCosTheta*(z*
z)+cosTheta;
571 Real S =
static_cast<Real>( 0.5f / sqrtf(T) );
572 return Quaternion( static_cast<Real>( ( m_openGL[6] - m_openGL[9] ) * S),
573 static_cast<Real>( ( m_openGL[8] - m_openGL[2] ) * S),
574 static_cast<Real>( ( m_openGL[1] - m_openGL[4] ) * S),
575 static_cast<Real>( 0.25
f / S)
578 Real BigF = m_openGL[0];
579 unsigned char check=0;
580 if( m_openGL[5] > BigF )
585 if( m_openGL[10] > BigF )
594 Real S =
static_cast<Real>( sqrtf( 1.0
f + m_openGL[0] - m_openGL[5] - m_openGL[10] ) * 2.0f );
597 (m_openGL[1] + m_openGL[4] ) / S,
598 (m_openGL[2] + m_openGL[8] ) / S,
599 (m_openGL[6] + m_openGL[9] ) / S );
603 Real S =
static_cast<Real>( sqrtf( 1.0
f + m_openGL[5] - m_openGL[0] - m_openGL[10] ) * 2.0f );
605 return Quaternion((m_openGL[1] + m_openGL[4] ) / S,
607 (m_openGL[6] + m_openGL[9] ) / S,
608 (m_openGL[2] + m_openGL[8] ) / S );
612 Real S =
static_cast<Real>( sqrtf( 1.0
f + m_openGL[10] - m_openGL[0] - m_openGL[5] ) * 2.0f );
614 return Quaternion((m_openGL[2] + m_openGL[8] ) / S,
615 (m_openGL[6] + m_openGL[9] ) / S,
617 (m_openGL[1] + m_openGL[4] ) / S );
621 NGL_ASSERT(0 &&
"SHOULDN'T GET HERE in ngl Quaternion");
634 m.
m_00 = _mat.m_m[1][1]*(_mat.m_m[2][2]*_mat.m_m[3][3]-_mat.m_m[3][2]*_mat.m_m[2][3])+_mat.m_m[1][2]*(_mat.m_m[3][1]*_mat.m_m[2][3]-_mat.m_m[2][1]*_mat.m_m[3][3])+_mat.m_m[1][3]*(_mat.m_m[2][1]*_mat.m_m[3][2]-_mat.m_m[3][1]*_mat.m_m[2][2]);
635 m.
m_01 = _mat.m_m[1][0]*(_mat.m_m[3][2]*_mat.m_m[2][3]-_mat.m_m[2][2]*_mat.m_m[3][3])+_mat.m_m[1][2]*(_mat.m_m[2][0]*_mat.m_m[3][3]-_mat.m_m[3][0]*_mat.m_m[2][3])+_mat.m_m[1][3]*(_mat.m_m[3][0]*_mat.m_m[2][2]-_mat.m_m[2][0]*_mat.m_m[3][2]);
636 m.
m_02 = _mat.m_m[1][0]*(_mat.m_m[2][1]*_mat.m_m[3][3]-_mat.m_m[3][1]*_mat.m_m[2][3])+_mat.m_m[1][1]*(_mat.m_m[3][0]*_mat.m_m[2][3]-_mat.m_m[2][0]*_mat.m_m[3][3])+_mat.m_m[1][3]*(_mat.m_m[2][0]*_mat.m_m[3][1]-_mat.m_m[3][0]*_mat.m_m[2][1]);
637 m.
m_03 = _mat.m_m[1][0]*(_mat.m_m[3][1]*_mat.m_m[2][2]-_mat.m_m[2][1]*_mat.m_m[3][2])+_mat.m_m[1][1]*(_mat.m_m[2][0]*_mat.m_m[3][2]-_mat.m_m[3][0]*_mat.m_m[2][2])+_mat.m_m[1][2]*(_mat.m_m[3][0]*_mat.m_m[2][1]-_mat.m_m[2][0]*_mat.m_m[3][1]);
639 m.
m_10 = _mat.m_m[0][1]*(_mat.m_m[3][2]*_mat.m_m[2][3]-_mat.m_m[2][2]*_mat.m_m[3][3])+_mat.m_m[0][2]*(_mat.m_m[2][1]*_mat.m_m[3][3]-_mat.m_m[3][1]*_mat.m_m[2][3])+_mat.m_m[0][3]*(_mat.m_m[3][1]*_mat.m_m[2][2]-_mat.m_m[2][1]*_mat.m_m[3][2]);
640 m.
m_11 = _mat.m_m[0][0]*(_mat.m_m[2][2]*_mat.m_m[3][3]-_mat.m_m[3][2]*_mat.m_m[2][3])+_mat.m_m[0][2]*(_mat.m_m[3][0]*_mat.m_m[2][3]-_mat.m_m[2][0]*_mat.m_m[3][3])+_mat.m_m[0][3]*(_mat.m_m[2][0]*_mat.m_m[3][2]-_mat.m_m[3][0]*_mat.m_m[2][2]);
641 m.
m_12 = _mat.m_m[0][0]*(_mat.m_m[3][1]*_mat.m_m[2][3]-_mat.m_m[2][1]*_mat.m_m[3][3])+_mat.m_m[0][1]*(_mat.m_m[2][0]*_mat.m_m[3][3]-_mat.m_m[3][0]*_mat.m_m[2][3])+_mat.m_m[0][3]*(_mat.m_m[3][0]*_mat.m_m[2][1]-_mat.m_m[2][0]*_mat.m_m[3][1]);
642 m.
m_13= _mat.m_m[0][0]*(_mat.m_m[2][1]*_mat.m_m[3][2]-_mat.m_m[3][1]*_mat.m_m[2][2])+_mat.m_m[0][1]*(_mat.m_m[3][0]*_mat.m_m[2][2]-_mat.m_m[2][0]*_mat.m_m[3][2])+_mat.m_m[0][2]*(_mat.m_m[2][0]*_mat.m_m[3][1]-_mat.m_m[3][0]*_mat.m_m[2][1]);
644 m.
m_20 = _mat.m_m[0][1]*(_mat.m_m[1][2]*_mat.m_m[3][3]-_mat.m_m[3][2]*_mat.m_m[1][3])+_mat.m_m[0][2]*(_mat.m_m[3][1]*_mat.m_m[1][3]-_mat.m_m[1][1]*_mat.m_m[3][3])+_mat.m_m[0][3]*(_mat.m_m[1][1]*_mat.m_m[3][2]-_mat.m_m[3][1]*_mat.m_m[1][2]);
645 m.
m_21 = _mat.m_m[0][0]*(_mat.m_m[3][2]*_mat.m_m[1][3]-_mat.m_m[1][2]*_mat.m_m[3][3])+_mat.m_m[0][2]*(_mat.m_m[1][0]*_mat.m_m[3][3]-_mat.m_m[3][0]*_mat.m_m[1][3])+_mat.m_m[0][3]*(_mat.m_m[3][0]*_mat.m_m[1][2]-_mat.m_m[1][0]*_mat.m_m[3][2]);
646 m.
m_22 = _mat.m_m[0][0]*(_mat.m_m[1][1]*_mat.m_m[3][3]-_mat.m_m[3][1]*_mat.m_m[1][3])+_mat.m_m[0][1]*(_mat.m_m[3][0]*_mat.m_m[1][3]-_mat.m_m[1][0]*_mat.m_m[3][3])+_mat.m_m[0][3]*(_mat.m_m[1][0]*_mat.m_m[3][1]-_mat.m_m[3][0]*_mat.m_m[1][1]);
647 m.
m_23 = _mat.m_m[0][0]*(_mat.m_m[3][1]*_mat.m_m[1][2]-_mat.m_m[1][1]*_mat.m_m[3][2])+_mat.m_m[0][1]*(_mat.m_m[1][0]*_mat.m_m[3][2]-_mat.m_m[3][0]*_mat.m_m[1][2])+_mat.m_m[0][2]*(_mat.m_m[3][0]*_mat.m_m[1][1]-_mat.m_m[1][0]*_mat.m_m[3][1]);
649 m.
m_30 = _mat.m_m[0][1]*(_mat.m_m[2][2]*_mat.m_m[1][3]-_mat.m_m[1][2]*_mat.m_m[2][3])+_mat.m_m[0][2]*(_mat.m_m[1][1]*_mat.m_m[2][3]-_mat.m_m[2][1]*_mat.m_m[1][3])+_mat.m_m[0][3]*(_mat.m_m[2][1]*_mat.m_m[1][2]-_mat.m_m[1][1]*_mat.m_m[2][2]);
650 m.
m_31 = _mat.m_m[0][0]*(_mat.m_m[1][2]*_mat.m_m[2][3]-_mat.m_m[2][2]*_mat.m_m[1][3])+_mat.m_m[0][2]*(_mat.m_m[2][0]*_mat.m_m[1][3]-_mat.m_m[1][0]*_mat.m_m[2][3])+_mat.m_m[0][3]*(_mat.m_m[1][0]*_mat.m_m[2][2]-_mat.m_m[2][0]*_mat.m_m[1][2]);
651 m.
m_32 = _mat.m_m[0][0]*(_mat.m_m[2][1]*_mat.m_m[1][3]-_mat.m_m[1][1]*_mat.m_m[2][3])+_mat.m_m[0][1]*(_mat.m_m[1][0]*_mat.m_m[2][3]-_mat.m_m[2][0]*_mat.m_m[1][3])+_mat.m_m[0][3]*(_mat.m_m[2][0]*_mat.m_m[1][1]-_mat.m_m[1][0]*_mat.m_m[2][1]);
652 m.
m_33 = _mat.m_m[0][0]*(_mat.m_m[1][1]*_mat.m_m[2][2]-_mat.m_m[2][1]*_mat.m_m[1][2])+_mat.m_m[0][1]*(_mat.m_m[2][0]*_mat.m_m[1][2]-_mat.m_m[1][0]*_mat.m_m[2][2])+_mat.m_m[0][2]*(_mat.m_m[1][0]*_mat.m_m[2][1]-_mat.m_m[2][0]*_mat.m_m[1][1]);
662 m.
m_01 = m_m[1][0]*(m_m[3][2]*m_m[2][3]-m_m[2][2]*m_m[3][3])+m_m[1][2]*(m_m[2][0]*m_m[3][3]-m_m[3][0]*m_m[2][3])+m_m[1][3]*(m_m[3][0]*m_m[2][2]-m_m[2][0]*m_m[3][2]);
663 m.
m_02 = m_m[1][0]*(m_m[2][1]*m_m[3][3]-m_m[3][1]*m_m[2][3])+m_m[1][1]*(m_m[3][0]*m_m[2][3]-m_m[2][0]*m_m[3][3])+m_m[1][3]*(m_m[2][0]*m_m[3][1]-m_m[3][0]*m_m[2][1]);
664 m.
m_03 = m_m[1][0]*(m_m[3][1]*m_m[2][2]-m_m[2][1]*m_m[3][2])+m_m[1][1]*(m_m[2][0]*m_m[3][2]-m_m[3][0]*m_m[2][2])+m_m[1][2]*(m_m[3][0]*m_m[2][1]-m_m[2][0]*m_m[3][1]);
666 m.
m_10 = m_m[0][1]*(m_m[3][2]*m_m[2][3]-m_m[2][2]*m_m[3][3])+m_m[0][2]*(m_m[2][1]*m_m[3][3]-m_m[3][1]*m_m[2][3])+m_m[0][3]*(m_m[3][1]*m_m[2][2]-m_m[2][1]*m_m[3][2]);
667 m.
m_11 = m_m[0][0]*(m_m[2][2]*m_m[3][3]-m_m[3][2]*m_m[2][3])+m_m[0][2]*(m_m[3][0]*m_m[2][3]-m_m[2][0]*m_m[3][3])+m_m[0][3]*(m_m[2][0]*m_m[3][2]-m_m[3][0]*m_m[2][2]);
668 m.
m_12 = m_m[0][0]*(m_m[3][1]*m_m[2][3]-m_m[2][1]*m_m[3][3])+m_m[0][1]*(m_m[2][0]*m_m[3][3]-m_m[3][0]*m_m[2][3])+m_m[0][3]*(m_m[3][0]*m_m[2][1]-m_m[2][0]*m_m[3][1]);
669 m.
m_13= m_m[0][0]*(m_m[2][1]*m_m[3][2]-m_m[3][1]*m_m[2][2])+m_m[0][1]*(m_m[3][0]*m_m[2][2]-m_m[2][0]*m_m[3][2])+m_m[0][2]*(m_m[2][0]*m_m[3][1]-m_m[3][0]*m_m[2][1]);
671 m.
m_20 = m_m[0][1]*(m_m[1][2]*m_m[3][3]-m_m[3][2]*m_m[1][3])+m_m[0][2]*(m_m[3][1]*m_m[1][3]-m_m[1][1]*m_m[3][3])+m_m[0][3]*(m_m[1][1]*m_m[3][2]-m_m[3][1]*m_m[1][2]);
672 m.
m_21 = m_m[0][0]*(m_m[3][2]*m_m[1][3]-m_m[1][2]*m_m[3][3])+m_m[0][2]*(m_m[1][0]*m_m[3][3]-m_m[3][0]*m_m[1][3])+m_m[0][3]*(m_m[3][0]*m_m[1][2]-m_m[1][0]*m_m[3][2]);
673 m.
m_22 = m_m[0][0]*(m_m[1][1]*m_m[3][3]-m_m[3][1]*m_m[1][3])+m_m[0][1]*(m_m[3][0]*m_m[1][3]-m_m[1][0]*m_m[3][3])+m_m[0][3]*(m_m[1][0]*m_m[3][1]-m_m[3][0]*m_m[1][1]);
674 m.
m_23 = m_m[0][0]*(m_m[3][1]*m_m[1][2]-m_m[1][1]*m_m[3][2])+m_m[0][1]*(m_m[1][0]*m_m[3][2]-m_m[3][0]*m_m[1][2])+m_m[0][2]*(m_m[3][0]*m_m[1][1]-m_m[1][0]*m_m[3][1]);
676 m.
m_30 = m_m[0][1]*(m_m[2][2]*m_m[1][3]-m_m[1][2]*m_m[2][3])+m_m[0][2]*(m_m[1][1]*m_m[2][3]-m_m[2][1]*m_m[1][3])+m_m[0][3]*(m_m[2][1]*m_m[1][2]-m_m[1][1]*m_m[2][2]);
677 m.
m_31 = m_m[0][0]*(m_m[1][2]*m_m[2][3]-m_m[2][2]*m_m[1][3])+m_m[0][2]*(m_m[2][0]*m_m[1][3]-m_m[1][0]*m_m[2][3])+m_m[0][3]*(m_m[1][0]*m_m[2][2]-m_m[2][0]*m_m[1][2]);
678 m.
m_32 = m_m[0][0]*(m_m[2][1]*m_m[1][3]-m_m[1][1]*m_m[2][3])+m_m[0][1]*(m_m[1][0]*m_m[2][3]-m_m[2][0]*m_m[1][3])+m_m[0][3]*(m_m[2][0]*m_m[1][1]-m_m[1][0]*m_m[2][1]);
679 m.
m_33 = m_m[0][0]*(m_m[1][1]*m_m[2][2]-m_m[2][1]*m_m[1][2])+m_m[0][1]*(m_m[2][0]*m_m[1][2]-m_m[1][0]*m_m[2][2])+m_m[0][2]*(m_m[1][0]*m_m[2][1]-m_m[2][0]*m_m[1][1]);
Mat4 Adjacent() noexcept
returns the ajacent matrix to this
some useful definitions and functions
Vec3 getBackVector() const noexcept
get the back vector of the matrix ( 3nd Row)
const Mat4 & operator+=(const Mat4 &_m) noexcept
+= operator
Real m_11
individual matrix element maps to m_m[1][1] or m_openGL[5]
Real m_21
individual matrix element maps to m_m[2][1] or m_openGL[9]
void as3x3Array(Real _d[9]) const noexcept
return the data as a 3x3 matrix
simple Vector class for OpenGL graphics, contains overloaded operators for most math functions...
const Mat4 & null() noexcept
clear the matrix to all 0
Real m_22
individual matrix element maps to m_m[2][2] or m_openGL[10]
const Mat4 & transpose() noexcept
method to transpose the matrix
Mat4 operator*(const Mat4 &_m) const noexcept
operator for matrix multiplication
void euler(const Real _angle, const Real _x, const Real _y, const Real _z) noexcept
axis / angle rotation using the Euler method
Real m_12
individual matrix element maps to m_m[1][2] or m_openGL[6]
Real m_31
individual matrix element maps to m_m[3][1] or m_openGL[13]
GLint GLint GLint GLint GLint GLint y
Real m_m[4][4]
matrix element m_m as a 4x4 array mapped by union to m_nn elements and m_openGL
Vec3 getDownVector() const noexcept
get the down vector of the matrix ( -ve 2nd Row)
simple Vec3 encapsulates a 3 float object like glsl vec3 but not maths use the Vec3 class for maths a...
implementation files for RibExport class
Mat4 & operator=(const Mat4 &_m) noexcept
assignment operator
Real determinant() const noexcept
get the determinant of the matrix
Real m_30
individual matrix element maps to m_m[3][0] or m_openGL[12]
void rotateZ(const Real _deg) noexcept
set this matrix to a rotation matrix in the Z axis for value _deg note the matrix should be set to id...
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
Real m_02
individual matrix element maps to m_m[0][2] or m_openGL[2]
Vec3 getRightVector() const noexcept
get the right vector of the matrix ( 1nd Row)
void scale(const Real _x, const Real _y, const Real _z) noexcept
set the matrix scale values
void setAtXY(GLint _x, GLint _y, Real _equals) noexcept
set the value at m_m[_x][_y] to _equals
void rotateY(const Real _deg) noexcept
set this matrix to a rotation matrix in the Y axis for value _deg note the matrix should be set to id...
void rotateX(const Real _deg) noexcept
set this matrix to a rotation matrix in the X axis for value _deg note the matrix should be set to id...
a simple 3 tuple container for compatibility with glsl
Real m_01
individual matrix element maps to m_m[0][1] or m_openGL[1]
Real m_00
individual matrix element maps to m_m[0][0] or m_openGL[0]
const Mat4 & identity() noexcept
make the matrix m the identity matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
Real m_10
individual matrix element maps to m_m[1][0] or m_openGL[4]
Mat4 inverse() noexcept
get the inverse of the matrix
Defines the class Quaternion based on John Vinces lecture notes basically we have a scalar part and t...
const Mat4 & operator*=(const Mat4 &_m) noexcept
operator to mult this matrix by value _m
Real m_13
individual matrix element maps to m_m[1][3] or m_openGL[7]
Real m_23
individual matrix element maps to m_m[2][3] or m_openGL[11]
Quaternion asQuaternion() const noexcept
convert this matrix to a Quaternion
Mat4 operator+(const Mat4 &_m) const noexcept
operator to add two matrices together
void translate(const Real _x, const Real _y, const Real _z) noexcept
set the matrix as a translation matrix
GLint GLint GLint GLint GLint x
#define NGL_ASSERT(X)
re-define the standard assert to work for ngl first check to see if assert is defined and undef it th...
Vec3 getUpVector() const noexcept
get the up vector of the matrix (2nd Row)
Real m_32
individual matrix element maps to m_m[3][2] or m_openGL[14]
NGL_DLLEXPORT Real radians(const Real _deg)
converts Degrees to Radians
Matrix Class to do simple matrix operations included operator overloaded functions for maths and matr...
Vec3 getForwardVector() const noexcept
get the forward vector of the matrix (-ve 3rd Row)
std::array< Real, 16 > m_openGL
The matrix in m_openGL 16 Real array format usefull for OpenGL fv formats mapped to m_m[][] elements ...
Real m_20
individual matrix element maps to m_m[2][0] or m_openGL[8]
Real m_w
w component 0 for vector 1 for point
void subMatrix3x3(const int _i, const int _j, Real o_mat[]) const noexcept
get a sub 3x3 matrix used in determinant and Inverse calculations
Real m_03
individual matrix element maps to m_m[0][3] or m_openGL[3]
Mat4() noexcept
ctor will always create an identity matrix
void normalize() noexcept
Normalize the vector using .
re impliment asserts so we don't exit on failure
Vec3 getLeftVector() const noexcept
get the left vector of the matrix (-ve 1st Row)
Real m_33
individual matrix element maps to m_m[3][3] or m_openGL[15]