ColoredSpan and FogBoundary drawers

This commit is contained in:
Magnus Norddahl 2016-12-06 18:58:39 +01:00
parent d8f805ddc9
commit bec5d39ca8
4 changed files with 35 additions and 13 deletions

View file

@ -2275,12 +2275,19 @@ namespace swrenderer
/////////////////////////////////////////////////////////////////////////
DrawColoredSpanPalCommand::DrawColoredSpanPalCommand(int y, int x1, int x2)
DrawColoredSpanPalCommand::DrawColoredSpanPalCommand(int y, int x1, int x2) : y(y), x1(x1), x2(x2)
{
using namespace drawerargs;
color = ds_color;
destorg = dc_destorg;
}
void DrawColoredSpanPalCommand::Execute(DrawerThread *thread)
{
if (thread->line_skipped_by_thread(y))
return;
memset(ylookup[y] + x1 + destorg, color, x2 - x1 + 1);
}
/////////////////////////////////////////////////////////////////////////
@ -2325,11 +2332,24 @@ namespace swrenderer
/////////////////////////////////////////////////////////////////////////
DrawFogBoundaryLinePalCommand::DrawFogBoundaryLinePalCommand(int y, int y2, int x1)
DrawFogBoundaryLinePalCommand::DrawFogBoundaryLinePalCommand(int y, int x1, int x2) : y(y), x1(x1), x2(x2)
{
using namespace drawerargs;
_colormap = dc_colormap;
_destorg = dc_destorg;
}
void DrawFogBoundaryLinePalCommand::Execute(DrawerThread *thread)
{
if (thread->line_skipped_by_thread(y))
return;
const uint8_t *colormap = _colormap;
uint8_t *dest = ylookup[y] + _destorg;
int x = x1;
do
{
dest[x] = colormap[dest[x]];
} while (++x <= x2);
}
}

View file

@ -188,6 +188,13 @@ namespace swrenderer
DrawColoredSpanPalCommand(int y, int x1, int x2);
void Execute(DrawerThread *thread) override;
FString DebugInfo() override { return "DrawColoredSpanPalCommand"; }
private:
int y;
int x1;
int x2;
int color;
uint8_t *destorg;
};
class DrawSlabPalCommand : public PalSpanCommand
@ -211,8 +218,13 @@ namespace swrenderer
class DrawFogBoundaryLinePalCommand : public PalSpanCommand
{
public:
DrawFogBoundaryLinePalCommand(int y, int y2, int x1);
DrawFogBoundaryLinePalCommand(int y, int x1, int x2);
void Execute(DrawerThread *thread) override;
private:
int y, x1, x2;
const uint8_t *_colormap;
uint8_t *_destorg;
};
class RtInitColsPalCommand : public DrawerCommand

View file

@ -522,11 +522,6 @@ void R_MapTiltedPlane (int y, int x1)
//
//==========================================================================
void R_MapColoredPlane_C (int y, int x1)
{
memset (ylookup[y] + x1 + dc_destorg, ds_color, spanend[y] - x1 + 1);
}
void R_MapColoredPlane(int y, int x1)
{
R_DrawColoredSpan(y, x1, spanend[y]);

View file

@ -96,11 +96,6 @@ void R_DrawNormalPlane (visplane_t *pl, double xscale, double yscale, fixed_t al
void R_DrawTiltedPlane (visplane_t *pl, double xscale, double yscale, fixed_t alpha, bool additive, bool masked);
void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1));
void R_MapTiltedPlane_C(int y, int x1);
void R_MapTiltedPlane_rgba(int y, int x);
void R_MapColoredPlane_C(int y, int x1);
void R_MapColoredPlane_rgba(int y, int x1);
visplane_t *R_FindPlane
( const secplane_t &height,
FTextureID picnum,