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

Fix Z for rects.

Fixed CyberTiger: flicker in game (regression) #1170

The game sometimes set invalid viewport with gSP.viewport.nearz > 1,
so the rect is clipped.
This commit is contained in:
Sergey Lipskiy 2016-10-14 18:28:05 +07:00
parent fd05055950
commit bce335fc4f

View File

@ -1515,7 +1515,7 @@ void OGLRender::drawRect(int _ulx, int _uly, int _lrx, int _lry, float *_pColor)
const float scaleX = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_width : VI.rwidth;
const float scaleY = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_height : VI.rheight;
const float Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : gSP.viewport.nearz;
const float Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : 0.0f;
const float W = 1.0f;
m_rect[0].x = (float)_ulx * (2.0f * scaleX) - 1.0;
m_rect[0].y = (float)_uly * (-2.0f * scaleY) + 1.0;
@ -1775,7 +1775,7 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
const float scaleX = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_width : VI.rwidth;
const float scaleY = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_height : VI.rheight;
const float Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : gSP.viewport.nearz;
const float Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : 0.0f;
const float W = 1.0f;
f32 uly, lry;
if (bUseTexrectDrawer) {