mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Correct screen coords viewport in TexrectDrawer::draw()
Fixed Mario Golf (U) bug in GLideN64 3.0 regresion #1710
This commit is contained in:
parent
48018bdf4a
commit
5ccc40423f
|
@ -255,10 +255,10 @@ void GraphicsDrawer::_updateViewport() const
|
|||
gSP.changed &= ~CHANGED_VIEWPORT;
|
||||
}
|
||||
|
||||
void GraphicsDrawer::_updateScreenCoordsViewport() const
|
||||
void GraphicsDrawer::_updateScreenCoordsViewport(const FrameBuffer * _pBuffer) const
|
||||
{
|
||||
DisplayWindow & wnd = DisplayWindow::get();
|
||||
const FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
||||
const FrameBuffer * pCurrentBuffer = _pBuffer != nullptr ? _pBuffer : frameBufferList().getCurrent();
|
||||
|
||||
u32 bufferWidth, bufferHeight;
|
||||
f32 viewportScaleX, viewportScaleY;
|
||||
|
@ -1128,13 +1128,15 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
|||
gSP.changed &= ~CHANGED_GEOMETRYMODE; // Don't update cull mode
|
||||
m_drawingState = DrawingState::TexRect;
|
||||
|
||||
if (!m_texrectDrawer.isEmpty()) {
|
||||
if (m_texrectDrawer.canContinue()) {
|
||||
CombinerInfo & cmbInfo = CombinerInfo::get();
|
||||
cmbInfo.setPolygonMode(DrawingState::TexRect);
|
||||
cmbInfo.update();
|
||||
_updateTextures();
|
||||
cmbInfo.updateParameters();
|
||||
} else {
|
||||
if (!m_texrectDrawer.isEmpty())
|
||||
m_texrectDrawer.draw();
|
||||
gSP.changed &= ~CHANGED_GEOMETRYMODE; // Don't update cull mode
|
||||
gSP.changed &= ~CHANGED_VIEWPORT; // Don't update viewport
|
||||
if (_params.texrectCmd && (gSP.changed | gDP.changed) != 0)
|
||||
|
@ -1172,11 +1174,6 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
|||
const f32 uly = _params.uly * (2.0f * scaleY) - 1.0f;
|
||||
const f32 lrx = _params.lrx * (2.0f * scaleX) - 1.0f;
|
||||
const f32 lry = _params.lry * (2.0f * scaleY) - 1.0f;
|
||||
if (!bUseTexrectDrawer) {
|
||||
// Flush text drawer
|
||||
if (m_texrectDrawer.draw())
|
||||
_updateStates(DrawingState::TexRect);
|
||||
}
|
||||
m_rect[0].x = ulx;
|
||||
m_rect[0].y = uly;
|
||||
m_rect[0].z = Z;
|
||||
|
|
|
@ -172,7 +172,7 @@ private:
|
|||
bool _setUnsupportedBlendMode() const;
|
||||
void _updateCullFace() const;
|
||||
void _updateViewport() const;
|
||||
void _updateScreenCoordsViewport() const;
|
||||
void _updateScreenCoordsViewport(const FrameBuffer * _pBuffer = nullptr) const;
|
||||
void _updateDepthUpdate() const;
|
||||
void _updateDepthCompare() const;
|
||||
void _updateTextures() const;
|
||||
|
|
|
@ -237,7 +237,7 @@ bool TexrectDrawer::draw()
|
|||
const float t0 = (m_lry + 1.0f) / scaleY / (float)m_pTexture->realHeight;
|
||||
const float W = 1.0f;
|
||||
|
||||
drawer._updateScreenCoordsViewport();
|
||||
drawer._updateScreenCoordsViewport(m_pBuffer);
|
||||
|
||||
textureCache().activateTexture(0, m_pTexture);
|
||||
// Disable filtering to avoid black outlines
|
||||
|
@ -325,6 +325,15 @@ bool TexrectDrawer::draw()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TexrectDrawer::isEmpty() {
|
||||
bool TexrectDrawer::isEmpty() const
|
||||
{
|
||||
return m_numRects == 0;
|
||||
}
|
||||
|
||||
bool TexrectDrawer::canContinue() const
|
||||
{
|
||||
return (m_numRects != 0 &&
|
||||
m_otherMode == gDP.otherMode._u64 &&
|
||||
m_mux == gDP.combine.mux &&
|
||||
m_pBuffer == frameBufferList().getCurrent());
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@ public:
|
|||
void destroy();
|
||||
void add();
|
||||
bool draw();
|
||||
bool isEmpty();
|
||||
bool isEmpty() const;
|
||||
bool canContinue() const;
|
||||
|
||||
private:
|
||||
void _setViewport() const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user