mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
Make wallsetup globals local to where they are used
This commit is contained in:
parent
ac74a7a1e0
commit
b256f6ed89
9 changed files with 38 additions and 32 deletions
|
@ -579,7 +579,7 @@ namespace swrenderer
|
|||
// [ZZ] Only if not an active mirror
|
||||
if (!rw_markportal)
|
||||
{
|
||||
RenderDecal::RenderDecals(curline->sidedef, draw_segment, wallshade, rw_lightleft, rw_lightstep, curline, WallC, foggy, basecolormap);
|
||||
RenderDecal::RenderDecals(curline->sidedef, draw_segment, wallshade, rw_lightleft, rw_lightstep, curline, WallC, foggy, basecolormap, walltop.ScreenY, wallbottom.ScreenY);
|
||||
}
|
||||
|
||||
if (rw_markportal)
|
||||
|
|
|
@ -123,5 +123,11 @@ namespace swrenderer
|
|||
FDynamicColormap *basecolormap;
|
||||
|
||||
double lwallscale;
|
||||
|
||||
ProjectedWallLine walltop;
|
||||
ProjectedWallLine wallbottom;
|
||||
ProjectedWallLine wallupper;
|
||||
ProjectedWallLine walllower;
|
||||
ProjectedWallTexcoords walltexcoords;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
ProjectedWallLine walltop;
|
||||
ProjectedWallLine wallbottom;
|
||||
ProjectedWallLine wallupper;
|
||||
ProjectedWallLine walllower;
|
||||
ProjectedWallTexcoords walltexcoords;
|
||||
|
||||
ProjectedWallCull ProjectedWallLine::Project(double z, const FWallCoords *wallc)
|
||||
{
|
||||
return Project(z, z, wallc);
|
||||
|
|
|
@ -34,10 +34,4 @@ namespace swrenderer
|
|||
void Project(double walxrepeat, int x1, int x2, const FWallTmapVals &WallT);
|
||||
void ProjectPos(double walxrepeat, int x1, int x2, const FWallTmapVals &WallT);
|
||||
};
|
||||
|
||||
extern ProjectedWallLine walltop;
|
||||
extern ProjectedWallLine wallbottom;
|
||||
extern ProjectedWallLine wallupper;
|
||||
extern ProjectedWallLine walllower;
|
||||
extern ProjectedWallTexcoords walltexcoords;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,9 @@ namespace swrenderer
|
|||
float rw_lightstep;
|
||||
fixed_t rw_offset;
|
||||
FTexture *rw_pic;
|
||||
|
||||
ProjectedWallLine wallupper;
|
||||
ProjectedWallLine walllower;
|
||||
}
|
||||
|
||||
void R_FreeDrawSegs()
|
||||
|
@ -546,6 +549,7 @@ namespace swrenderer
|
|||
walllower.ScreenY[i] = mfloorclip[i];
|
||||
}
|
||||
|
||||
ProjectedWallTexcoords walltexcoords;
|
||||
walltexcoords.ProjectPos(curline->sidedef->TexelLength*xscale, ds->sx1, ds->sx2, WallT);
|
||||
R_DrawDrawSeg(frontsector, curline, WallC, rw_pic, ds, x1, x2, wallupper.ScreenY, walllower.ScreenY, texturemid, MaskedSWall, walltexcoords.UPos, yscale, wallshade, rw_offset, rw_light, rw_lightstep, ds->foggy, basecolormap);
|
||||
}
|
||||
|
|
|
@ -47,11 +47,11 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
void RenderDecal::RenderDecals(side_t *sidedef, drawseg_t *draw_segment, int wallshade, float lightleft, float lightstep, seg_t *curline, const FWallCoords &wallC, bool foggy, FDynamicColormap *basecolormap)
|
||||
void RenderDecal::RenderDecals(side_t *sidedef, drawseg_t *draw_segment, int wallshade, float lightleft, float lightstep, seg_t *curline, const FWallCoords &wallC, bool foggy, FDynamicColormap *basecolormap, const short *walltop, const short *wallbottom)
|
||||
{
|
||||
for (DBaseDecal *decal = sidedef->AttachedDecals; decal != NULL; decal = decal->WallNext)
|
||||
{
|
||||
Render(sidedef, decal, draw_segment, wallshade, lightleft, lightstep, curline, wallC, foggy, basecolormap, 0);
|
||||
Render(sidedef, decal, draw_segment, wallshade, lightleft, lightstep, curline, wallC, foggy, basecolormap, walltop, wallbottom, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace swrenderer
|
|||
// = 1: drawing masked textures (including sprites)
|
||||
// Currently, only pass = 0 is done or used
|
||||
|
||||
void RenderDecal::Render(side_t *wall, DBaseDecal *decal, drawseg_t *clipper, int wallshade, float lightleft, float lightstep, seg_t *curline, FWallCoords WallC, bool foggy, FDynamicColormap *basecolormap, int pass)
|
||||
void RenderDecal::Render(side_t *wall, DBaseDecal *decal, drawseg_t *clipper, int wallshade, float lightleft, float lightstep, seg_t *curline, FWallCoords WallC, bool foggy, FDynamicColormap *basecolormap, const short *walltop, const short *wallbottom, int pass)
|
||||
{
|
||||
DVector2 decal_left, decal_right, decal_pos;
|
||||
int x1, x2;
|
||||
|
@ -72,8 +72,8 @@ namespace swrenderer
|
|||
bool rereadcolormap;
|
||||
FDynamicColormap *usecolormap;
|
||||
float light = 0;
|
||||
short *mfloorclip;
|
||||
short *mceilingclip;
|
||||
const short *mfloorclip;
|
||||
const short *mceilingclip;
|
||||
|
||||
if (decal->RenderFlags & RF_INVISIBLE || !viewactive || !decal->PicNum.isValid())
|
||||
return;
|
||||
|
@ -171,12 +171,12 @@ namespace swrenderer
|
|||
{
|
||||
goto done;
|
||||
}
|
||||
mceilingclip = walltop.ScreenY;
|
||||
mfloorclip = wallbottom.ScreenY;
|
||||
mceilingclip = walltop;
|
||||
mfloorclip = wallbottom;
|
||||
}
|
||||
else if (pass == 0)
|
||||
{
|
||||
mceilingclip = walltop.ScreenY;
|
||||
mceilingclip = walltop;
|
||||
mfloorclip = RenderOpaquePass::Instance()->ceilingclip;
|
||||
needrepeat = 1;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ namespace swrenderer
|
|||
{
|
||||
goto done;
|
||||
}
|
||||
mceilingclip = walltop.ScreenY;
|
||||
mceilingclip = walltop;
|
||||
mfloorclip = RenderOpaquePass::Instance()->ceilingclip;
|
||||
break;
|
||||
|
||||
|
@ -211,7 +211,7 @@ namespace swrenderer
|
|||
goto done;
|
||||
}
|
||||
mceilingclip = RenderOpaquePass::Instance()->floorclip;
|
||||
mfloorclip = wallbottom.ScreenY;
|
||||
mfloorclip = wallbottom;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -226,6 +226,7 @@ namespace swrenderer
|
|||
goto done;
|
||||
}
|
||||
|
||||
ProjectedWallTexcoords walltexcoords;
|
||||
walltexcoords.Project(WallSpriteTile->GetWidth(), x1, x2, WallT);
|
||||
|
||||
if (flipx)
|
||||
|
@ -295,7 +296,7 @@ namespace swrenderer
|
|||
{ // calculate lighting
|
||||
R_SetColorMapLight(usecolormap, light, wallshade);
|
||||
}
|
||||
DrawColumn(x, WallSpriteTile, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||
DrawColumn(x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||
light += lightstep;
|
||||
x++;
|
||||
}
|
||||
|
@ -305,7 +306,7 @@ namespace swrenderer
|
|||
// be set 1 if we need to draw on the lower wall. In all other cases,
|
||||
// needrepeat will be 0, and the while will fail.
|
||||
mceilingclip = RenderOpaquePass::Instance()->floorclip;
|
||||
mfloorclip = wallbottom.ScreenY;
|
||||
mfloorclip = wallbottom;
|
||||
} while (needrepeat--);
|
||||
|
||||
colfunc = basecolfunc;
|
||||
|
@ -314,7 +315,7 @@ namespace swrenderer
|
|||
WallC = savecoord;
|
||||
}
|
||||
|
||||
void RenderDecal::DrawColumn(int x, FTexture *WallSpriteTile, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
||||
void RenderDecal::DrawColumn(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;
|
||||
|
|
|
@ -19,14 +19,15 @@ class DBaseDecal;
|
|||
namespace swrenderer
|
||||
{
|
||||
struct drawseg_t;
|
||||
class ProjectedWallTexcoords;
|
||||
|
||||
class RenderDecal
|
||||
{
|
||||
public:
|
||||
static void RenderDecals(side_t *wall, drawseg_t *draw_segment, int wallshade, float lightleft, float lightstep, seg_t *curline, const FWallCoords &wallC, bool foggy, FDynamicColormap *basecolormap);
|
||||
static void RenderDecals(side_t *wall, drawseg_t *draw_segment, int wallshade, float lightleft, float lightstep, seg_t *curline, const FWallCoords &wallC, bool foggy, FDynamicColormap *basecolormap, const short *walltop, const short *wallbottom);
|
||||
|
||||
private:
|
||||
static void Render(side_t *wall, DBaseDecal *first, drawseg_t *clipper, int wallshade, float lightleft, float lightstep, seg_t *curline, FWallCoords wallC, bool foggy, FDynamicColormap *basecolormap, int pass);
|
||||
static void DrawColumn(int x, FTexture *WallSpriteTile, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||
static void Render(side_t *wall, DBaseDecal *first, drawseg_t *clipper, int wallshade, float lightleft, float lightstep, seg_t *curline, FWallCoords wallC, bool foggy, FDynamicColormap *basecolormap, const short *walltop, const short *wallbottom, int pass);
|
||||
static void DrawColumn(int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -149,9 +149,13 @@ namespace swrenderer
|
|||
x2 = MIN<int>(spr->x2, spr->wallc.sx2);
|
||||
if (x1 >= x2)
|
||||
return;
|
||||
|
||||
FWallTmapVals WallT;
|
||||
WallT.InitFromWallCoords(&spr->wallc);
|
||||
|
||||
ProjectedWallTexcoords walltexcoords;
|
||||
walltexcoords.Project(spr->pic->GetWidth() << FRACBITS, x1, x2, WallT);
|
||||
|
||||
iyscale = 1 / spr->yscale;
|
||||
double texturemid = (spr->gzt - ViewPos.Z) * iyscale;
|
||||
if (spr->renderflags & RF_XFLIP)
|
||||
|
@ -229,14 +233,14 @@ namespace swrenderer
|
|||
R_SetColorMapLight(usecolormap, light, shade);
|
||||
}
|
||||
if (!RenderTranslucentPass::ClipSpriteColumnWithPortals(x, spr))
|
||||
DrawColumn(x, WallSpriteTile, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||
DrawColumn(x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||
light += lightstep;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderWallSprite::DrawColumn(int x, FTexture *WallSpriteTile, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
||||
void RenderWallSprite::DrawColumn(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;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
class ProjectedWallTexcoords;
|
||||
|
||||
class RenderWallSprite : public VisibleSprite
|
||||
{
|
||||
public:
|
||||
|
@ -27,7 +29,7 @@ namespace swrenderer
|
|||
void Render(short *cliptop, short *clipbottom, int minZ, int maxZ) override;
|
||||
|
||||
private:
|
||||
static void DrawColumn(int x, FTexture *WallSpriteTile, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||
static void DrawColumn(int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||
|
||||
FWallCoords wallc;
|
||||
uint32_t Translation = 0;
|
||||
|
|
Loading…
Reference in a new issue