mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- fixed some rotatesprite issues:
* scissor was not applied * texture coordinates were fetched from the wrong texture, courtesy of using global variables.
This commit is contained in:
parent
6459f4e532
commit
5830e72ab0
4 changed files with 23 additions and 8 deletions
|
@ -701,10 +701,14 @@ void F2DDrawer::rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
int method = 0;
|
||||
|
||||
dg.mType = DrawTypeRotateSprite;
|
||||
dg.mScissor[0] = cx1;
|
||||
dg.mScissor[1] = cy1;
|
||||
dg.mScissor[2] = cx2;
|
||||
dg.mScissor[3] = cy2;
|
||||
if (cx1 > 0 || cy1 > 0 || cx2 < xdim - 1 || cy2 < ydim - 1)
|
||||
{
|
||||
dg.mScissor[0] = cx1;
|
||||
dg.mScissor[1] = cy1;
|
||||
dg.mScissor[2] = cx2 + 1;
|
||||
dg.mScissor[3] = cy2 + 1;
|
||||
dg.mFlags |= DTF_Scissor;
|
||||
}
|
||||
|
||||
if (!(dastat & RS_NOMASK))
|
||||
{
|
||||
|
@ -730,8 +734,8 @@ void F2DDrawer::rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
|
||||
if (!(dastat & RS_TOPLEFT))
|
||||
{
|
||||
ofs = { int16_t(picanm[globalpicnum].xofs + (siz.x >> 1)),
|
||||
int16_t(picanm[globalpicnum].yofs + (siz.y >> 1)) };
|
||||
ofs = { int16_t(picanm[picnum].xofs + (siz.x >> 1)),
|
||||
int16_t(picanm[picnum].yofs + (siz.y >> 1)) };
|
||||
}
|
||||
|
||||
if (dastat & RS_YFLIP)
|
||||
|
|
|
@ -412,8 +412,15 @@ void GLInstance::SetCull(int type, int winding)
|
|||
void GLInstance::SetScissor(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
glScissor(x1, y1, x2, y2);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
void GLInstance::DisableScissor()
|
||||
{
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
|
||||
void GLInstance::SetColor(float r, float g, float b, float a)
|
||||
{
|
||||
glVertexAttrib4f(2, r, g, b, a);
|
||||
|
|
|
@ -286,6 +286,7 @@ public:
|
|||
}
|
||||
|
||||
void SetScissor(int x1, int y1, int x2, int y2);
|
||||
void DisableScissor();
|
||||
void SetDepthFunc(int func);
|
||||
void SetColorMask(bool on);
|
||||
void SetDepthMask(bool on);
|
||||
|
|
|
@ -131,7 +131,6 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
|||
int gltrans = -1;
|
||||
|
||||
SetBlendFunc(cmd.mRenderStyle.SrcAlpha, cmd.mRenderStyle.DestAlpha);
|
||||
EnableBlend(!(cmd.mRenderStyle.Flags & STYLEF_Alpha1));
|
||||
//state.SetRenderStyle(cmd.mRenderStyle);
|
||||
//state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
|
||||
//state.SetTextureMode(cmd.mDrawMode);
|
||||
|
@ -145,12 +144,13 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
|||
sciY = screen->ScreenToWindowY(cmd.mScissor[3]);
|
||||
sciW = screen->ScreenToWindowX(cmd.mScissor[2]) - sciX;
|
||||
sciH = screen->ScreenToWindowY(cmd.mScissor[1]) - sciY;
|
||||
SetScissor(sciX, sciY, sciW, sciH);
|
||||
}
|
||||
else
|
||||
{
|
||||
sciX = sciY = sciW = sciH = -1;
|
||||
DisableScissor();
|
||||
}
|
||||
SetScissor(sciX, sciY, sciW, sciH);
|
||||
|
||||
//state.SetFog(cmd.mColor1, 0);
|
||||
SetColor(1, 1, 1);
|
||||
|
@ -165,12 +165,14 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
|||
SetShade(cmd.mRemapIndex >> 16, numshades);
|
||||
SetFadeDisable(false);
|
||||
SetTexture(0, tex, cmd.mRemapIndex & 0xffff, 4/*DAMETH_CLAMPED*/, SamplerClampXY);
|
||||
EnableBlend(!(cmd.mRenderStyle.Flags & STYLEF_Alpha1));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFadeDisable(true);
|
||||
SetShade(0, numshades);
|
||||
SetNamedTexture(cmd.mTexture, cmd.mRemapIndex, cmd.mFlags & F2DDrawer::DTF_Wrap ? SamplerRepeat : SamplerClampXY);
|
||||
EnableBlend(true);
|
||||
}
|
||||
UseColorOnly(false);
|
||||
}
|
||||
|
@ -214,6 +216,7 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
|||
SetShade(0, numshades);
|
||||
SetFadeDisable(false);
|
||||
SetColor(1, 1, 1);
|
||||
DisableScissor();
|
||||
//drawer->mIsFirstPass = false;
|
||||
twod.Clear();
|
||||
EnableBlend(true);
|
||||
|
|
Loading…
Reference in a new issue