mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
EMI/GRIM/MYST3: Replace some Quaternions with Rotation3D.
This commit is contained in:
parent
76d36f676b
commit
55f77fb92f
@ -2116,14 +2116,8 @@ const Math::Matrix4 Actor::getFinalMatrix() const {
|
||||
// which is not used in EMI. Actor::getFinalMatrix() is only used for EMI
|
||||
// so the additional scaling can be omitted.
|
||||
|
||||
// Math::Quaternion::fromEuler(getYaw(), getPitch(), getRoll()) can't
|
||||
// be used here since it seems to apply the rotations in a wrong order.
|
||||
// The used order was determined by testing.
|
||||
Math::Quaternion y = Math::Quaternion::fromEuler(getYaw(), 0, 0);
|
||||
Math::Quaternion p = Math::Quaternion::fromEuler(0, getPitch(), 0);
|
||||
Math::Quaternion r = Math::Quaternion::fromEuler(0, 0, getRoll());
|
||||
m = m * (r*y*p).toMatrix();
|
||||
|
||||
Math::Matrix4 rotMat(getRoll(), getYaw(), getPitch(), Math::EO_ZYX);
|
||||
m = m * rotMat;
|
||||
return m;
|
||||
}
|
||||
|
||||
|
@ -735,8 +735,8 @@ void GfxOpenGL::drawSprite(const Sprite *sprite) {
|
||||
if (g_grim->getGameType() == GType_MONKEY4) {
|
||||
GLdouble modelview[16];
|
||||
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
|
||||
const Math::Quaternion quat = Math::Quaternion::fromEuler(0, 0, _currentActor->getYaw());
|
||||
Math::Matrix4 act = quat.toMatrix();
|
||||
Math::Matrix4 act;
|
||||
act.buildAroundZ(_currentActor->getYaw());
|
||||
act.transpose();
|
||||
act(3,0) = modelview[12];
|
||||
act(3,1) = modelview[13];
|
||||
|
@ -837,8 +837,8 @@ void GfxOpenGLS::drawSprite(const Sprite *sprite) {
|
||||
|
||||
_spriteProgram->use();
|
||||
|
||||
const Math::Quaternion quat = Math::Quaternion::fromEuler(0, 0, _currentActor->getYaw());
|
||||
const Math::Matrix4 &rotateMatrix = quat.toMatrix();
|
||||
Math::Matrix4 rotateMatrix;
|
||||
rotateMatrix.buildAroundZ(_currentActor->getYaw());
|
||||
|
||||
Math::Matrix4 extraMatrix;
|
||||
extraMatrix.setPosition(sprite->_pos);
|
||||
|
@ -859,11 +859,11 @@ void GfxTinyGL::drawSprite(const Sprite *sprite) {
|
||||
tglGetFloatv(TGL_MODELVIEW_MATRIX, modelview);
|
||||
|
||||
if (g_grim->getGameType() == GType_MONKEY4) {
|
||||
const Math::Quaternion quat =
|
||||
_currentActor->isInOverworld()
|
||||
? Math::Quaternion::fromEuler(0, 0, _currentActor->getYaw())
|
||||
: Math::Quaternion::fromEuler(0, 0, _currentActor->getRoll());
|
||||
Math::Matrix4 act = quat.toMatrix();
|
||||
Math::Matrix4 act;
|
||||
if (_currentActor->isInOverworld())
|
||||
act.buildAroundZ(_currentActor->getYaw());
|
||||
else
|
||||
act.buildAroundZ(_currentActor->getRoll());
|
||||
act.transpose();
|
||||
act(3,0) = modelview[12];
|
||||
act(3,1) = modelview[13];
|
||||
|
@ -220,7 +220,7 @@ void ShaderRenderer::setupCameraPerspective(float pitch, float heading, float fo
|
||||
proj(3,3) = 0.0f;
|
||||
proj.transpose();
|
||||
|
||||
Math::Matrix4 model = Math::Quaternion::fromEuler(180.0f - heading, pitch, 0.0f).toMatrix();
|
||||
Math::Matrix4 model(pitch, 180.0f - heading, 0.0f, EO_ZXY);
|
||||
model.transpose();
|
||||
|
||||
_mvpMatrix = proj * model;
|
||||
|
Loading…
x
Reference in New Issue
Block a user