mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-07 07:21:10 +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;
|
int method = 0;
|
||||||
|
|
||||||
dg.mType = DrawTypeRotateSprite;
|
dg.mType = DrawTypeRotateSprite;
|
||||||
dg.mScissor[0] = cx1;
|
if (cx1 > 0 || cy1 > 0 || cx2 < xdim - 1 || cy2 < ydim - 1)
|
||||||
dg.mScissor[1] = cy1;
|
{
|
||||||
dg.mScissor[2] = cx2;
|
dg.mScissor[0] = cx1;
|
||||||
dg.mScissor[3] = cy2;
|
dg.mScissor[1] = cy1;
|
||||||
|
dg.mScissor[2] = cx2 + 1;
|
||||||
|
dg.mScissor[3] = cy2 + 1;
|
||||||
|
dg.mFlags |= DTF_Scissor;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(dastat & RS_NOMASK))
|
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))
|
if (!(dastat & RS_TOPLEFT))
|
||||||
{
|
{
|
||||||
ofs = { int16_t(picanm[globalpicnum].xofs + (siz.x >> 1)),
|
ofs = { int16_t(picanm[picnum].xofs + (siz.x >> 1)),
|
||||||
int16_t(picanm[globalpicnum].yofs + (siz.y >> 1)) };
|
int16_t(picanm[picnum].yofs + (siz.y >> 1)) };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dastat & RS_YFLIP)
|
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)
|
void GLInstance::SetScissor(int x1, int y1, int x2, int y2)
|
||||||
{
|
{
|
||||||
glScissor(x1, y1, x2, 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)
|
void GLInstance::SetColor(float r, float g, float b, float a)
|
||||||
{
|
{
|
||||||
glVertexAttrib4f(2, r, g, b, a);
|
glVertexAttrib4f(2, r, g, b, a);
|
||||||
|
|
|
@ -286,6 +286,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetScissor(int x1, int y1, int x2, int y2);
|
void SetScissor(int x1, int y1, int x2, int y2);
|
||||||
|
void DisableScissor();
|
||||||
void SetDepthFunc(int func);
|
void SetDepthFunc(int func);
|
||||||
void SetColorMask(bool on);
|
void SetColorMask(bool on);
|
||||||
void SetDepthMask(bool on);
|
void SetDepthMask(bool on);
|
||||||
|
|
|
@ -131,7 +131,6 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
||||||
int gltrans = -1;
|
int gltrans = -1;
|
||||||
|
|
||||||
SetBlendFunc(cmd.mRenderStyle.SrcAlpha, cmd.mRenderStyle.DestAlpha);
|
SetBlendFunc(cmd.mRenderStyle.SrcAlpha, cmd.mRenderStyle.DestAlpha);
|
||||||
EnableBlend(!(cmd.mRenderStyle.Flags & STYLEF_Alpha1));
|
|
||||||
//state.SetRenderStyle(cmd.mRenderStyle);
|
//state.SetRenderStyle(cmd.mRenderStyle);
|
||||||
//state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
|
//state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
|
||||||
//state.SetTextureMode(cmd.mDrawMode);
|
//state.SetTextureMode(cmd.mDrawMode);
|
||||||
|
@ -145,12 +144,13 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
||||||
sciY = screen->ScreenToWindowY(cmd.mScissor[3]);
|
sciY = screen->ScreenToWindowY(cmd.mScissor[3]);
|
||||||
sciW = screen->ScreenToWindowX(cmd.mScissor[2]) - sciX;
|
sciW = screen->ScreenToWindowX(cmd.mScissor[2]) - sciX;
|
||||||
sciH = screen->ScreenToWindowY(cmd.mScissor[1]) - sciY;
|
sciH = screen->ScreenToWindowY(cmd.mScissor[1]) - sciY;
|
||||||
|
SetScissor(sciX, sciY, sciW, sciH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sciX = sciY = sciW = sciH = -1;
|
sciX = sciY = sciW = sciH = -1;
|
||||||
|
DisableScissor();
|
||||||
}
|
}
|
||||||
SetScissor(sciX, sciY, sciW, sciH);
|
|
||||||
|
|
||||||
//state.SetFog(cmd.mColor1, 0);
|
//state.SetFog(cmd.mColor1, 0);
|
||||||
SetColor(1, 1, 1);
|
SetColor(1, 1, 1);
|
||||||
|
@ -165,12 +165,14 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
||||||
SetShade(cmd.mRemapIndex >> 16, numshades);
|
SetShade(cmd.mRemapIndex >> 16, numshades);
|
||||||
SetFadeDisable(false);
|
SetFadeDisable(false);
|
||||||
SetTexture(0, tex, cmd.mRemapIndex & 0xffff, 4/*DAMETH_CLAMPED*/, SamplerClampXY);
|
SetTexture(0, tex, cmd.mRemapIndex & 0xffff, 4/*DAMETH_CLAMPED*/, SamplerClampXY);
|
||||||
|
EnableBlend(!(cmd.mRenderStyle.Flags & STYLEF_Alpha1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetFadeDisable(true);
|
SetFadeDisable(true);
|
||||||
SetShade(0, numshades);
|
SetShade(0, numshades);
|
||||||
SetNamedTexture(cmd.mTexture, cmd.mRemapIndex, cmd.mFlags & F2DDrawer::DTF_Wrap ? SamplerRepeat : SamplerClampXY);
|
SetNamedTexture(cmd.mTexture, cmd.mRemapIndex, cmd.mFlags & F2DDrawer::DTF_Wrap ? SamplerRepeat : SamplerClampXY);
|
||||||
|
EnableBlend(true);
|
||||||
}
|
}
|
||||||
UseColorOnly(false);
|
UseColorOnly(false);
|
||||||
}
|
}
|
||||||
|
@ -214,6 +216,7 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
||||||
SetShade(0, numshades);
|
SetShade(0, numshades);
|
||||||
SetFadeDisable(false);
|
SetFadeDisable(false);
|
||||||
SetColor(1, 1, 1);
|
SetColor(1, 1, 1);
|
||||||
|
DisableScissor();
|
||||||
//drawer->mIsFirstPass = false;
|
//drawer->mIsFirstPass = false;
|
||||||
twod.Clear();
|
twod.Clear();
|
||||||
EnableBlend(true);
|
EnableBlend(true);
|
||||||
|
|
Loading…
Reference in a new issue