Convert r_fogboundary to a class

This commit is contained in:
Magnus Norddahl 2017-01-11 21:33:28 +01:00
parent 3f8e5d26b8
commit fc29958dc7
3 changed files with 18 additions and 12 deletions

View File

@ -45,12 +45,7 @@
namespace swrenderer namespace swrenderer
{ {
namespace void RenderFogBoundary::Render(int x1, int x2, short *uclip, short *dclip, int wallshade, float lightleft, float lightstep)
{
short spanend[MAXHEIGHT];
}
void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip, int wallshade, float lightleft, float lightstep)
{ {
// This is essentially the same as R_MapVisPlane but with an extra step // This is essentially the same as R_MapVisPlane but with an extra step
// to create new horizontal spans whenever the light changes enough that // to create new horizontal spans whenever the light changes enough that
@ -87,7 +82,7 @@ namespace swrenderer
if (t2 < b2 && rcolormap != 0) if (t2 < b2 && rcolormap != 0)
{ // Colormap 0 is always the identity map, so rendering it is { // Colormap 0 is always the identity map, so rendering it is
// just a waste of time. // just a waste of time.
R_DrawFogBoundarySection(t2, b2, xr); RenderSection(t2, b2, xr);
} }
if (t1 < t2) t2 = t1; if (t1 < t2) t2 = t1;
if (b1 > b2) b2 = b1; if (b1 > b2) b2 = b1;
@ -139,15 +134,17 @@ namespace swrenderer
} }
if (t2 < b2 && rcolormap != 0) if (t2 < b2 && rcolormap != 0)
{ {
R_DrawFogBoundarySection(t2, b2, x1); RenderSection(t2, b2, x1);
} }
} }
void R_DrawFogBoundarySection(int y, int y2, int x1) void RenderFogBoundary::RenderSection(int y, int y2, int x1)
{ {
for (; y < y2; ++y) for (; y < y2; ++y)
{ {
R_Drawers()->DrawFogBoundaryLine(y, x1, spanend[y]); R_Drawers()->DrawFogBoundaryLine(y, x1, spanend[y]);
} }
} }
short RenderFogBoundary::spanend[MAXHEIGHT];
} }

View File

@ -15,6 +15,15 @@
namespace swrenderer namespace swrenderer
{ {
void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip, int wallshade, float lightleft, float lightstep); class RenderFogBoundary
void R_DrawFogBoundarySection(int y, int y2, int x1); {
public:
static void Render(int x1, int x2, short *uclip, short *dclip, int wallshade, float lightleft, float lightstep);
private:
static void RenderSection(int y, int y2, int x1);
static short spanend[MAXHEIGHT];
};
} }

View File

@ -201,7 +201,7 @@ namespace swrenderer
// [RH] Draw fog partition // [RH] Draw fog partition
if (ds->bFogBoundary) if (ds->bFogBoundary)
{ {
R_DrawFogBoundary(x1, x2, mceilingclip, mfloorclip, wallshade, rw_light, rw_lightstep); RenderFogBoundary::Render(x1, x2, mceilingclip, mfloorclip, wallshade, rw_light, rw_lightstep);
if (ds->maskedtexturecol == -1) if (ds->maskedtexturecol == -1)
{ {
goto clearfog; goto clearfog;