Remove old voxel slab drawer

This commit is contained in:
Magnus Norddahl 2016-12-27 07:25:11 +01:00
parent 46e9a0cdf9
commit 4d0cc9e7bb
6 changed files with 0 additions and 221 deletions

View File

@ -914,37 +914,6 @@ namespace swrenderer
DrawerCommandQueue::QueueCommand<DrawColoredSpanPalCommand>(y, x1, x2);
}
namespace
{
ShadeConstants slab_rgba_shade_constants;
const uint8_t *slab_rgba_colormap;
fixed_t slab_rgba_light;
}
void R_SetupDrawSlab(FSWColormap *base_colormap, float light, int shade)
{
slab_rgba_shade_constants.light_red = base_colormap->Color.r * 256 / 255;
slab_rgba_shade_constants.light_green = base_colormap->Color.g * 256 / 255;
slab_rgba_shade_constants.light_blue = base_colormap->Color.b * 256 / 255;
slab_rgba_shade_constants.light_alpha = base_colormap->Color.a * 256 / 255;
slab_rgba_shade_constants.fade_red = base_colormap->Fade.r;
slab_rgba_shade_constants.fade_green = base_colormap->Fade.g;
slab_rgba_shade_constants.fade_blue = base_colormap->Fade.b;
slab_rgba_shade_constants.fade_alpha = base_colormap->Fade.a;
slab_rgba_shade_constants.desaturate = MIN(abs(base_colormap->Desaturate), 255) * 255 / 256;
slab_rgba_shade_constants.simple_shade = (base_colormap->Color.d == 0x00ffffff && base_colormap->Fade.d == 0x00000000 && base_colormap->Desaturate == 0);
slab_rgba_colormap = base_colormap->Maps;
slab_rgba_light = LIGHTSCALE(light, shade);
}
void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p)
{
if (r_swtruecolor)
DrawerCommandQueue::QueueCommand<DrawSlabRGBACommand>(dx, v, dy, vi, vptr, p, slab_rgba_shade_constants, slab_rgba_colormap, slab_rgba_light);
else
DrawerCommandQueue::QueueCommand<DrawSlabPalCommand>(dx, v, dy, vi, vptr, p, slab_rgba_colormap);
}
void R_DrawFogBoundarySection(int y, int y2, int x1)
{
for (; y < y2; ++y)

View File

@ -160,8 +160,6 @@ namespace swrenderer
void R_FillSpan();
void R_DrawTiltedSpan(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy);
void R_DrawColoredSpan(int y, int x1, int x2);
void R_SetupDrawSlab(FSWColormap *base_colormap, float light, int shade);
void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p);
void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip);
void R_FillSpan();

View File

@ -2713,46 +2713,6 @@ namespace swrenderer
/////////////////////////////////////////////////////////////////////////
DrawSlabPalCommand::DrawSlabPalCommand(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p, const uint8_t *colormap)
: _dx(dx), _v(v), _dy(dy), _vi(vi), _vvptr(vptr), _p(p), _colormap(colormap)
{
using namespace drawerargs;
_pitch = dc_pitch;
_start_y = static_cast<int>((p - dc_destorg) / dc_pitch);
}
void DrawSlabPalCommand::Execute(DrawerThread *thread)
{
int count = _dy;
uint8_t *dest = _p;
int pitch = _pitch;
int width = _dx;
const uint8_t *colormap = _colormap;
const uint8_t *source = _vvptr;
fixed_t fracpos = _v;
fixed_t iscale = _vi;
count = thread->count_for_thread(_start_y, count);
dest = thread->dest_for_thread(_start_y, pitch, dest);
fracpos += iscale * thread->skipped_by_thread(_start_y);
iscale *= thread->num_cores;
pitch *= thread->num_cores;
while (count > 0)
{
uint8_t color = colormap[source[fracpos >> FRACBITS]];
for (int x = 0; x < width; x++)
dest[x] = color;
dest += pitch;
fracpos += iscale;
count--;
}
}
/////////////////////////////////////////////////////////////////////////
DrawFogBoundaryLinePalCommand::DrawFogBoundaryLinePalCommand(int y, int x1, int x2) : y(y), x1(x1), x2(x2)
{
using namespace drawerargs;

View File

@ -204,24 +204,6 @@ namespace swrenderer
uint8_t *destorg;
};
class DrawSlabPalCommand : public PalSpanCommand
{
public:
DrawSlabPalCommand(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p, const uint8_t *colormap);
void Execute(DrawerThread *thread) override;
private:
int _dx;
fixed_t _v;
int _dy;
fixed_t _vi;
const uint8_t *_vvptr;
uint8_t *_p;
const uint8_t *_colormap;
int _pitch;
int _start_y;
};
class DrawFogBoundaryLinePalCommand : public PalSpanCommand
{
public:

View File

@ -489,116 +489,6 @@ namespace swrenderer
/////////////////////////////////////////////////////////////////////////////
DrawSlabRGBACommand::DrawSlabRGBACommand(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p, ShadeConstants shade_constants, const uint8_t *colormap, fixed_t light)
{
using namespace drawerargs;
_dx = dx;
_v = v;
_dy = dy;
_vi = vi;
_voxelptr = vptr;
_p = (uint32_t *)p;
_shade_constants = shade_constants;
_colormap = colormap;
_light = light;
_pitch = dc_pitch;
_start_y = static_cast<int>((p - dc_destorg) / (dc_pitch * 4));
assert(dx > 0);
}
void DrawSlabRGBACommand::Execute(DrawerThread *thread)
{
int dx = _dx;
fixed_t v = _v;
int dy = _dy;
fixed_t vi = _vi;
const uint8_t *vptr = _voxelptr;
uint32_t *p = _p;
ShadeConstants shade_constants = _shade_constants;
const uint8_t *colormap = _colormap;
uint32_t light = LightBgra::calc_light_multiplier(_light);
int pitch = _pitch;
int x;
dy = thread->count_for_thread(_start_y, dy);
p = thread->dest_for_thread(_start_y, pitch, p);
v += vi * thread->skipped_by_thread(_start_y);
vi *= thread->num_cores;
pitch *= thread->num_cores;
if (dx == 1)
{
while (dy > 0)
{
*p = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants);
p += pitch;
v += vi;
dy--;
}
}
else if (dx == 2)
{
while (dy > 0)
{
uint32_t color = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants);
p[0] = color;
p[1] = color;
p += pitch;
v += vi;
dy--;
}
}
else if (dx == 3)
{
while (dy > 0)
{
uint32_t color = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants);
p[0] = color;
p[1] = color;
p[2] = color;
p += pitch;
v += vi;
dy--;
}
}
else if (dx == 4)
{
while (dy > 0)
{
uint32_t color = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants);
p[0] = color;
p[1] = color;
p[2] = color;
p[3] = color;
p += pitch;
v += vi;
dy--;
}
}
else while (dy > 0)
{
uint32_t color = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants);
// The optimizer will probably turn this into a memset call.
// Since dx is not likely to be large, I'm not sure that's a good thing,
// hence the alternatives above.
for (x = 0; x < dx; x++)
{
p[x] = color;
}
p += pitch;
v += vi;
dy--;
}
}
FString DrawSlabRGBACommand::DebugInfo()
{
return "DrawSlab";
}
/////////////////////////////////////////////////////////////////////////////
DrawFogBoundaryLineRGBACommand::DrawFogBoundaryLineRGBACommand(int y, int x, int x2)
{
using namespace drawerargs;

View File

@ -211,26 +211,6 @@ namespace swrenderer
FString DebugInfo() override;
};
class DrawSlabRGBACommand : public DrawerCommand
{
int _dx;
fixed_t _v;
int _dy;
fixed_t _vi;
const uint8_t *_voxelptr;
uint32_t *_p;
ShadeConstants _shade_constants;
const uint8_t *_colormap;
fixed_t _light;
int _pitch;
int _start_y;
public:
DrawSlabRGBACommand(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p, ShadeConstants shade_constants, const uint8_t *colormap, fixed_t light);
void Execute(DrawerThread *thread) override;
FString DebugInfo() override;
};
class DrawFogBoundaryLineRGBACommand : public DrawerCommand
{
int _y;