Delete cachedheight, cacheddistance, cachedxstep and cachedystep

This commit is contained in:
Lactozilla 2023-11-24 08:34:51 -03:00
parent 3764ba3de0
commit b1d7f59fea
3 changed files with 21 additions and 70 deletions

View file

@ -83,11 +83,6 @@ static fixed_t planeheight;
fixed_t yslopetab[MAXVIDHEIGHT*16];
fixed_t *yslope;
fixed_t cachedheight[MAXVIDHEIGHT];
fixed_t cacheddistance[MAXVIDHEIGHT];
fixed_t cachedxstep[MAXVIDHEIGHT];
fixed_t cachedystep[MAXVIDHEIGHT];
static fixed_t xoffs, yoffs;
static floatv3_t ds_slope_origin, ds_slope_u, ds_slope_v;
@ -159,10 +154,9 @@ static void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
planecos = FINECOSINE(angle);
planesin = FINESINE(angle);
if (planeheight != cachedheight[y])
{
cachedheight[y] = planeheight;
cacheddistance[y] = distance = FixedMul(planeheight, yslope[y]);
// [RH] Notice that I dumped the caching scheme used by Doom.
// It did not offer any appreciable speedup.
distance = FixedMul(planeheight, yslope[y]);
span = abs(centery - y);
if (span) // Don't divide by zero
@ -175,16 +169,6 @@ static void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
else
ds_xstep = ds_ystep = FRACUNIT;
cachedxstep[y] = ds_xstep;
cachedystep[y] = ds_ystep;
}
else
{
distance = cacheddistance[y];
ds_xstep = cachedxstep[y];
ds_ystep = cachedystep[y];
}
// [RH] Instead of using the xtoviewangle array, I calculated the fractional values
// at the middle of the screen, then used the calculated ds_xstep and ds_ystep
// to step from those to the proper texture coordinate to start drawing at.
@ -277,10 +261,7 @@ static void R_MapFogPlane(INT32 y, INT32 x1, INT32 x2)
if (x1 >= vid.width)
x1 = vid.width - 1;
if (planeheight != cachedheight[y])
distance = FixedMul(planeheight, yslope[y]);
else
distance = cacheddistance[y];
pindex = distance >> LIGHTZSHIFT;
if (pindex >= MAXLIGHTZ)
@ -363,9 +344,6 @@ void R_ClearPlanes(void)
{
freehead = &(*freehead)->next;
}
// texture calculation
memset(cachedheight, 0, sizeof (cachedheight));
}
static visplane_t *new_visplane(unsigned hash)
@ -1023,13 +1001,6 @@ void R_DrawSinglePlane(visplane_t *pl)
}
}
// Don't mess with angle on slopes! We'll handle this ourselves later
if (!pl->slope && viewangle != pl->viewangle+pl->plangle)
{
memset(cachedheight, 0, sizeof (cachedheight));
viewangle = pl->viewangle+pl->plangle;
}
mapfunc = R_MapPlane;
if (ds_solidcolor)

View file

@ -63,10 +63,6 @@ extern visplane_t *ceilingplane;
// Visplane related.
extern INT16 floorclip[MAXVIDWIDTH], ceilingclip[MAXVIDWIDTH];
extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*16];
extern fixed_t cachedheight[MAXVIDHEIGHT];
extern fixed_t cacheddistance[MAXVIDHEIGHT];
extern fixed_t cachedxstep[MAXVIDHEIGHT];
extern fixed_t cachedystep[MAXVIDHEIGHT];
extern fixed_t *yslope;
extern lighttable_t **planezlight;

View file

@ -391,8 +391,6 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
if (pSplat->angle)
{
memset(cachedheight, 0, sizeof(cachedheight));
// Add the view offset, rotated by the plane angle.
fixed_t a = -pSplat->verts[0].x + vis->viewpoint.x;
fixed_t b = -pSplat->verts[0].y + vis->viewpoint.y;
@ -547,10 +545,9 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
angle_t planecos = FINECOSINE(angle);
angle_t planesin = FINESINE(angle);
if (planeheight != cachedheight[y])
{
cachedheight[y] = planeheight;
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
// [RH] Notice that I dumped the caching scheme used by Doom.
// It did not offer any appreciable speedup.
distance = FixedMul(planeheight, yslope[y]);
span = abs(centery - y);
if (span) // Don't divide by zero
@ -561,16 +558,6 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
else
xstep = ystep = FRACUNIT;
cachedxstep[y] = xstep;
cachedystep[y] = ystep;
}
else
{
distance = cacheddistance[y];
xstep = cachedxstep[y];
ystep = cachedystep[y];
}
ds_xstep = FixedDiv(xstep, pSplat->xscale);
ds_ystep = FixedDiv(ystep, pSplat->yscale);
@ -586,9 +573,6 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
rastertab[y].minx = INT32_MAX;
rastertab[y].maxx = INT32_MIN;
}
if (!ds_solidcolor && pSplat->angle && !pSplat->slope)
memset(cachedheight, 0, sizeof(cachedheight));
}
static void prepare_rastertab(void)