diff --git a/src/swrenderer/line/r_fogboundary.cpp b/src/swrenderer/line/r_fogboundary.cpp index edaa942655..ca1822a2c1 100644 --- a/src/swrenderer/line/r_fogboundary.cpp +++ b/src/swrenderer/line/r_fogboundary.cpp @@ -45,12 +45,7 @@ namespace swrenderer { - namespace - { - short spanend[MAXHEIGHT]; - } - - void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip, int wallshade, float lightleft, float lightstep) + void RenderFogBoundary::Render(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 // to create new horizontal spans whenever the light changes enough that @@ -87,7 +82,7 @@ namespace swrenderer if (t2 < b2 && rcolormap != 0) { // Colormap 0 is always the identity map, so rendering it is // just a waste of time. - R_DrawFogBoundarySection(t2, b2, xr); + RenderSection(t2, b2, xr); } if (t1 < t2) t2 = t1; if (b1 > b2) b2 = b1; @@ -139,15 +134,17 @@ namespace swrenderer } 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) { R_Drawers()->DrawFogBoundaryLine(y, x1, spanend[y]); } } + + short RenderFogBoundary::spanend[MAXHEIGHT]; } diff --git a/src/swrenderer/line/r_fogboundary.h b/src/swrenderer/line/r_fogboundary.h index bb7d267241..de48738a09 100644 --- a/src/swrenderer/line/r_fogboundary.h +++ b/src/swrenderer/line/r_fogboundary.h @@ -15,6 +15,15 @@ namespace swrenderer { - void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip, int wallshade, float lightleft, float lightstep); - void R_DrawFogBoundarySection(int y, int y2, int x1); + class RenderFogBoundary + { + 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]; + }; + } diff --git a/src/swrenderer/segments/r_drawsegment.cpp b/src/swrenderer/segments/r_drawsegment.cpp index 269154b9e3..99ad33cefe 100644 --- a/src/swrenderer/segments/r_drawsegment.cpp +++ b/src/swrenderer/segments/r_drawsegment.cpp @@ -201,7 +201,7 @@ namespace swrenderer // [RH] Draw fog partition 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) { goto clearfog;