mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 23:21:43 +00:00
- fixed scissoring with out of range coordinates.
Blood's status bar sets such a bogus clipping rectangle.
This commit is contained in:
parent
e84acb7e2f
commit
6c6874cb0e
4 changed files with 7 additions and 9 deletions
|
@ -74,7 +74,7 @@ struct PolymostRenderState
|
|||
int DepthFunc = 1;
|
||||
PalEntry ClearColor = 0;
|
||||
short vp_x, vp_y, vp_w, vp_h;
|
||||
short sc_x, sc_y, sc_w, sc_h;
|
||||
short sc_x = SHRT_MIN, sc_y, sc_w, sc_h;
|
||||
int texIds[5], samplerIds[5];
|
||||
|
||||
PalEntry FogColor;
|
||||
|
|
|
@ -444,7 +444,7 @@ void PolymostRenderState::Apply(PolymostShader* shader, GLState &oldState)
|
|||
}
|
||||
if (StateFlags & STF_SCISSORSET)
|
||||
{
|
||||
if (sc_x >= 0)
|
||||
if (sc_x > SHRT_MIN)
|
||||
{
|
||||
glScissor(sc_x, sc_y, sc_w, sc_h);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
|
|
@ -397,7 +397,7 @@ public:
|
|||
|
||||
void DisableScissor()
|
||||
{
|
||||
renderState.sc_x = -1;
|
||||
renderState.sc_x = SHRT_MIN;
|
||||
renderState.StateFlags |= STF_SCISSORSET;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,20 +142,18 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
|||
//state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
|
||||
//state.SetTextureMode(cmd.mDrawMode);
|
||||
|
||||
int sciX, sciY, sciW, sciH;
|
||||
if (cmd.mFlags & F2DDrawer::DTF_Scissor)
|
||||
{
|
||||
// scissor test doesn't use the current viewport for the coordinates, so use real screen coordinates
|
||||
// Note that the origin here is the lower left corner!
|
||||
sciX = screen->ScreenToWindowX(cmd.mScissor[0]);
|
||||
sciY = screen->ScreenToWindowY(cmd.mScissor[3]);
|
||||
sciW = screen->ScreenToWindowX(cmd.mScissor[2]) - sciX;
|
||||
sciH = screen->ScreenToWindowY(cmd.mScissor[1]) - sciY;
|
||||
int sciX = screen->ScreenToWindowX(cmd.mScissor[0]);
|
||||
int sciY = screen->ScreenToWindowY(cmd.mScissor[3]);
|
||||
int sciW = screen->ScreenToWindowX(cmd.mScissor[2]) - sciX;
|
||||
int sciH = screen->ScreenToWindowY(cmd.mScissor[1]) - sciY;
|
||||
SetScissor(sciX, sciY, sciW, sciH);
|
||||
}
|
||||
else
|
||||
{
|
||||
sciX = sciY = sciW = sciH = -1;
|
||||
DisableScissor();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue