5#ifndef __IRR_MATRIX_H_INCLUDED__
6#define __IRR_MATRIX_H_INCLUDED__
24#if defined( USE_MATRIX_TEST_DEBUG )
28 MatrixTest () : ID(0), Calls(0) {}
33static MatrixTest MTest;
71#if defined ( USE_MATRIX_TEST )
83#if defined ( USE_MATRIX_TEST )
102#if defined ( USE_MATRIX_TEST )
404#if defined ( USE_MATRIX_TEST )
408#if defined ( USE_MATRIX_TEST_DEBUG )
418#if defined ( USE_MATRIX_TEST )
421#if defined ( USE_MATRIX_TEST_DEBUG )
427 case EM4CONST_NOTHING:
430 case EM4CONST_IDENTITY:
431 case EM4CONST_INVERSE:
441#if defined ( USE_MATRIX_TEST )
444#if defined ( USE_MATRIX_TEST_DEBUG )
450 case EM4CONST_IDENTITY:
453 case EM4CONST_NOTHING:
458 case EM4CONST_TRANSPOSED:
459 other.getTransposed(*
this);
461 case EM4CONST_INVERSE:
462 if (!
other.getInverse(*
this))
465 case EM4CONST_INVERSE_TRANSPOSED:
466 if (!
other.getInverse(*
this))
469 *
this=getTransposed();
628#if defined ( USE_MATRIX_TEST )
630 if ( !
other.isIdentity() )
632 if ( this->isIdentity() )
634 return (*
this =
other);
639 return setbyproduct_nocheck(
temp,
other );
645 return setbyproduct_nocheck(
temp,
other );
677#if defined ( USE_MATRIX_TEST )
690#if defined ( USE_MATRIX_TEST )
707#if defined ( USE_MATRIX_TEST )
709 if ( this->isIdentity() )
711 if (
m2.isIdentity() )
756#if defined ( USE_MATRIX_TEST )
768#if defined ( USE_MATRIX_TEST )
780#if defined ( USE_MATRIX_TEST )
808 sqrtf(M[4] * M[4] + M[5] * M[5] + M[6] * M[6]),
809 sqrtf(M[8] * M[8] + M[9] * M[9] + M[10] * M[10]));
847 M[10] = (
T)(
cr*
cp );
848#if defined ( USE_MATRIX_TEST )
865 if (scale.Y<0 && scale.Z<0)
870 else if (scale.X<0 && scale.Z<0)
875 else if (scale.X<0 && scale.Y<0)
907 if (X < 0.0) X += 360.0;
908 if (Y < 0.0) Y += 360.0;
909 if (Z < 0.0) Z += 360.0;
939 M[10] = (
T)(
cr*
cp );
940#if defined ( USE_MATRIX_TEST )
952 const f64 t = 1.0 - c;
974#if defined ( USE_MATRIX_TEST )
987 M[0] = M[5] = M[10] = M[15] = (
T)1;
988#if defined ( USE_MATRIX_TEST )
1002#if defined ( USE_MATRIX_TEST )
1029#if defined ( USE_MATRIX_TEST )
1040 T dp=M[0] * M[4 ] + M[1] * M[5 ] + M[2 ] * M[6 ] + M[3 ] * M[7 ];
1043 dp = M[0] * M[8 ] + M[1] * M[9 ] + M[2 ] * M[10] + M[3 ] * M[11];
1046 dp = M[0] * M[12] + M[1] * M[13] + M[2 ] * M[14] + M[3 ] * M[15];
1049 dp = M[4] * M[8 ] + M[5] * M[9 ] + M[6 ] * M[10] + M[7 ] * M[11];
1052 dp = M[4] * M[12] + M[5] * M[13] + M[6 ] * M[14] + M[7 ] * M[15];
1055 dp = M[8] * M[12] + M[9] * M[13] + M[10] * M[14] + M[11] * M[15];
1069#if defined ( USE_MATRIX_TEST )
1074 if(
IR(M[1])!=0)
return false;
1075 if(
IR(M[2])!=0)
return false;
1076 if(
IR(M[3])!=0)
return false;
1078 if(
IR(M[4])!=0)
return false;
1080 if(
IR(M[6])!=0)
return false;
1081 if(
IR(M[7])!=0)
return false;
1083 if(
IR(M[8])!=0)
return false;
1084 if(
IR(M[9])!=0)
return false;
1086 if(
IR(M[11])!=0)
return false;
1088 if(
IR(M[12])!=0)
return false;
1089 if(
IR(M[13])!=0)
return false;
1090 if(
IR(M[13])!=0)
return false;
1093#if defined ( USE_MATRIX_TEST )
1113 out.X =
in.X*M[0] +
in.Y*M[4] +
in.Z*M[8];
1114 out.Y =
in.X*M[1] +
in.Y*M[5] +
in.Z*M[9];
1115 out.Z =
in.X*M[2] +
in.Y*M[6] +
in.Z*M[10];
1122 out[0] =
in.X*M[0] +
in.Y*M[4] +
in.Z*M[8];
1123 out[1] =
in.X*M[1] +
in.Y*M[5] +
in.Z*M[9];
1124 out[2] =
in.X*M[2] +
in.Y*M[6] +
in.Z*M[10];
1141 vector[0] =
vect.X*M[0] +
vect.Y*M[4] +
vect.Z*M[8] + M[12];
1142 vector[1] =
vect.X*M[1] +
vect.Y*M[5] +
vect.Z*M[9] + M[13];
1143 vector[2] =
vect.X*M[2] +
vect.Y*M[6] +
vect.Z*M[10] + M[14];
1153 out.X =
in.X*M[0] +
in.Y*M[4] +
in.Z*M[8] + M[12];
1154 out.Y =
in.X*M[1] +
in.Y*M[5] +
in.Z*M[9] + M[13];
1155 out.Z =
in.X*M[2] +
in.Y*M[6] +
in.Z*M[10] + M[14];
1162 out[0] =
in.X*M[0] +
in.Y*M[4] +
in.Z*M[8] + M[12];
1163 out[1] =
in.X*M[1] +
in.Y*M[5] +
in.Z*M[9] + M[13];
1164 out[2] =
in.X*M[2] +
in.Y*M[6] +
in.Z*M[10] + M[14];
1165 out[3] =
in.X*M[3] +
in.Y*M[7] +
in.Z*M[11] + M[15];
1171 out[0] =
in[0]*M[0] +
in[1]*M[4] +
in[2]*M[8] + M[12];
1172 out[1] =
in[0]*M[1] +
in[1]*M[5] +
in[2]*M[9] + M[13];
1173 out[2] =
in[0]*M[2] +
in[1]*M[6] +
in[2]*M[10] + M[14];
1198 transformPlane(
out );
1207#if defined ( USE_MATRIX_TEST )
1221#if defined ( USE_MATRIX_TEST )
1238 for (
u32 i = 0; i < 3; ++i)
1240 for (
u32 j = 0;
j < 3; ++
j)
1315#if defined ( USE_MATRIX_TEST )
1316 if ( this->isIdentity() )
1324 f32 d = (
m(0, 0) *
m(1, 1) -
m(0, 1) *
m(1, 0)) * (
m(2, 2) *
m(3, 3) -
m(2, 3) *
m(3, 2)) -
1325 (
m(0, 0) *
m(1, 2) -
m(0, 2) *
m(1, 0)) * (
m(2, 1) *
m(3, 3) -
m(2, 3) *
m(3, 1)) +
1326 (
m(0, 0) *
m(1, 3) -
m(0, 3) *
m(1, 0)) * (
m(2, 1) *
m(3, 2) -
m(2, 2) *
m(3, 1)) +
1327 (
m(0, 1) *
m(1, 2) -
m(0, 2) *
m(1, 1)) * (
m(2, 0) *
m(3, 3) -
m(2, 3) *
m(3, 0)) -
1328 (
m(0, 1) *
m(1, 3) -
m(0, 3) *
m(1, 1)) * (
m(2, 0) *
m(3, 2) -
m(2, 2) *
m(3, 0)) +
1329 (
m(0, 2) *
m(1, 3) -
m(0, 3) *
m(1, 2)) * (
m(2, 0) *
m(3, 1) -
m(2, 1) *
m(3, 0));
1336 out(0, 0) =
d * (
m(1, 1) * (
m(2, 2) *
m(3, 3) -
m(2, 3) *
m(3, 2)) +
1337 m(1, 2) * (
m(2, 3) *
m(3, 1) -
m(2, 1) *
m(3, 3)) +
1338 m(1, 3) * (
m(2, 1) *
m(3, 2) -
m(2, 2) *
m(3, 1)));
1339 out(0, 1) =
d * (
m(2, 1) * (
m(0, 2) *
m(3, 3) -
m(0, 3) *
m(3, 2)) +
1340 m(2, 2) * (
m(0, 3) *
m(3, 1) -
m(0, 1) *
m(3, 3)) +
1341 m(2, 3) * (
m(0, 1) *
m(3, 2) -
m(0, 2) *
m(3, 1)));
1342 out(0, 2) =
d * (
m(3, 1) * (
m(0, 2) *
m(1, 3) -
m(0, 3) *
m(1, 2)) +
1343 m(3, 2) * (
m(0, 3) *
m(1, 1) -
m(0, 1) *
m(1, 3)) +
1344 m(3, 3) * (
m(0, 1) *
m(1, 2) -
m(0, 2) *
m(1, 1)));
1345 out(0, 3) =
d * (
m(0, 1) * (
m(1, 3) *
m(2, 2) -
m(1, 2) *
m(2, 3)) +
1346 m(0, 2) * (
m(1, 1) *
m(2, 3) -
m(1, 3) *
m(2, 1)) +
1347 m(0, 3) * (
m(1, 2) *
m(2, 1) -
m(1, 1) *
m(2, 2)));
1348 out(1, 0) =
d * (
m(1, 2) * (
m(2, 0) *
m(3, 3) -
m(2, 3) *
m(3, 0)) +
1349 m(1, 3) * (
m(2, 2) *
m(3, 0) -
m(2, 0) *
m(3, 2)) +
1350 m(1, 0) * (
m(2, 3) *
m(3, 2) -
m(2, 2) *
m(3, 3)));
1351 out(1, 1) =
d * (
m(2, 2) * (
m(0, 0) *
m(3, 3) -
m(0, 3) *
m(3, 0)) +
1352 m(2, 3) * (
m(0, 2) *
m(3, 0) -
m(0, 0) *
m(3, 2)) +
1353 m(2, 0) * (
m(0, 3) *
m(3, 2) -
m(0, 2) *
m(3, 3)));
1354 out(1, 2) =
d * (
m(3, 2) * (
m(0, 0) *
m(1, 3) -
m(0, 3) *
m(1, 0)) +
1355 m(3, 3) * (
m(0, 2) *
m(1, 0) -
m(0, 0) *
m(1, 2)) +
1356 m(3, 0) * (
m(0, 3) *
m(1, 2) -
m(0, 2) *
m(1, 3)));
1357 out(1, 3) =
d * (
m(0, 2) * (
m(1, 3) *
m(2, 0) -
m(1, 0) *
m(2, 3)) +
1358 m(0, 3) * (
m(1, 0) *
m(2, 2) -
m(1, 2) *
m(2, 0)) +
1359 m(0, 0) * (
m(1, 2) *
m(2, 3) -
m(1, 3) *
m(2, 2)));
1360 out(2, 0) =
d * (
m(1, 3) * (
m(2, 0) *
m(3, 1) -
m(2, 1) *
m(3, 0)) +
1361 m(1, 0) * (
m(2, 1) *
m(3, 3) -
m(2, 3) *
m(3, 1)) +
1362 m(1, 1) * (
m(2, 3) *
m(3, 0) -
m(2, 0) *
m(3, 3)));
1363 out(2, 1) =
d * (
m(2, 3) * (
m(0, 0) *
m(3, 1) -
m(0, 1) *
m(3, 0)) +
1364 m(2, 0) * (
m(0, 1) *
m(3, 3) -
m(0, 3) *
m(3, 1)) +
1365 m(2, 1) * (
m(0, 3) *
m(3, 0) -
m(0, 0) *
m(3, 3)));
1366 out(2, 2) =
d * (
m(3, 3) * (
m(0, 0) *
m(1, 1) -
m(0, 1) *
m(1, 0)) +
1367 m(3, 0) * (
m(0, 1) *
m(1, 3) -
m(0, 3) *
m(1, 1)) +
1368 m(3, 1) * (
m(0, 3) *
m(1, 0) -
m(0, 0) *
m(1, 3)));
1369 out(2, 3) =
d * (
m(0, 3) * (
m(1, 1) *
m(2, 0) -
m(1, 0) *
m(2, 1)) +
1370 m(0, 0) * (
m(1, 3) *
m(2, 1) -
m(1, 1) *
m(2, 3)) +
1371 m(0, 1) * (
m(1, 0) *
m(2, 3) -
m(1, 3) *
m(2, 0)));
1372 out(3, 0) =
d * (
m(1, 0) * (
m(2, 2) *
m(3, 1) -
m(2, 1) *
m(3, 2)) +
1373 m(1, 1) * (
m(2, 0) *
m(3, 2) -
m(2, 2) *
m(3, 0)) +
1374 m(1, 2) * (
m(2, 1) *
m(3, 0) -
m(2, 0) *
m(3, 1)));
1375 out(3, 1) =
d * (
m(2, 0) * (
m(0, 2) *
m(3, 1) -
m(0, 1) *
m(3, 2)) +
1376 m(2, 1) * (
m(0, 0) *
m(3, 2) -
m(0, 2) *
m(3, 0)) +
1377 m(2, 2) * (
m(0, 1) *
m(3, 0) -
m(0, 0) *
m(3, 1)));
1378 out(3, 2) =
d * (
m(3, 0) * (
m(0, 2) *
m(1, 1) -
m(0, 1) *
m(1, 2)) +
1379 m(3, 1) * (
m(0, 0) *
m(1, 2) -
m(0, 2) *
m(1, 0)) +
1380 m(3, 2) * (
m(0, 1) *
m(1, 0) -
m(0, 0) *
m(1, 1)));
1381 out(3, 3) =
d * (
m(0, 0) * (
m(1, 1) *
m(2, 2) -
m(1, 2) *
m(2, 1)) +
1382 m(0, 1) * (
m(1, 2) *
m(2, 0) -
m(1, 0) *
m(2, 2)) +
1383 m(0, 2) * (
m(1, 0) *
m(2, 1) -
m(1, 1) *
m(2, 0)));
1385#if defined ( USE_MATRIX_TEST )
1412 out.M[12] = (
T)-(M[12]*M[0] + M[13]*M[1] + M[14]*M[2]);
1413 out.M[13] = (
T)-(M[12]*M[4] + M[13]*M[5] + M[14]*M[6]);
1414 out.M[14] = (
T)-(M[12]*M[8] + M[13]*M[9] + M[14]*M[10]);
1417#if defined ( USE_MATRIX_TEST )
1428#if defined ( USE_MATRIX_TEST )
1434 if (getInverse(
temp))
1450#if defined ( USE_MATRIX_TEST )
1460 for (
s32 i = 0; i < 16; ++i)
1463#if defined ( USE_MATRIX_TEST )
1473#if defined ( USE_MATRIX_TEST )
1477 for (
s32 i = 0; i < 16; ++i)
1478 if (M[i] !=
other.M[i])
1488 return !(*
this ==
other);
1524#if defined ( USE_MATRIX_TEST )
1561#if defined ( USE_MATRIX_TEST )
1597#if defined ( USE_MATRIX_TEST )
1632#if defined ( USE_MATRIX_TEST )
1667#if defined ( USE_MATRIX_TEST )
1702#if defined ( USE_MATRIX_TEST )
1736#if defined ( USE_MATRIX_TEST )
1747 plane.Normal.normalize();
1769#if defined ( USE_MATRIX_TEST )
1805 M[12] = (
T)-
xaxis.dotProduct(position);
1806 M[13] = (
T)-
yaxis.dotProduct(position);
1807 M[14] = (
T)-
zaxis.dotProduct(position);
1809#if defined ( USE_MATRIX_TEST )
1846 M[12] = (
T)-
xaxis.dotProduct(position);
1847 M[13] = (
T)-
yaxis.dotProduct(position);
1848 M[14] = (
T)-
zaxis.dotProduct(position);
1850#if defined ( USE_MATRIX_TEST )
1863 for (
u32 i=0; i < 16; i += 4)
1865 mat.M[i+0] = (
T)(M[i+0] + ( b.M[i+0] - M[i+0] ) *
time);
1866 mat.M[i+1] = (
T)(M[i+1] + ( b.M[i+1] - M[i+1] ) *
time);
1867 mat.M[i+2] = (
T)(M[i+2] + ( b.M[i+2] - M[i+2] ) *
time);
1868 mat.M[i+3] = (
T)(M[i+3] + ( b.M[i+3] - M[i+3] ) *
time);
1879 getTransposed (
t );
1907#if defined ( USE_MATRIX_TEST )
1956 M[0] =
vt.X * v.
X +
ca;
1957 M[5] =
vt.Y * v.
Y +
ca;
1958 M[10] =
vt.Z * v.
Z +
ca;
2017 M[0] =
static_cast<T>(
vt.X *
up.X +
ca);
2018 M[5] =
static_cast<T>(
vt.Y *
up.Y +
ca);
2019 M[10] =
static_cast<T>(
vt.Z *
up.Z +
ca);
2025 M[1] =
static_cast<T>(
vt.X -
vs.Z);
2026 M[2] =
static_cast<T>(
vt.Z +
vs.Y);
2029 M[4] =
static_cast<T>(
vt.X +
vs.Z);
2030 M[6] =
static_cast<T>(
vt.Y -
vs.X);
2033 M[8] =
static_cast<T>(
vt.Z -
vs.Y);
2034 M[9] =
static_cast<T>(
vt.Y +
vs.X);
2049#if defined ( USE_MATRIX_TEST )
2075 M[0] = (
T)(c * scale.
X);
2076 M[1] = (
T)(s * scale.
Y);
2080 M[4] = (
T)(-s * scale.
X);
2081 M[5] = (
T)(c * scale.
Y);
2094#if defined ( USE_MATRIX_TEST )
2113 M[8] = (
T)(0.5f * ( s - c) + 0.5f);
2114 M[9] = (
T)(-0.5f * ( s + c) + 0.5f);
2116#if defined ( USE_MATRIX_TEST )
2129#if defined ( USE_MATRIX_TEST )
2142#if defined ( USE_MATRIX_TEST )
2153#if defined ( USE_MATRIX_TEST )
2165 M[8] = (
T)(0.5f - 0.5f *
sx);
2166 M[9] = (
T)(0.5f - 0.5f *
sy);
2168#if defined ( USE_MATRIX_TEST )
2181#if defined ( USE_MATRIX_TEST )
2192#if defined ( USE_MATRIX_TEST )
2202#if defined ( USE_MATRIX_TEST )
2214#if defined ( USE_MATRIX_TEST )
2218 for (
s32 i = 0; i < 16; ++i)
#define IRRLICHT_API
Set FPU settings.
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
bool isIdentity() const
Returns true if the matrix is the identity matrix.
CMatrix4< T > & setRotationRadians(const vector3d< T > &rotation)
Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
CMatrix4< T > & setScale(const T scale)
Set Scale.
void transformBox(core::aabbox3d< f32 > &box) const
Transforms a axis aligned bounding box.
T & operator()(const s32 row, const s32 col)
Simple operator for directly accessing every element of the matrix.
T & operator[](u32 index)
Simple operator for linearly accessing every element of the matrix.
CMatrix4< T > & buildProjectionMatrixPerspectiveFovLH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar)
Builds a left-handed perspective projection matrix based on a field of view.
CMatrix4< T > & setInverseRotationRadians(const vector3d< T > &rotation)
Make an inverted rotation matrix from Euler angles.
void multiplyWith1x4Matrix(T *matrix) const
Multiplies this matrix by a 1x4 matrix.
CMatrix4< T > & operator-=(const CMatrix4< T > &other)
Subtract another matrix.
CMatrix4< T > & setInverseTranslation(const vector3d< T > &translation)
Set the inverse translation of the current matrix. Will erase any previous values.
core::vector3d< T > getScale() const
Get Scale.
const T & operator[](u32 index) const
Simple operator for linearly accessing every element of the matrix.
CMatrix4< T > & setTextureTranslate(f32 x, f32 y)
Set texture transformation translation.
CMatrix4< T > & setRotationAxisRadians(const T &angle, const vector3d< T > &axis)
Make a rotation matrix from angle and axis, assuming left handed rotation.
void transformBoxEx(core::aabbox3d< f32 > &box) const
Transforms a axis aligned bounding box.
bool getInverse(CMatrix4< T > &out) const
Gets the inversed matrix of this one.
CMatrix4< T > interpolate(const core::CMatrix4< T > &b, f32 time) const
Creates a new matrix as interpolated matrix from two other ones.
CMatrix4< T > & buildProjectionMatrixPerspectiveFovInfinityLH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 epsilon=0)
Builds a left-handed perspective projection matrix based on a field of view, with far plane at infini...
bool makeInverse()
Calculates inverse of matrix. Slow.
CMatrix4< T > & setTextureRotationCenter(f32 radAngle)
Set texture transformation rotation.
void rotateVect(vector3df &vect) const
Rotate a vector by the rotation part of this matrix.
CMatrix4< T > & makeIdentity()
Set matrix to identity.
CMatrix4< T > & setScale(const vector3d< T > &scale)
Set Scale.
CMatrix4< T > & operator=(const CMatrix4< T > &other)
Sets this matrix equal to the other matrix.
CMatrix4< T > & buildRotateFromTo(const core::vector3df &from, const core::vector3df &to)
Builds a matrix that rotates from one vector to another.
void transformVect(vector3df &vect) const
Transforms the vector by this matrix.
CMatrix4< T > & setbyproduct_nocheck(const CMatrix4< T > &other_a, const CMatrix4< T > &other_b)
Set this matrix to the product of two matrices.
vector3d< T > getTranslation() const
Gets the current translation.
CMatrix4< T > & buildShadowMatrix(const core::vector3df &light, core::plane3df plane, f32 point=1.0f)
Builds a matrix that flattens geometry into a plane.
bool operator!=(const CMatrix4< T > &other) const
Returns true if other matrix is not equal to this matrix.
CMatrix4< T > & buildProjectionMatrixPerspectiveFovRH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar)
Builds a right-handed perspective projection matrix based on a field of view.
const T & operator()(const s32 row, const s32 col) const
Simple operator for directly accessing every element of the matrix.
CMatrix4< T > & buildCameraLookAtMatrixRH(const vector3df &position, const vector3df &target, const vector3df &upVector)
Builds a right-handed look-at matrix.
CMatrix4< T > & buildProjectionMatrixPerspectiveRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
Builds a right-handed perspective projection matrix.
const T * pointer() const
Returns pointer to internal array.
bool isOrthogonal() const
Returns true if the matrix is orthogonal.
CMatrix4< T > getTransposed() const
Gets transposed matrix.
void inverseTranslateVect(vector3df &vect) const
Translate a vector by the inverse of the translation part of this matrix.
CMatrix4< T > & buildCameraLookAtMatrixLH(const vector3df &position, const vector3df &target, const vector3df &upVector)
Builds a left-handed look-at matrix.
eConstructor
Constructor Flags.
@ EM4CONST_INVERSE_TRANSPOSED
CMatrix4< T > & setTextureTranslateTransposed(f32 x, f32 y)
Set texture transformation translation, using a transposed representation.
void setRotationCenter(const core::vector3df ¢er, const core::vector3df &translate)
Builds a combined matrix which translates to a center before rotation and translates from origin afte...
CMatrix4< T > & buildProjectionMatrixPerspectiveLH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
Builds a left-handed perspective projection matrix.
CMatrix4< T > & setbyproduct(const CMatrix4< T > &other_a, const CMatrix4< T > &other_b)
set this matrix to the product of two matrices
void setDefinitelyIdentityMatrix(bool isDefinitelyIdentityMatrix)
Sets if the matrix is definitely identity matrix.
CMatrix4< T > & buildNDCToDCMatrix(const core::rect< s32 > &area, f32 zScale)
Builds a matrix which transforms a normalized Device Coordinate to Device Coordinates.
CMatrix4< T > & setRotationDegrees(const vector3d< T > &rotation)
Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
void transformPlane(core::plane3d< f32 > &plane) const
Transforms a plane by this matrix.
bool getInversePrimitive(CMatrix4< T > &out) const
Inverts a primitive matrix which only contains a translation and a rotation.
CMatrix4< T > operator-(const CMatrix4< T > &other) const
Subtract another matrix.
void transformVec3(T *out, const T *in) const
An alternate transform vector method, reading from and writing to an array of 3 floats.
bool operator==(const CMatrix4< T > &other) const
Returns true if other matrix is equal to this matrix.
bool equals(const core::CMatrix4< T > &other, const T tolerance=(T) ROUNDING_ERROR_f64) const
Compare two matrices using the equal method.
CMatrix4< T > & setTranslation(const vector3d< T > &translation)
Set the translation of the current matrix. Will erase any previous values.
void translateVect(vector3df &vect) const
Translate a vector by the translation part of this matrix.
CMatrix4< T > & operator*=(const CMatrix4< T > &other)
Multiply by another matrix.
CMatrix4< T > operator+(const CMatrix4< T > &other) const
Add another matrix.
void buildAxisAlignedBillboard(const core::vector3df &camPos, const core::vector3df ¢er, const core::vector3df &translation, const core::vector3df &axis, const core::vector3df &from)
Builds a matrix which rotates a source vector to a look vector over an arbitrary axis.
core::vector3d< T > getRotationDegrees() const
Returns the rotation, as set by setRotation().
bool isIdentity_integer_base() const
Returns true if the matrix is the identity matrix.
CMatrix4< T > & setTextureScaleCenter(f32 sx, f32 sy)
Set texture transformation scale, and recenter at (0.5,0.5)
CMatrix4< T > & buildProjectionMatrixOrthoLH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
Builds a left-handed orthogonal projection matrix.
CMatrix4< T > & setM(const T *data)
Sets all matrix data members at once.
CMatrix4< T > & buildProjectionMatrixOrthoRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
Builds a right-handed orthogonal projection matrix.
CMatrix4< T > & setTextureScale(f32 sx, f32 sy)
Set texture transformation scale.
void inverseRotateVect(vector3df &vect) const
Rotate a vector by the inverse of the rotation part of this matrix.
CMatrix4< T > operator*(const CMatrix4< T > &other) const
Multiply by another matrix.
bool getDefinitelyIdentityMatrix() const
Gets if the matrix is definitely identity matrix.
CMatrix4(eConstructor constructor=EM4CONST_IDENTITY)
Default constructor.
CMatrix4< T > & operator+=(const CMatrix4< T > &other)
Add another matrix.
CMatrix4< T > & buildTextureTransform(f32 rotateRad, const core::vector2df &rotatecenter, const core::vector2df &translate, const core::vector2df &scale)
Set to a texture transformation matrix with the given parameters.
CMatrix4< T > & setInverseRotationDegrees(const vector3d< T > &rotation)
Make an inverted rotation matrix from Euler angles.
Axis aligned bounding box in 3d dimensional space.
vector3d< T > MaxEdge
The far edge.
vector3d< T > MinEdge
The near edge.
void repair()
Repairs the box.
aabbox3d()
Default Constructor.
T X
X coordinate of vector.
T Y
Y coordinate of vector.
T X
X coordinate of the vector.
vector3d< T > & normalize()
Normalizes the vector.
T Z
Z coordinate of the vector.
T dotProduct(const vector3d< T > &other) const
Get the dot product with another vector.
T Y
Y coordinate of the vector.
#define _IRR_DEBUG_BREAK_IF(_CONDITION_)
define a break macro for debugging.
#define _IRR_DEPRECATED_
Defines a deprecated macro which generates a warning at compile time.
const f32 DEGTORAD
32bit Constant for converting from degrees to radians
CMatrix4< T > operator*(const T scalar, const CMatrix4< T > &mat)
const T clamp(const T &value, const T &low, const T &high)
clamps a value between low and high
CMatrix4< f32 > matrix4
Typedef for f32 matrix.
const f64 ROUNDING_ERROR_f64
REALINLINE f32 reciprocal(const f32 f)
bool equals(const f64 a, const f64 b, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals b, taking possible rounding errors into account
IRRLICHT_API const matrix4 IdentityMatrix
global const identity matrix
const f64 RADTODEG64
64bit constant for converting from radians to degrees
bool iszero(const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals zero, taking rounding errors into account
Everything in the Irrlicht Engine can be found in this namespace.
float f32
32 bit floating point variable.
unsigned int u32
32 bit unsigned variable.
double f64
64 bit floating point variable.
signed int s32
32 bit signed variable.