mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
EMI: render scene in correct orientation
This commit is contained in:
@@ -188,6 +188,18 @@ void GfxOpenGL::setupCamera(float fov, float nclip, float fclip, float roll) {
|
||||
void GfxOpenGL::positionCamera(Math::Vector3d pos, Math::Vector3d interest) {
|
||||
Math::Vector3d up_vec(0, 0, 1);
|
||||
|
||||
// EMI only: transform XYZ to YXZ
|
||||
if (g_grim->getGameType() == GType_MONKEY4) {
|
||||
static const float EMI_MATRIX[] = {
|
||||
0,1,0,0,
|
||||
1,0,0,0,
|
||||
0,0,1,0,
|
||||
0,0,0,1
|
||||
};
|
||||
|
||||
glMultMatrixf(EMI_MATRIX);
|
||||
}
|
||||
|
||||
if (pos.x() == interest.x() && pos.y() == interest.y())
|
||||
up_vec = Math::Vector3d(0, 1, 0);
|
||||
|
||||
@@ -347,9 +359,16 @@ void GfxOpenGL::startActorDraw(Math::Vector3d pos, float scale, const Math::Angl
|
||||
}
|
||||
glTranslatef(pos.x(), pos.y(), pos.z());
|
||||
glScalef(scale, scale, scale);
|
||||
glRotatef(yaw.getDegrees(), 0, 0, 1);
|
||||
glRotatef(pitch.getDegrees(), 1, 0, 0);
|
||||
glRotatef(roll.getDegrees(), 0, 1, 0);
|
||||
// EMI uses Y axis as down-up, so we need to rotate differently.
|
||||
if (g_grim->getGameType() == GType_MONKEY4) {
|
||||
glRotatef(yaw.getDegrees(), 0, -1, 0);
|
||||
glRotatef(pitch.getDegrees(), 1, 0, 0);
|
||||
glRotatef(roll.getDegrees(), 0, 0, 1);
|
||||
} else {
|
||||
glRotatef(yaw.getDegrees(), 0, 0, 1);
|
||||
glRotatef(pitch.getDegrees(), 1, 0, 0);
|
||||
glRotatef(roll.getDegrees(), 0, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void GfxOpenGL::finishActorDraw() {
|
||||
|
||||
@@ -287,6 +287,18 @@ void GfxTinyGL::setupCamera(float fov, float nclip, float fclip, float roll) {
|
||||
void GfxTinyGL::positionCamera(Math::Vector3d pos, Math::Vector3d interest) {
|
||||
Math::Vector3d up_vec(0, 0, 1);
|
||||
|
||||
// EMI only: transform XYZ to YXZ
|
||||
if (g_grim->getGameType() == GType_MONKEY4) {
|
||||
static const float EMI_MATRIX[] = {
|
||||
0,1,0,0,
|
||||
1,0,0,0,
|
||||
0,0,1,0,
|
||||
0,0,0,1
|
||||
};
|
||||
|
||||
tglMultMatrixf(EMI_MATRIX);
|
||||
}
|
||||
|
||||
if (pos.x() == interest.x() && pos.y() == interest.y())
|
||||
up_vec = Math::Vector3d(0, 1, 0);
|
||||
|
||||
@@ -464,9 +476,16 @@ void GfxTinyGL::startActorDraw(Math::Vector3d pos, float scale, const Math::Angl
|
||||
|
||||
tglTranslatef(pos.x(), pos.y(), pos.z());
|
||||
tglScalef(scale, scale, scale);
|
||||
tglRotatef(yaw.getDegrees(), 0, 0, 1);
|
||||
tglRotatef(pitch.getDegrees(), 1, 0, 0);
|
||||
tglRotatef(roll.getDegrees(), 0, 1, 0);
|
||||
// EMI uses Y axis as down-up, so we need to rotate differently.
|
||||
if (g_grim->getGameType() == GType_MONKEY4) {
|
||||
tglRotatef(yaw.getDegrees(), 0, -1, 0);
|
||||
tglRotatef(pitch.getDegrees(), 1, 0, 0);
|
||||
tglRotatef(roll.getDegrees(), 0, 0, 1);
|
||||
} else {
|
||||
tglRotatef(yaw.getDegrees(), 0, 0, 1);
|
||||
tglRotatef(pitch.getDegrees(), 1, 0, 0);
|
||||
tglRotatef(roll.getDegrees(), 0, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void GfxTinyGL::finishActorDraw() {
|
||||
|
||||
Reference in New Issue
Block a user