Move drawerargs globals into a class and make them local

This commit is contained in:
Magnus Norddahl 2017-01-29 07:49:04 +01:00
commit 92bd752935
35 changed files with 609 additions and 1545 deletions

View file

@ -274,18 +274,18 @@ namespace swrenderer
{
int x = x1;
DrawerStyle drawerstyle;
DrawerArgs drawerargs;
if (cameraLight->fixedlightlev >= 0)
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != NULL)
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0);
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
else
calclighting = true;
bool visible = drawerstyle.SetPatchStyle(decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor, basecolormap);
bool visible = drawerargs.SetPatchStyle(decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor, basecolormap);
// R_SetPatchStyle can modify basecolormap.
if (rereadcolormap)
@ -299,9 +299,9 @@ namespace swrenderer
{
if (calclighting)
{ // calculate lighting
drawerstyle.SetColorMapLight(usecolormap, light, wallshade);
drawerargs.SetColorMapLight(usecolormap, light, wallshade);
}
DrawColumn(drawerstyle, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
DrawColumn(drawerargs, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
light += lightstep;
x++;
}
@ -315,7 +315,7 @@ namespace swrenderer
} while (needrepeat--);
}
void RenderDecal::DrawColumn(DrawerStyle &drawerstyle, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
void RenderDecal::DrawColumn(DrawerArgs &drawerargs, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
{
float iscale = walltexcoords.VStep[x] * maskedScaleY;
double spryscale = 1 / iscale;
@ -325,6 +325,6 @@ namespace swrenderer
else
sprtopscreen = CenterY - texturemid * spryscale;
drawerstyle.DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, walltexcoords.UPos[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
drawerargs.DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, walltexcoords.UPos[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
}
}