diff options
author | aap <aap@papnet.eu> | 2019-06-24 23:11:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-24 23:11:56 +0200 |
commit | f07f411629b686338df10fdce217b2d258f38c92 (patch) | |
tree | cd07798b2daf33ea3a152e54cd18809da2cc9b2f /src/math/Matrix.h | |
parent | replaced some ctors; made PreRender call game function (diff) | |
parent | CPed, CVehicle, mostly entering/exiting car (diff) | |
download | re3-f07f411629b686338df10fdce217b2d258f38c92.tar re3-f07f411629b686338df10fdce217b2d258f38c92.tar.gz re3-f07f411629b686338df10fdce217b2d258f38c92.tar.bz2 re3-f07f411629b686338df10fdce217b2d258f38c92.tar.lz re3-f07f411629b686338df10fdce217b2d258f38c92.tar.xz re3-f07f411629b686338df10fdce217b2d258f38c92.tar.zst re3-f07f411629b686338df10fdce217b2d258f38c92.zip |
Diffstat (limited to 'src/math/Matrix.h')
-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(); |