add tilted fog span drawer

fixes the red fog blocks on mkrevamp
This commit is contained in:
Alug committed 2025-06-11 17:10:47 +02:00
1 parent e90c84c9ac
commit 918a4e8cd9
4 files changed
+46

No files matched your search

+2
View File
@@ -141,6 +141,7 @@ enum
SPANDRAWFUNC_TILTEDWATER,
SPANDRAWFUNC_FOG,
SPANDRAWFUNC_TILTEDFOG,
SPANDRAWFUNC_MAX
};
@@ -258,6 +259,7 @@ void R_DrawTranslucentSpan(drawspandata_t* ds);
void R_DrawTranslucentWaterSpan(drawspandata_t* ds);
void R_DrawFogSpan(drawspandata_t* ds);
void R_DrawFogSpan_Tilted(drawspandata_t* ds);
void R_DrawSplat_Tilted(drawspandata_t* ds);
void R_DrawSplat(drawspandata_t* ds);
+40
View File
@@ -1188,3 +1188,43 @@ void R_DrawSplat_Tilted(drawspandata_t* ds)
}
#endif
}
void R_DrawFogSpan_Tilted(drawspandata_t* ds)
{
int width = ds->x2 - ds->x1;
float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
register UINT8 *dest;
local_for_thread INT32 *tiltlighting = NULL;
local_for_thread INT32 oldviewwidth = 0;
// dont realloc every frame pls thx
if (tiltlighting == NULL || oldviewwidth != viewwidth)
{
tiltlighting = realloc(tiltlighting, sizeof(*tiltlighting) * viewwidth);
oldviewwidth = viewwidth;
}
dest = R_Address(ds->x1, ds->y);
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = PLANELIGHTFLOAT;
float lightstart, lightend;
lightend = (iz + ds->szp.x*width) * planelightfloat;
lightstart = iz * planelightfloat;
R_CalcTiltedLighting(tiltlighting, ds->x1, ds->x2, FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
}
do
{
UINT8 *colormap = ds->planezlight[tiltlighting[ds->x1++]] + (ds->colormap - colormaps);
*dest = colormap[*dest];
dest++;
}
while (--width >= 0);
}
+3
View File
@@ -1213,6 +1213,9 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
case SPANDRAWFUNC_SPLAT:
spanfunctype = SPANDRAWFUNC_TILTEDSPLAT;
break;
case SPANDRAWFUNC_FOG:
spanfunctype = SPANDRAWFUNC_TILTEDFOG;
break;
default:
spanfunctype = SPANDRAWFUNC_TILTED;
break;
+1
View File
@@ -94,6 +94,7 @@ static void SCR_SetDrawFuncs(void)
spanfuncs[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan;
spanfuncs[SPANDRAWFUNC_TILTEDWATER] = R_DrawTranslucentWaterSpan_Tilted;
spanfuncs[SPANDRAWFUNC_FOG] = R_DrawFogSpan;
spanfuncs[SPANDRAWFUNC_TILTEDFOG] = R_DrawFogSpan_Tilted;
colfuncs[BASEDRAWFUNC] = R_DrawColumn;
colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn;