1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

Fix viewport for negative Y scale.

Fixed MK Subzero
This commit is contained in:
Sergey Lipskiy 2014-11-06 13:26:01 +06:00
parent c7961fbc28
commit ee2dcbde75
2 changed files with 8 additions and 3 deletions

View File

@ -518,10 +518,12 @@ void OGLRender::_updateViewport() const
{
OGLVideo & ogl = video();
if (!frameBufferList().isFboMode()) {
glViewport( (GLint)(gSP.viewport.x * ogl.getScaleX()), (GLint)((VI.height - (gSP.viewport.y + gSP.viewport.height)) * ogl.getScaleY() + ogl.getHeightOffset()),
const GLint Y = gSP.viewport.vscale[1] < 0 ? (GLint)((gSP.viewport.y + gSP.viewport.vscale[1]*2.0f) * ogl.getScaleY()) : (GLint)((VI.height - (gSP.viewport.y + gSP.viewport.height)) * ogl.getScaleY());
glViewport( (GLint)(gSP.viewport.x * ogl.getScaleX()), Y + ogl.getHeightOffset(),
max((GLint)(gSP.viewport.width * ogl.getScaleX()), 0), max((GLint)(gSP.viewport.height * ogl.getScaleY()), 0) );
} else {
glViewport( (GLint)(gSP.viewport.x * ogl.getScaleX()), (GLint)((frameBufferList().getCurrent()->m_height - (gSP.viewport.y + gSP.viewport.height)) * ogl.getScaleY()),
const GLint Y = gSP.viewport.vscale[1] < 0 ? (GLint)((gSP.viewport.y + gSP.viewport.vscale[1] * 2.0f) * ogl.getScaleY()) : (GLint)((frameBufferList().getCurrent()->m_height - (gSP.viewport.y + gSP.viewport.height)) * ogl.getScaleY());
glViewport((GLint)(gSP.viewport.x * ogl.getScaleX()), Y,
max((GLint)(gSP.viewport.width * ogl.getScaleX()), 0), max((GLint)(gSP.viewport.height * ogl.getScaleY()), 0) );
}
}

View File

@ -572,6 +572,9 @@ void gSPProcessVertex(u32 v)
if (!(gSP.geometryMode & G_ZBUFFER))
vtx.z = -vtx.w;
if (gSP.viewport.vscale[1] < 0)
vtx.y = -vtx.y;
gSPClipVertex(v);
if (gSP.geometryMode & G_LIGHTING) {
@ -755,7 +758,7 @@ void gSPViewport( u32 v )
gSP.viewport.x = gSP.viewport.vtrans[0] - gSP.viewport.vscale[0];
gSP.viewport.y = gSP.viewport.vtrans[1] - gSP.viewport.vscale[1];
gSP.viewport.width = gSP.viewport.vscale[0] * 2;
gSP.viewport.height = gSP.viewport.vscale[1] * 2;
gSP.viewport.height = fabs(gSP.viewport.vscale[1] * 2);
gSP.viewport.nearz = gSP.viewport.vtrans[2] - gSP.viewport.vscale[2];
gSP.viewport.farz = (gSP.viewport.vtrans[2] + gSP.viewport.vscale[2]) ;