mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Merge TC handling back into r_draw
This commit is contained in:
parent
beb70d7dfa
commit
e3e90e1a08
4 changed files with 518 additions and 2051 deletions
418
src/r_draw.cpp
418
src/r_draw.cpp
|
@ -16,6 +16,7 @@
|
|||
#include "r_data/colormaps.h"
|
||||
#include "r_plane.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_draw_rgba.h"
|
||||
#include "r_draw_pal.h"
|
||||
#include "r_thread.h"
|
||||
|
||||
|
@ -42,6 +43,9 @@ namespace swrenderer
|
|||
{
|
||||
int dc_pitch;
|
||||
lighttable_t *dc_colormap;
|
||||
FSWColormap *dc_fcolormap;
|
||||
ShadeConstants dc_shade_constants;
|
||||
fixed_t dc_light;
|
||||
int dc_x;
|
||||
int dc_yl;
|
||||
int dc_yh;
|
||||
|
@ -78,6 +82,8 @@ namespace swrenderer
|
|||
int ds_x1;
|
||||
int ds_x2;
|
||||
lighttable_t * ds_colormap;
|
||||
FSWColormap *ds_fcolormap;
|
||||
ShadeConstants ds_shade_constants;
|
||||
dsfixed_t ds_light;
|
||||
dsfixed_t ds_xfrac;
|
||||
dsfixed_t ds_yfrac;
|
||||
|
@ -88,7 +94,9 @@ namespace swrenderer
|
|||
fixed_t ds_alpha;
|
||||
double ds_lod;
|
||||
const uint8_t *ds_source;
|
||||
bool ds_source_mipmapped;
|
||||
int ds_color;
|
||||
bool drawer_needs_pal_input;
|
||||
unsigned int dc_tspans[4][MAXHEIGHT];
|
||||
unsigned int *dc_ctspan[4];
|
||||
unsigned int *horizspan[4];
|
||||
|
@ -199,6 +207,7 @@ namespace swrenderer
|
|||
colfunc = transcolfunc;
|
||||
hcolfunc_post1 = rt_tlate1col;
|
||||
hcolfunc_post4 = rt_tlate4cols;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -249,6 +258,7 @@ namespace swrenderer
|
|||
colfunc = R_DrawTlatedAddColumn;
|
||||
hcolfunc_post1 = rt_tlateadd1col;
|
||||
hcolfunc_post4 = rt_tlateadd4cols;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -270,6 +280,7 @@ namespace swrenderer
|
|||
colfunc = R_DrawAddClampTranslatedColumn;
|
||||
hcolfunc_post1 = rt_tlateaddclamp1col;
|
||||
hcolfunc_post4 = rt_tlateaddclamp4cols;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -292,6 +303,7 @@ namespace swrenderer
|
|||
colfunc = R_DrawSubClampTranslatedColumn;
|
||||
hcolfunc_post1 = rt_tlatesubclamp1col;
|
||||
hcolfunc_post4 = rt_tlatesubclamp4cols;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
return true;
|
||||
|
||||
|
@ -317,6 +329,7 @@ namespace swrenderer
|
|||
colfunc = R_DrawRevSubClampTranslatedColumn;
|
||||
hcolfunc_post1 = rt_tlaterevsubclamp1col;
|
||||
hcolfunc_post4 = rt_tlaterevsubclamp4cols;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
return true;
|
||||
|
||||
|
@ -346,6 +359,8 @@ namespace swrenderer
|
|||
|
||||
fixed_t fglevel, bglevel;
|
||||
|
||||
drawer_needs_pal_input = false;
|
||||
|
||||
style.CheckFuzz();
|
||||
|
||||
if (style.BlendOp == STYLEOP_Shadow)
|
||||
|
@ -376,6 +391,9 @@ namespace swrenderer
|
|||
FRemapTable *table = TranslationToTable(translation);
|
||||
if (table != NULL && !table->Inactive)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
dc_translation = (uint8_t*)table->Palette;
|
||||
else
|
||||
dc_translation = table->Remap;
|
||||
}
|
||||
}
|
||||
|
@ -397,13 +415,19 @@ namespace swrenderer
|
|||
colfunc = R_DrawShadedColumn;
|
||||
hcolfunc_post1 = rt_shaded1col;
|
||||
hcolfunc_post4 = rt_shaded4cols;
|
||||
dc_color = fixedcolormap ? fixedcolormap[APART(color)] : basecolormap->Maps[APART(color)];
|
||||
dc_colormap = (basecolormap = &ShadeFakeColormap[16 - alpha])->Maps;
|
||||
drawer_needs_pal_input = true;
|
||||
dc_color = fixedcolormap ? fixedcolormap->Maps[APART(color)] : basecolormap->Maps[APART(color)];
|
||||
basecolormap = &ShadeFakeColormap[16 - alpha];
|
||||
if (fixedlightlev >= 0 && fixedcolormap == NULL)
|
||||
{
|
||||
dc_colormap += fixedlightlev;
|
||||
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
}
|
||||
return r_columnmethod ? DoDraw1 : DoDraw0;
|
||||
else
|
||||
{
|
||||
R_SetColorMapLight(basecolormap, 0, 0);
|
||||
}
|
||||
bool active_columnmethod = r_columnmethod && !r_swtruecolor;
|
||||
return active_columnmethod ? DoDraw1 : DoDraw0;
|
||||
}
|
||||
|
||||
fglevel = GetAlpha(style.SrcAlpha, alpha);
|
||||
|
@ -429,14 +453,15 @@ namespace swrenderer
|
|||
// with the alpha.
|
||||
dc_srccolor = ((((r*x) >> 4) << 20) | ((g*x) >> 4) | ((((b)*x) >> 4) << 10)) & 0x3feffbff;
|
||||
hcolfunc_pre = R_FillColumnHoriz;
|
||||
R_SetColorMapLight(identitycolormap.Maps, 0, 0);
|
||||
R_SetColorMapLight(&identitycolormap, 0, 0);
|
||||
}
|
||||
|
||||
if (!R_SetBlendFunc(style.BlendOp, fglevel, bglevel, style.Flags))
|
||||
{
|
||||
return DontDraw;
|
||||
}
|
||||
return r_columnmethod ? DoDraw1 : DoDraw0;
|
||||
bool active_columnmethod = r_columnmethod && !r_swtruecolor;
|
||||
return active_columnmethod ? DoDraw1 : DoDraw0;
|
||||
}
|
||||
|
||||
ESPSResult R_SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color)
|
||||
|
@ -460,6 +485,9 @@ namespace swrenderer
|
|||
col = width + (col % width);
|
||||
}
|
||||
|
||||
if (r_swtruecolor)
|
||||
return (const uint8_t *)tex->GetColumnBgra(col, nullptr);
|
||||
else
|
||||
return tex->GetColumn(col, nullptr);
|
||||
}
|
||||
|
||||
|
@ -507,26 +535,85 @@ namespace swrenderer
|
|||
drawerargs::tmvlinebits = fracbits;
|
||||
}
|
||||
|
||||
void R_SetColorMapLight(lighttable_t *base_colormap, float light, int shade)
|
||||
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
dc_colormap = base_colormap + (GETPALOOKUP(light, shade) << COLORMAPSHIFT);
|
||||
dc_fcolormap = base_colormap;
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
dc_shade_constants.light_red = dc_fcolormap->Color.r * 256 / 255;
|
||||
dc_shade_constants.light_green = dc_fcolormap->Color.g * 256 / 255;
|
||||
dc_shade_constants.light_blue = dc_fcolormap->Color.b * 256 / 255;
|
||||
dc_shade_constants.light_alpha = dc_fcolormap->Color.a * 256 / 255;
|
||||
dc_shade_constants.fade_red = dc_fcolormap->Fade.r;
|
||||
dc_shade_constants.fade_green = dc_fcolormap->Fade.g;
|
||||
dc_shade_constants.fade_blue = dc_fcolormap->Fade.b;
|
||||
dc_shade_constants.fade_alpha = dc_fcolormap->Fade.a;
|
||||
dc_shade_constants.desaturate = MIN(abs(dc_fcolormap->Desaturate), 255) * 255 / 256;
|
||||
dc_shade_constants.simple_shade = (dc_fcolormap->Color.d == 0x00ffffff && dc_fcolormap->Fade.d == 0x00000000 && dc_fcolormap->Desaturate == 0);
|
||||
dc_colormap = base_colormap->Maps;
|
||||
dc_light = LIGHTSCALE(light, shade);
|
||||
}
|
||||
else
|
||||
{
|
||||
dc_colormap = base_colormap->Maps + (GETPALOOKUP(light, shade) << COLORMAPSHIFT);
|
||||
}
|
||||
}
|
||||
|
||||
void R_SetDSColorMapLight(lighttable_t *base_colormap, float light, int shade)
|
||||
void R_SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
ds_colormap = base_colormap + (GETPALOOKUP(light, shade) << COLORMAPSHIFT);
|
||||
ds_fcolormap = base_colormap;
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
ds_shade_constants.light_red = ds_fcolormap->Color.r * 256 / 255;
|
||||
ds_shade_constants.light_green = ds_fcolormap->Color.g * 256 / 255;
|
||||
ds_shade_constants.light_blue = ds_fcolormap->Color.b * 256 / 255;
|
||||
ds_shade_constants.light_alpha = ds_fcolormap->Color.a * 256 / 255;
|
||||
ds_shade_constants.fade_red = ds_fcolormap->Fade.r;
|
||||
ds_shade_constants.fade_green = ds_fcolormap->Fade.g;
|
||||
ds_shade_constants.fade_blue = ds_fcolormap->Fade.b;
|
||||
ds_shade_constants.fade_alpha = ds_fcolormap->Fade.a;
|
||||
ds_shade_constants.desaturate = MIN(abs(ds_fcolormap->Desaturate), 255) * 255 / 256;
|
||||
ds_shade_constants.simple_shade = (ds_fcolormap->Color.d == 0x00ffffff && ds_fcolormap->Fade.d == 0x00000000 && ds_fcolormap->Desaturate == 0);
|
||||
ds_colormap = base_colormap->Maps;
|
||||
ds_light = LIGHTSCALE(light, shade);
|
||||
}
|
||||
else
|
||||
{
|
||||
ds_colormap = base_colormap->Maps + (GETPALOOKUP(light, shade) << COLORMAPSHIFT);
|
||||
}
|
||||
}
|
||||
|
||||
void R_SetTranslationMap(lighttable_t *translation)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
dc_fcolormap = nullptr;
|
||||
dc_colormap = nullptr;
|
||||
dc_translation = translation;
|
||||
dc_shade_constants.light_red = 256;
|
||||
dc_shade_constants.light_green = 256;
|
||||
dc_shade_constants.light_blue = 256;
|
||||
dc_shade_constants.light_alpha = 256;
|
||||
dc_shade_constants.fade_red = 0;
|
||||
dc_shade_constants.fade_green = 0;
|
||||
dc_shade_constants.fade_blue = 0;
|
||||
dc_shade_constants.fade_alpha = 256;
|
||||
dc_shade_constants.desaturate = 0;
|
||||
dc_shade_constants.simple_shade = true;
|
||||
dc_light = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc_fcolormap = nullptr;
|
||||
dc_colormap = translation;
|
||||
}
|
||||
}
|
||||
|
||||
void rt_initcols(uint8_t *buffer)
|
||||
{
|
||||
|
@ -535,6 +622,9 @@ namespace swrenderer
|
|||
for (int y = 3; y >= 0; y--)
|
||||
horizspan[y] = dc_ctspan[y] = &dc_tspans[y][0];
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<RtInitColsRGBACommand>(buffer);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<RtInitColsPalCommand>(buffer);
|
||||
}
|
||||
|
||||
|
@ -727,18 +817,17 @@ namespace swrenderer
|
|||
}
|
||||
}
|
||||
|
||||
void R_SetSpanColormap(lighttable_t *colormap)
|
||||
void R_SetSpanColormap(FDynamicColormap *colormap, int shade)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
ds_colormap = colormap;
|
||||
R_SetDSColorMapLight(colormap, 0, shade);
|
||||
}
|
||||
|
||||
void R_SetSpanSource(FTexture *tex)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
ds_source = tex->GetPixels();
|
||||
ds_source = r_swtruecolor ? (const uint8_t*)tex->GetPixelsBgra() : tex->GetPixels();
|
||||
ds_source_mipmapped = tex->Mipmapped() && tex->GetWidth() > 1 && tex->GetHeight() > 1;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
@ -756,6 +845,9 @@ namespace swrenderer
|
|||
(*span)[1] = dc_yh;
|
||||
*span += 2;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<FillColumnHorizRGBACommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<FillColumnHorizPalCommand>();
|
||||
}
|
||||
|
||||
|
@ -772,167 +864,300 @@ namespace swrenderer
|
|||
(*span)[1] = dc_yh;
|
||||
*span += 2;
|
||||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
if (drawer_needs_pal_input)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnHorizRGBACommand<uint8_t>>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnHorizRGBACommand<uint32_t>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnHorizPalCommand>();
|
||||
}
|
||||
}
|
||||
|
||||
// Copies one span at hx to the screen at sx.
|
||||
void rt_copy1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1CopyLLVMCommand>(hx, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1CopyPalCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Copies all four spans to the screen starting at sx.
|
||||
void rt_copy4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
// To do: we could do this with SSE using __m128i
|
||||
rt_copy1col(0, sx, yl, yh);
|
||||
rt_copy1col(1, sx + 1, yl, yh);
|
||||
rt_copy1col(2, sx + 2, yl, yh);
|
||||
rt_copy1col(3, sx + 3, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4CopyPalCommand>(0, sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Maps one span at hx to the screen at sx.
|
||||
void rt_map1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1LLVMCommand>(hx, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1PalCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Maps all four spans to the screen starting at sx.
|
||||
void rt_map4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4LLVMCommand>(0, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4PalCommand>(0, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates one span at hx to the screen at sx.
|
||||
void rt_tlate1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1TranslatedLLVMCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1TranslatedPalCommand>(hx, sx, yl, yh);
|
||||
rt_map1col(hx, sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Translates all four spans to the screen starting at sx.
|
||||
void rt_tlate4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4TranslatedLLVMCommand>(0, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4TranslatedPalCommand>(0, sx, yl, yh);
|
||||
rt_map4cols(sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Adds one span at hx to the screen at sx without clamping.
|
||||
void rt_add1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1AddLLVMCommand>(hx, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1AddPalCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Adds all four spans to the screen starting at sx without clamping.
|
||||
void rt_add4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4AddLLVMCommand>(0, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4AddPalCommand>(0, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates and adds one span at hx to the screen at sx without clamping.
|
||||
void rt_tlateadd1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1AddClampTranslatedLLVMCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1TranslatedPalCommand>(hx, sx, yl, yh);
|
||||
rt_add1col(hx, sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Translates and adds all four spans to the screen starting at sx without clamping.
|
||||
void rt_tlateadd4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4AddClampTranslatedLLVMCommand>(0, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4TranslatedPalCommand>(0, sx, yl, yh);
|
||||
rt_add4cols(sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Shades one span at hx to the screen at sx.
|
||||
void rt_shaded1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1ShadedLLVMCommand>(hx, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1ShadedPalCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Shades all four spans to the screen starting at sx.
|
||||
void rt_shaded4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4ShadedLLVMCommand>(0, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4ShadedPalCommand>(0, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Adds one span at hx to the screen at sx with clamping.
|
||||
void rt_addclamp1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1AddClampLLVMCommand>(hx, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1AddClampPalCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Adds all four spans to the screen starting at sx with clamping.
|
||||
void rt_addclamp4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4AddClampLLVMCommand>(0, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4AddClampPalCommand>(0, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates and adds one span at hx to the screen at sx with clamping.
|
||||
void rt_tlateaddclamp1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1AddClampTranslatedLLVMCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1TranslatedPalCommand>(hx, sx, yl, yh);
|
||||
rt_addclamp1col(hx, sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Translates and adds all four spans to the screen starting at sx with clamping.
|
||||
void rt_tlateaddclamp4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4AddClampTranslatedLLVMCommand>(0, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4TranslatedPalCommand>(0, sx, yl, yh);
|
||||
rt_addclamp4cols(sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Subtracts one span at hx to the screen at sx with clamping.
|
||||
void rt_subclamp1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1SubClampLLVMCommand>(hx, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1SubClampPalCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Subtracts all four spans to the screen starting at sx with clamping.
|
||||
void rt_subclamp4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4SubClampLLVMCommand>(0, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4SubClampPalCommand>(0, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates and subtracts one span at hx to the screen at sx with clamping.
|
||||
void rt_tlatesubclamp1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1SubClampTranslatedLLVMCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1TranslatedPalCommand>(hx, sx, yl, yh);
|
||||
rt_subclamp1col(hx, sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Translates and subtracts all four spans to the screen starting at sx with clamping.
|
||||
void rt_tlatesubclamp4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4SubClampTranslatedLLVMCommand>(0, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4TranslatedPalCommand>(0, sx, yl, yh);
|
||||
rt_subclamp4cols(sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Subtracts one span at hx from the screen at sx with clamping.
|
||||
void rt_revsubclamp1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1RevSubClampLLVMCommand>(hx, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1RevSubClampPalCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Subtracts all four spans from the screen starting at sx with clamping.
|
||||
void rt_revsubclamp4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4RevSubClampLLVMCommand>(0, sx, yl, yh);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4RevSubClampPalCommand>(0, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates and subtracts one span at hx from the screen at sx with clamping.
|
||||
void rt_tlaterevsubclamp1col(int hx, int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1RevSubClampTranslatedLLVMCommand>(hx, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt1TranslatedPalCommand>(hx, sx, yl, yh);
|
||||
rt_revsubclamp1col(hx, sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
// Translates and subtracts all four spans from the screen starting at sx with clamping.
|
||||
void rt_tlaterevsubclamp4cols(int sx, int yl, int yh)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4RevSubClampTranslatedLLVMCommand>(0, sx, yl, yh);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRt4TranslatedPalCommand>(0, sx, yl, yh);
|
||||
rt_revsubclamp4cols(sx, yl, yh);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t vlinec1()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWall1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWall1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
|
@ -942,6 +1167,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWall4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWall4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -952,6 +1180,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallMasked1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallMasked1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
|
@ -961,6 +1192,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallMasked4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallMasked4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -971,6 +1205,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
|
@ -980,6 +1217,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -990,6 +1230,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
|
@ -999,6 +1242,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -1009,6 +1255,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallSubClamp1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallSubClamp1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
|
@ -1018,6 +1267,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallSubClamp4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallSubClamp4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -1028,6 +1280,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
|
@ -1037,6 +1292,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -1045,51 +1303,81 @@ namespace swrenderer
|
|||
|
||||
void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawSingleSky1LLVMCommand>(solid_top, solid_bottom);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawSingleSky1PalCommand>(solid_top, solid_bottom);
|
||||
}
|
||||
|
||||
void R_DrawSingleSkyCol4(uint32_t solid_top, uint32_t solid_bottom)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawSingleSky4LLVMCommand>(solid_top, solid_bottom);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawSingleSky4PalCommand>(solid_top, solid_bottom);
|
||||
}
|
||||
|
||||
void R_DrawDoubleSkyCol1(uint32_t solid_top, uint32_t solid_bottom)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawDoubleSky1LLVMCommand>(solid_top, solid_bottom);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawDoubleSky1PalCommand>(solid_top, solid_bottom);
|
||||
}
|
||||
|
||||
void R_DrawDoubleSkyCol4(uint32_t solid_top, uint32_t solid_bottom)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawDoubleSky4LLVMCommand>(solid_top, solid_bottom);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawDoubleSky4PalCommand>(solid_top, solid_bottom);
|
||||
}
|
||||
|
||||
void R_DrawColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnPalCommand>();
|
||||
}
|
||||
|
||||
void R_FillColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<FillColumnLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<FillColumnPalCommand>();
|
||||
}
|
||||
|
||||
void R_FillAddColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<FillColumnAddLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<FillColumnAddPalCommand>();
|
||||
}
|
||||
|
||||
void R_FillAddClampColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<FillColumnAddClampLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<FillColumnAddClampPalCommand>();
|
||||
}
|
||||
|
||||
void R_FillSubClampColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<FillColumnSubClampLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<FillColumnSubClampPalCommand>();
|
||||
}
|
||||
|
||||
void R_FillRevSubClampColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<FillColumnRevSubClampLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<FillColumnRevSubClampPalCommand>();
|
||||
}
|
||||
|
||||
|
@ -1097,6 +1385,9 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawFuzzColumnRGBACommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawFuzzColumnPalCommand>();
|
||||
|
||||
dc_yl = MAX(dc_yl, 1);
|
||||
|
@ -1107,112 +1398,185 @@ namespace swrenderer
|
|||
|
||||
void R_DrawAddColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnAddLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnAddPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawTranslatedColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnTranslatedLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnTranslatedPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawTlatedAddColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnTlatedAddLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnTlatedAddPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawShadedColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnShadedLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnShadedPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawAddClampColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnAddClampLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnAddClampPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawAddClampTranslatedColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnAddClampTranslatedLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnAddClampTranslatedPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawSubClampColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnSubClampLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnSubClampPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawSubClampTranslatedColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnSubClampTranslatedLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnSubClampTranslatedPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawRevSubClampColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawRevSubClampTranslatedColumn()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampTranslatedLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampTranslatedPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawSpan()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawSpanMasked()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanMaskedLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanMaskedPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawSpanTranslucent()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanTranslucentLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanTranslucentPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawSpanMaskedTranslucent()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanMaskedTranslucentLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanMaskedTranslucentPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawSpanAddClamp()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanAddClampLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanAddClampPalCommand>();
|
||||
}
|
||||
|
||||
void R_DrawSpanMaskedAddClamp()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanMaskedAddClampLLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawSpanMaskedAddClampPalCommand>();
|
||||
}
|
||||
|
||||
void R_FillSpan()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<FillSpanRGBACommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<FillSpanPalCommand>();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawTiltedSpanRGBACommand>(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawTiltedSpanPalCommand>(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy);
|
||||
}
|
||||
|
||||
void R_DrawColoredSpan(int y, int x1, int x2)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawColoredSpanRGBACommand>(y, x1, x2);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawColoredSpanPalCommand>(y, x1, x2);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
const uint8_t *slab_colormap;
|
||||
ShadeConstants slab_rgba_shade_constants;
|
||||
const uint8_t *slab_rgba_colormap;
|
||||
fixed_t slab_rgba_light;
|
||||
}
|
||||
|
||||
void R_SetupDrawSlab(uint8_t *colormap)
|
||||
void R_SetupDrawSlab(FSWColormap *base_colormap, float light, int shade)
|
||||
{
|
||||
slab_colormap = colormap;
|
||||
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)
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawSlabPalCommand>(dx, v, dy, vi, vptr, p, slab_colormap);
|
||||
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)
|
||||
|
@ -1220,6 +1584,9 @@ namespace swrenderer
|
|||
for (; y < y2; ++y)
|
||||
{
|
||||
int x2 = spanend[y];
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawFogBoundaryLineRGBACommand>(y, x1, x2);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawFogBoundaryLinePalCommand>(y, x1, x2);
|
||||
}
|
||||
}
|
||||
|
@ -1244,7 +1611,7 @@ namespace swrenderer
|
|||
clearbufshort(spanend + t2, b2 - t2, x);
|
||||
}
|
||||
|
||||
R_SetColorMapLight(basecolormap->Maps, (float)light, wallshade);
|
||||
R_SetColorMapLight(basecolormap, (float)light, wallshade);
|
||||
|
||||
uint8_t *fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
|
||||
|
||||
|
@ -1271,7 +1638,7 @@ namespace swrenderer
|
|||
clearbufshort(spanend + t2, b2 - t2, x);
|
||||
}
|
||||
rcolormap = lcolormap;
|
||||
R_SetColorMapLight(basecolormap->Maps, (float)light, wallshade);
|
||||
R_SetColorMapLight(basecolormap, (float)light, wallshade);
|
||||
fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
|
||||
}
|
||||
else
|
||||
|
@ -1282,12 +1649,18 @@ namespace swrenderer
|
|||
while (t2 < stop)
|
||||
{
|
||||
int y = t2++;
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawFogBoundaryLineRGBACommand>(y, xr, spanend[y]);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawFogBoundaryLinePalCommand>(y, xr, spanend[y]);
|
||||
}
|
||||
stop = MAX(b1, t2);
|
||||
while (b2 > stop)
|
||||
{
|
||||
int y = --b2;
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawFogBoundaryLineRGBACommand>(y, xr, spanend[y]);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawFogBoundaryLinePalCommand>(y, xr, spanend[y]);
|
||||
}
|
||||
}
|
||||
|
@ -1320,6 +1693,9 @@ namespace swrenderer
|
|||
|
||||
void R_DrawParticle(vissprite_t *sprite)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
R_DrawParticle_rgba(sprite);
|
||||
else
|
||||
R_DrawParticle_C(sprite);
|
||||
}
|
||||
}
|
||||
|
|
39
src/r_draw.h
39
src/r_draw.h
|
@ -3,7 +3,13 @@
|
|||
|
||||
#include "r_defs.h"
|
||||
|
||||
struct FSWColormap;
|
||||
|
||||
EXTERN_CVAR(Bool, r_multithreaded);
|
||||
EXTERN_CVAR(Bool, r_magfilter);
|
||||
EXTERN_CVAR(Bool, r_minfilter);
|
||||
EXTERN_CVAR(Bool, r_mipmap);
|
||||
EXTERN_CVAR(Float, r_lod_bias);
|
||||
EXTERN_CVAR(Int, r_drawfuzz);
|
||||
EXTERN_CVAR(Bool, r_drawtrans);
|
||||
EXTERN_CVAR(Float, transsouls);
|
||||
|
@ -13,12 +19,29 @@ namespace swrenderer
|
|||
{
|
||||
struct vissprite_t;
|
||||
|
||||
struct ShadeConstants
|
||||
{
|
||||
uint16_t light_alpha;
|
||||
uint16_t light_red;
|
||||
uint16_t light_green;
|
||||
uint16_t light_blue;
|
||||
uint16_t fade_alpha;
|
||||
uint16_t fade_red;
|
||||
uint16_t fade_green;
|
||||
uint16_t fade_blue;
|
||||
uint16_t desaturate;
|
||||
bool simple_shade;
|
||||
};
|
||||
|
||||
extern double dc_texturemid;
|
||||
|
||||
namespace drawerargs
|
||||
{
|
||||
extern int dc_pitch;
|
||||
extern lighttable_t *dc_colormap;
|
||||
extern FSWColormap *dc_fcolormap;
|
||||
extern ShadeConstants dc_shade_constants;
|
||||
extern fixed_t dc_light;
|
||||
extern int dc_x;
|
||||
extern int dc_yl;
|
||||
extern int dc_yh;
|
||||
|
@ -41,6 +64,8 @@ namespace swrenderer
|
|||
extern int dc_destheight;
|
||||
extern int dc_count;
|
||||
|
||||
extern bool drawer_needs_pal_input;
|
||||
|
||||
extern uint32_t vplce[4];
|
||||
extern uint32_t vince[4];
|
||||
extern uint8_t *palookupoffse[4];
|
||||
|
@ -57,6 +82,8 @@ namespace swrenderer
|
|||
extern int ds_x1;
|
||||
extern int ds_x2;
|
||||
extern lighttable_t * ds_colormap;
|
||||
extern FSWColormap *ds_fcolormap;
|
||||
extern ShadeConstants ds_shade_constants;
|
||||
extern dsfixed_t ds_light;
|
||||
extern dsfixed_t ds_xfrac;
|
||||
extern dsfixed_t ds_yfrac;
|
||||
|
@ -67,6 +94,7 @@ namespace swrenderer
|
|||
extern fixed_t ds_alpha;
|
||||
extern double ds_lod;
|
||||
extern const uint8_t *ds_source;
|
||||
extern bool ds_source_mipmapped;
|
||||
extern int ds_color;
|
||||
|
||||
extern unsigned int dc_tspans[4][MAXHEIGHT];
|
||||
|
@ -86,6 +114,8 @@ namespace swrenderer
|
|||
extern int fuzzpos;
|
||||
extern int fuzzviewheight;
|
||||
|
||||
extern bool r_swtruecolor;
|
||||
|
||||
void R_InitColumnDrawers();
|
||||
void R_InitShadeMaps();
|
||||
void R_InitFuzzTable(int fuzzoff);
|
||||
|
@ -162,7 +192,7 @@ 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(uint8_t *colormap);
|
||||
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);
|
||||
uint32_t vlinec1();
|
||||
|
@ -194,12 +224,13 @@ namespace swrenderer
|
|||
void R_DrawDoubleSkyCol1(uint32_t solid_top, uint32_t solid_bottom);
|
||||
void R_DrawDoubleSkyCol4(uint32_t solid_top, uint32_t solid_bottom);
|
||||
|
||||
void R_SetColorMapLight(lighttable_t *base_colormap, float light, int shade);
|
||||
void R_SetDSColorMapLight(lighttable_t *base_colormap, float light, int shade);
|
||||
// Sets dc_colormap and dc_light to their appropriate values depending on the output format (pal vs true color)
|
||||
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
||||
void R_SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
||||
void R_SetTranslationMap(lighttable_t *translation);
|
||||
|
||||
void R_SetupSpanBits(FTexture *tex);
|
||||
void R_SetSpanColormap(lighttable_t *colormap);
|
||||
void R_SetSpanColormap(FDynamicColormap *colormap, int shade);
|
||||
void R_SetSpanSource(FTexture *tex);
|
||||
|
||||
void R_MapTiltedPlane(int y, int x1);
|
||||
|
|
1701
src/r_draw_tc.cpp
1701
src/r_draw_tc.cpp
File diff suppressed because it is too large
Load diff
239
src/r_draw_tc.h
239
src/r_draw_tc.h
|
@ -1,239 +0,0 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "r_defs.h"
|
||||
|
||||
struct FSWColormap;
|
||||
|
||||
EXTERN_CVAR(Bool, r_multithreaded);
|
||||
EXTERN_CVAR(Bool, r_magfilter);
|
||||
EXTERN_CVAR(Bool, r_minfilter);
|
||||
EXTERN_CVAR(Bool, r_mipmap);
|
||||
EXTERN_CVAR(Float, r_lod_bias);
|
||||
EXTERN_CVAR(Int, r_drawfuzz);
|
||||
EXTERN_CVAR(Bool, r_drawtrans);
|
||||
EXTERN_CVAR(Float, transsouls);
|
||||
EXTERN_CVAR(Int, r_columnmethod);
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
struct vissprite_t;
|
||||
|
||||
struct ShadeConstants
|
||||
{
|
||||
uint16_t light_alpha;
|
||||
uint16_t light_red;
|
||||
uint16_t light_green;
|
||||
uint16_t light_blue;
|
||||
uint16_t fade_alpha;
|
||||
uint16_t fade_red;
|
||||
uint16_t fade_green;
|
||||
uint16_t fade_blue;
|
||||
uint16_t desaturate;
|
||||
bool simple_shade;
|
||||
};
|
||||
|
||||
extern double dc_texturemid;
|
||||
|
||||
namespace drawerargs
|
||||
{
|
||||
extern int dc_pitch;
|
||||
extern lighttable_t *dc_colormap;
|
||||
extern FSWColormap *dc_fcolormap;
|
||||
extern ShadeConstants dc_shade_constants;
|
||||
extern fixed_t dc_light;
|
||||
extern int dc_x;
|
||||
extern int dc_yl;
|
||||
extern int dc_yh;
|
||||
extern fixed_t dc_iscale;
|
||||
extern fixed_t dc_texturefrac;
|
||||
extern uint32_t dc_textureheight;
|
||||
extern int dc_color;
|
||||
extern uint32_t dc_srccolor;
|
||||
extern uint32_t dc_srccolor_bgra;
|
||||
extern uint32_t *dc_srcblend;
|
||||
extern uint32_t *dc_destblend;
|
||||
extern fixed_t dc_srcalpha;
|
||||
extern fixed_t dc_destalpha;
|
||||
extern const uint8_t *dc_source;
|
||||
extern const uint8_t *dc_source2;
|
||||
extern uint32_t dc_texturefracx;
|
||||
extern uint8_t *dc_translation;
|
||||
extern uint8_t *dc_dest;
|
||||
extern uint8_t *dc_destorg;
|
||||
extern int dc_destheight;
|
||||
extern int dc_count;
|
||||
|
||||
extern bool drawer_needs_pal_input;
|
||||
|
||||
extern uint32_t vplce[4];
|
||||
extern uint32_t vince[4];
|
||||
extern uint8_t *palookupoffse[4];
|
||||
extern fixed_t palookuplight[4];
|
||||
extern const uint8_t *bufplce[4];
|
||||
extern const uint8_t *bufplce2[4];
|
||||
extern uint32_t buftexturefracx[4];
|
||||
extern uint32_t bufheight[4];
|
||||
extern int vlinebits;
|
||||
extern int mvlinebits;
|
||||
extern int tmvlinebits;
|
||||
|
||||
extern int ds_y;
|
||||
extern int ds_x1;
|
||||
extern int ds_x2;
|
||||
extern lighttable_t * ds_colormap;
|
||||
extern FSWColormap *ds_fcolormap;
|
||||
extern ShadeConstants ds_shade_constants;
|
||||
extern dsfixed_t ds_light;
|
||||
extern dsfixed_t ds_xfrac;
|
||||
extern dsfixed_t ds_yfrac;
|
||||
extern dsfixed_t ds_xstep;
|
||||
extern dsfixed_t ds_ystep;
|
||||
extern int ds_xbits;
|
||||
extern int ds_ybits;
|
||||
extern fixed_t ds_alpha;
|
||||
extern double ds_lod;
|
||||
extern const uint8_t *ds_source;
|
||||
extern bool ds_source_mipmapped;
|
||||
extern int ds_color;
|
||||
|
||||
extern unsigned int dc_tspans[4][MAXHEIGHT];
|
||||
extern unsigned int *dc_ctspan[4];
|
||||
extern unsigned int *horizspan[4];
|
||||
}
|
||||
|
||||
extern int ylookup[MAXHEIGHT];
|
||||
extern uint8_t shadetables[/*NUMCOLORMAPS*16*256*/];
|
||||
extern FDynamicColormap ShadeFakeColormap[16];
|
||||
extern uint8_t identitymap[256];
|
||||
extern FDynamicColormap identitycolormap;
|
||||
|
||||
// Spectre/Invisibility.
|
||||
#define FUZZTABLE 50
|
||||
extern int fuzzoffset[FUZZTABLE + 1];
|
||||
extern int fuzzpos;
|
||||
extern int fuzzviewheight;
|
||||
|
||||
extern bool r_swtruecolor;
|
||||
|
||||
void R_InitColumnDrawers();
|
||||
void R_InitShadeMaps();
|
||||
void R_InitFuzzTable(int fuzzoff);
|
||||
|
||||
enum ESPSResult
|
||||
{
|
||||
DontDraw, // not useful to draw this
|
||||
DoDraw0, // draw this as if r_columnmethod is 0
|
||||
DoDraw1, // draw this as if r_columnmethod is 1
|
||||
};
|
||||
|
||||
ESPSResult R_SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color);
|
||||
ESPSResult R_SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color);
|
||||
void R_FinishSetPatchStyle(); // Call this after finished drawing the current thing, in case its style was STYLE_Shade
|
||||
bool R_GetTransMaskDrawers(fixed_t(**tmvline1)(), void(**tmvline4)());
|
||||
|
||||
const uint8_t *R_GetColumn(FTexture *tex, int col);
|
||||
void wallscan(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const uint8_t *(*getcol)(FTexture *tex, int col) = R_GetColumn);
|
||||
void maskwallscan(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const uint8_t *(*getcol)(FTexture *tex, int col) = R_GetColumn);
|
||||
void transmaskwallscan(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const uint8_t *(*getcol)(FTexture *tex, int col) = R_GetColumn);
|
||||
|
||||
void rt_initcols(uint8_t *buffer = nullptr);
|
||||
void rt_span_coverage(int x, int start, int stop);
|
||||
void rt_draw4cols(int sx);
|
||||
void rt_flip_posts();
|
||||
void rt_copy1col(int hx, int sx, int yl, int yh);
|
||||
void rt_copy4cols(int sx, int yl, int yh);
|
||||
void rt_shaded1col(int hx, int sx, int yl, int yh);
|
||||
void rt_shaded4cols(int sx, int yl, int yh);
|
||||
void rt_map1col(int hx, int sx, int yl, int yh);
|
||||
void rt_add1col(int hx, int sx, int yl, int yh);
|
||||
void rt_addclamp1col(int hx, int sx, int yl, int yh);
|
||||
void rt_subclamp1col(int hx, int sx, int yl, int yh);
|
||||
void rt_revsubclamp1col(int hx, int sx, int yl, int yh);
|
||||
void rt_tlate1col(int hx, int sx, int yl, int yh);
|
||||
void rt_tlateadd1col(int hx, int sx, int yl, int yh);
|
||||
void rt_tlateaddclamp1col(int hx, int sx, int yl, int yh);
|
||||
void rt_tlatesubclamp1col(int hx, int sx, int yl, int yh);
|
||||
void rt_tlaterevsubclamp1col(int hx, int sx, int yl, int yh);
|
||||
void rt_map4cols(int sx, int yl, int yh);
|
||||
void rt_add4cols(int sx, int yl, int yh);
|
||||
void rt_addclamp4cols(int sx, int yl, int yh);
|
||||
void rt_subclamp4cols(int sx, int yl, int yh);
|
||||
void rt_revsubclamp4cols(int sx, int yl, int yh);
|
||||
void rt_tlate4cols(int sx, int yl, int yh);
|
||||
void rt_tlateadd4cols(int sx, int yl, int yh);
|
||||
void rt_tlateaddclamp4cols(int sx, int yl, int yh);
|
||||
void rt_tlatesubclamp4cols(int sx, int yl, int yh);
|
||||
void rt_tlaterevsubclamp4cols(int sx, int yl, int yh);
|
||||
void R_DrawColumnHoriz();
|
||||
void R_DrawColumn();
|
||||
void R_DrawFuzzColumn();
|
||||
void R_DrawTranslatedColumn();
|
||||
void R_DrawShadedColumn();
|
||||
void R_FillColumn();
|
||||
void R_FillAddColumn();
|
||||
void R_FillAddClampColumn();
|
||||
void R_FillSubClampColumn();
|
||||
void R_FillRevSubClampColumn();
|
||||
void R_DrawAddColumn();
|
||||
void R_DrawTlatedAddColumn();
|
||||
void R_DrawAddClampColumn();
|
||||
void R_DrawAddClampTranslatedColumn();
|
||||
void R_DrawSubClampColumn();
|
||||
void R_DrawSubClampTranslatedColumn();
|
||||
void R_DrawRevSubClampColumn();
|
||||
void R_DrawRevSubClampTranslatedColumn();
|
||||
void R_DrawSpan();
|
||||
void R_DrawSpanMasked();
|
||||
void R_DrawSpanTranslucent();
|
||||
void R_DrawSpanMaskedTranslucent();
|
||||
void R_DrawSpanAddClamp();
|
||||
void R_DrawSpanMaskedAddClamp();
|
||||
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);
|
||||
uint32_t vlinec1();
|
||||
void vlinec4();
|
||||
uint32_t mvlinec1();
|
||||
void mvlinec4();
|
||||
fixed_t tmvline1_add();
|
||||
void tmvline4_add();
|
||||
fixed_t tmvline1_addclamp();
|
||||
void tmvline4_addclamp();
|
||||
fixed_t tmvline1_subclamp();
|
||||
void tmvline4_subclamp();
|
||||
fixed_t tmvline1_revsubclamp();
|
||||
void tmvline4_revsubclamp();
|
||||
void R_FillColumnHoriz();
|
||||
void R_FillSpan();
|
||||
|
||||
inline uint32_t dovline1() { return vlinec1(); }
|
||||
inline void dovline4() { vlinec4(); }
|
||||
inline uint32_t domvline1() { return mvlinec1(); }
|
||||
inline void domvline4() { mvlinec4(); }
|
||||
|
||||
void setupvline(int fracbits);
|
||||
void setupmvline(int fracbits);
|
||||
void setuptmvline(int fracbits);
|
||||
|
||||
void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom);
|
||||
void R_DrawSingleSkyCol4(uint32_t solid_top, uint32_t solid_bottom);
|
||||
void R_DrawDoubleSkyCol1(uint32_t solid_top, uint32_t solid_bottom);
|
||||
void R_DrawDoubleSkyCol4(uint32_t solid_top, uint32_t solid_bottom);
|
||||
|
||||
// Sets dc_colormap and dc_light to their appropriate values depending on the output format (pal vs true color)
|
||||
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
||||
void R_SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
||||
void R_SetTranslationMap(lighttable_t *translation);
|
||||
|
||||
void R_SetupSpanBits(FTexture *tex);
|
||||
void R_SetSpanColormap(FDynamicColormap *colormap, int shade);
|
||||
void R_SetSpanSource(FTexture *tex);
|
||||
|
||||
void R_MapTiltedPlane(int y, int x1);
|
||||
void R_MapColoredPlane(int y, int x1);
|
||||
void R_DrawParticle(vissprite_t *);
|
||||
}
|
Loading…
Reference in a new issue