diff options
author | eray orçunus <erayorcunus@gmail.com> | 2019-06-24 16:57:54 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2019-06-24 23:01:40 +0200 |
commit | 1e09bf9c30094b4387431be4842876181a1425fe (patch) | |
tree | 22ee6dfa941b6cc85619973311c357f11acc1ef1 /src/math | |
parent | more Radar code (diff) | |
download | re3-1e09bf9c30094b4387431be4842876181a1425fe.tar re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.gz re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.bz2 re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.lz re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.xz re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.zst re3-1e09bf9c30094b4387431be4842876181a1425fe.zip |
Diffstat (limited to '')
-rw-r--r-- | src/math/Matrix.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/math/Matrix.h b/src/math/Matrix.h index a93de636..74e3d70d 100644 --- a/src/math/Matrix.h +++ b/src/math/Matrix.h @@ -145,6 +145,30 @@ public: m_matrix.pos.y = 0.0f; m_matrix.pos.z = 0.0f; } + void SetRotate(float xAngle, float yAngle, float zAngle) { + float cX = cos(xAngle); + float sX = sin(xAngle); + float cY = cos(yAngle); + float sY = sin(yAngle); + float cZ = cos(zAngle); + float sZ = sin(zAngle); + + m_matrix.right.x = cZ * cY - (sZ * sX) * sY; + m_matrix.right.y = (cZ * sX) * sY + sZ * cY; + m_matrix.right.z = -cX * sY; + + m_matrix.up.x = -sZ * cX; + m_matrix.up.y = cZ * cX; + m_matrix.up.z = sX; + + m_matrix.at.x = (sZ * sX) * cY + cZ * sY; + m_matrix.at.y = sZ * sY - (cZ * sX) * cY; + m_matrix.at.z = cX * cY; + + m_matrix.pos.x = 0.0f; + m_matrix.pos.y = 0.0f; + m_matrix.pos.z = 0.0f; + } void Reorthogonalise(void){ CVector &r = *GetRight(); CVector &f = *GetForward(); |