EMI: Enable backface culling. Fixes #900

This commit is contained in:
Joni Vähämäki 2014-06-10 22:45:01 +03:00
parent 8f7ce221dc
commit d80c84ad97
3 changed files with 19 additions and 0 deletions

View file

@ -487,6 +487,9 @@ void GfxOpenGL::startActorDraw(const Actor *actor) {
} }
if (g_grim->getGameType() == GType_MONKEY4) { if (g_grim->getGameType() == GType_MONKEY4) {
glEnable(GL_CULL_FACE);
glFrontFace(GL_CW);
if (actor->isInOverworld()) { if (actor->isInOverworld()) {
const Math::Vector3d &pos = actor->getWorldPos(); const Math::Vector3d &pos = actor->getWorldPos();
const Math::Quaternion &quat = actor->getRotationQuat(); const Math::Quaternion &quat = actor->getRotationQuat();
@ -547,6 +550,9 @@ void GfxOpenGL::finishActorDraw() {
glColor3f(1.0f, 1.0f, 1.0f); glColor3f(1.0f, 1.0f, 1.0f);
glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_POLYGON_OFFSET_FILL);
} }
if (g_grim->getGameType() == GType_MONKEY4) {
glDisable(GL_CULL_FACE);
}
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
_currentActor = nullptr; _currentActor = nullptr;
} }

View file

@ -508,6 +508,9 @@ void GfxOpenGLS::startActorDraw(const Actor *actor) {
const float alpha = actor->getEffectiveAlpha(); const float alpha = actor->getEffectiveAlpha();
if (g_grim->getGameType() == GType_MONKEY4) { if (g_grim->getGameType() == GType_MONKEY4) {
glEnable(GL_CULL_FACE);
glFrontFace(GL_CW);
const Math::Matrix4 &viewMatrix = _currentQuat.toMatrix(); const Math::Matrix4 &viewMatrix = _currentQuat.toMatrix();
Math::Matrix4 modelMatrix = actor->getFinalMatrix(); Math::Matrix4 modelMatrix = actor->getFinalMatrix();
modelMatrix.transpose(); modelMatrix.transpose();
@ -589,6 +592,9 @@ void GfxOpenGLS::startActorDraw(const Actor *actor) {
void GfxOpenGLS::finishActorDraw() { void GfxOpenGLS::finishActorDraw() {
_currentActor = NULL; _currentActor = NULL;
glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_POLYGON_OFFSET_FILL);
if (g_grim->getGameType() == GType_MONKEY4) {
glDisable(GL_CULL_FACE);
}
} }
void GfxOpenGLS::setShadow(Shadow *shadow) { void GfxOpenGLS::setShadow(Shadow *shadow) {

View file

@ -615,6 +615,9 @@ void GfxTinyGL::startActorDraw(const Actor *actor) {
const float &scale = actor->getScale(); const float &scale = actor->getScale();
if (g_grim->getGameType() == GType_MONKEY4) { if (g_grim->getGameType() == GType_MONKEY4) {
tglEnable(TGL_CULL_FACE);
tglFrontFace(TGL_CW);
if (actor->isInOverworld()) { if (actor->isInOverworld()) {
const Math::Vector3d &pos = actor->getWorldPos(); const Math::Vector3d &pos = actor->getWorldPos();
tglMatrixMode(TGL_PROJECTION); tglMatrixMode(TGL_PROJECTION);
@ -686,6 +689,10 @@ void GfxTinyGL::finishActorDraw() {
} }
}*/ }*/
if (g_grim->getGameType() == GType_MONKEY4) {
tglDisable(TGL_CULL_FACE);
}
tglColorMask(TGL_TRUE, TGL_TRUE, TGL_TRUE, TGL_TRUE); tglColorMask(TGL_TRUE, TGL_TRUE, TGL_TRUE, TGL_TRUE);
_currentActor = nullptr; _currentActor = nullptr;
} }