mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
Move drawerargs globals into a class and make them local
This commit is contained in:
parent
0c101102dc
commit
92bd752935
35 changed files with 606 additions and 1542 deletions
|
@ -850,6 +850,7 @@ set( FASTMATH_PCH_SOURCES
|
|||
swrenderer/drawers/r_draw.cpp
|
||||
swrenderer/drawers/r_draw_pal.cpp
|
||||
swrenderer/drawers/r_draw_rgba.cpp
|
||||
swrenderer/drawers/r_drawerargs.cpp
|
||||
swrenderer/drawers/r_drawers.cpp
|
||||
swrenderer/drawers/r_thread.cpp
|
||||
swrenderer/scene/r_3dfloors.cpp
|
||||
|
|
|
@ -2948,7 +2948,7 @@ void OpenGLSWFrameBuffer::FlatFill(int left, int top, int right, int bottom, FTe
|
|||
|
||||
void OpenGLSWFrameBuffer::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip)
|
||||
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
|
||||
{
|
||||
// Use an equation similar to player sprites to determine shade
|
||||
double fadelevel = clamp((LIGHT2SHADE(lightlevel) / 65536. - 12) / NUMCOLORMAPS, 0.0, 1.0);
|
||||
|
@ -2969,7 +2969,7 @@ void OpenGLSWFrameBuffer::FillSimplePoly(FTexture *texture, FVector2 *points, in
|
|||
}
|
||||
if (In2D < 2)
|
||||
{
|
||||
Super::FillSimplePoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, lightlevel, bottomclip);
|
||||
Super::FillSimplePoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, lightlevel, flatcolor, bottomclip);
|
||||
return;
|
||||
}
|
||||
if (!InScene)
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
void FlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin) override;
|
||||
void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 realcolor) override;
|
||||
void DrawPixel(int x, int y, int palcolor, uint32 rgbcolor) override;
|
||||
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, double originx, double originy, double scalex, double scaley, DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip) override;
|
||||
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, double originx, double originy, double scalex, double scaley, DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip) override;
|
||||
bool WipeStartScreen(int type) override;
|
||||
void WipeEndScreen() override;
|
||||
bool WipeDo(int ticks) override;
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "r_draw_rgba.h"
|
||||
#include "r_draw_pal.h"
|
||||
#include "r_thread.h"
|
||||
#include "r_drawerargs.h"
|
||||
#include "swrenderer/scene/r_light.h"
|
||||
|
||||
CVAR(Bool, r_dynlights, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
|
@ -70,86 +71,6 @@ namespace swrenderer
|
|||
short zeroarray[MAXWIDTH];
|
||||
short screenheightarray[MAXWIDTH];
|
||||
|
||||
namespace drawerargs
|
||||
{
|
||||
int dc_pitch;
|
||||
lighttable_t *dc_colormap;
|
||||
ShadeConstants dc_shade_constants;
|
||||
fixed_t dc_light;
|
||||
int dc_x;
|
||||
int dc_yl;
|
||||
int dc_yh;
|
||||
fixed_t dc_iscale;
|
||||
fixed_t dc_texturefrac;
|
||||
uint32_t dc_textureheight;
|
||||
int dc_color;
|
||||
uint32_t dc_srccolor;
|
||||
uint32_t dc_srccolor_bgra;
|
||||
uint32_t *dc_srcblend;
|
||||
uint32_t *dc_destblend;
|
||||
fixed_t dc_srcalpha;
|
||||
fixed_t dc_destalpha;
|
||||
const uint8_t *dc_source;
|
||||
const uint8_t *dc_source2;
|
||||
uint32_t dc_texturefracx;
|
||||
uint8_t *dc_translation;
|
||||
uint8_t *dc_dest;
|
||||
uint8_t *dc_destorg;
|
||||
int dc_destheight;
|
||||
int dc_count;
|
||||
FVector3 dc_normal;
|
||||
FVector3 dc_viewpos;
|
||||
FVector3 dc_viewpos_step;
|
||||
TriLight *dc_lights;
|
||||
int dc_num_lights;
|
||||
uint32_t dc_wall_texturefrac[4];
|
||||
uint32_t dc_wall_iscale[4];
|
||||
uint8_t *dc_wall_colormap[4];
|
||||
fixed_t dc_wall_light[4];
|
||||
const uint8_t *dc_wall_source[4];
|
||||
const uint8_t *dc_wall_source2[4];
|
||||
uint32_t dc_wall_texturefracx[4];
|
||||
uint32_t dc_wall_sourceheight[4];
|
||||
int dc_wall_fracbits;
|
||||
int ds_y;
|
||||
int ds_x1;
|
||||
int ds_x2;
|
||||
lighttable_t * ds_colormap;
|
||||
ShadeConstants ds_shade_constants;
|
||||
dsfixed_t ds_light;
|
||||
dsfixed_t ds_xfrac;
|
||||
dsfixed_t ds_yfrac;
|
||||
dsfixed_t ds_xstep;
|
||||
dsfixed_t ds_ystep;
|
||||
int ds_xbits;
|
||||
int ds_ybits;
|
||||
fixed_t ds_alpha;
|
||||
double ds_lod;
|
||||
const uint8_t *ds_source;
|
||||
bool ds_source_mipmapped;
|
||||
int ds_color;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
SWPixelFormatDrawers *active_drawers;
|
||||
SWPalDrawers pal_drawers;
|
||||
SWTruecolorDrawers tc_drawers;
|
||||
}
|
||||
|
||||
SWPixelFormatDrawers *DrawerStyle::Drawers() const
|
||||
{
|
||||
return active_drawers;
|
||||
}
|
||||
|
||||
void R_InitColumnDrawers()
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
active_drawers = &tc_drawers;
|
||||
else
|
||||
active_drawers = &pal_drawers;
|
||||
}
|
||||
|
||||
void R_InitShadeMaps()
|
||||
{
|
||||
int i, j;
|
||||
|
@ -235,643 +156,11 @@ namespace swrenderer
|
|||
}
|
||||
}
|
||||
|
||||
void DrawerStyle::SetColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
||||
void R_UpdateFuzzPos(const DrawerArgs &args)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
dc_shade_constants.light_red = base_colormap->Color.r * 256 / 255;
|
||||
dc_shade_constants.light_green = base_colormap->Color.g * 256 / 255;
|
||||
dc_shade_constants.light_blue = base_colormap->Color.b * 256 / 255;
|
||||
dc_shade_constants.light_alpha = base_colormap->Color.a * 256 / 255;
|
||||
dc_shade_constants.fade_red = base_colormap->Fade.r;
|
||||
dc_shade_constants.fade_green = base_colormap->Fade.g;
|
||||
dc_shade_constants.fade_blue = base_colormap->Fade.b;
|
||||
dc_shade_constants.fade_alpha = base_colormap->Fade.a;
|
||||
dc_shade_constants.desaturate = MIN(abs(base_colormap->Desaturate), 255) * 255 / 256;
|
||||
dc_shade_constants.simple_shade = (base_colormap->Color.d == 0x00ffffff && base_colormap->Fade.d == 0x00000000 && base_colormap->Desaturate == 0);
|
||||
dc_colormap = base_colormap->Maps;
|
||||
dc_light = LIGHTSCALE(light, shade);
|
||||
}
|
||||
else
|
||||
{
|
||||
dc_colormap = base_colormap->Maps + (GETPALOOKUP(light, shade) << COLORMAPSHIFT);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawerStyle::SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
ds_shade_constants.light_red = base_colormap->Color.r * 256 / 255;
|
||||
ds_shade_constants.light_green = base_colormap->Color.g * 256 / 255;
|
||||
ds_shade_constants.light_blue = base_colormap->Color.b * 256 / 255;
|
||||
ds_shade_constants.light_alpha = base_colormap->Color.a * 256 / 255;
|
||||
ds_shade_constants.fade_red = base_colormap->Fade.r;
|
||||
ds_shade_constants.fade_green = base_colormap->Fade.g;
|
||||
ds_shade_constants.fade_blue = base_colormap->Fade.b;
|
||||
ds_shade_constants.fade_alpha = base_colormap->Fade.a;
|
||||
ds_shade_constants.desaturate = MIN(abs(base_colormap->Desaturate), 255) * 255 / 256;
|
||||
ds_shade_constants.simple_shade = (base_colormap->Color.d == 0x00ffffff && base_colormap->Fade.d == 0x00000000 && base_colormap->Desaturate == 0);
|
||||
ds_colormap = base_colormap->Maps;
|
||||
ds_light = LIGHTSCALE(light, shade);
|
||||
}
|
||||
else
|
||||
{
|
||||
ds_colormap = base_colormap->Maps + (GETPALOOKUP(light, shade) << COLORMAPSHIFT);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawerStyle::SetTranslationMap(lighttable_t *translation)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
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_colormap = translation;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawerStyle::SetSpanTexture(FTexture *tex)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
tex->GetWidth();
|
||||
ds_xbits = tex->WidthBits;
|
||||
ds_ybits = tex->HeightBits;
|
||||
if ((1 << ds_xbits) > tex->GetWidth())
|
||||
{
|
||||
ds_xbits--;
|
||||
}
|
||||
if ((1 << ds_ybits) > tex->GetHeight())
|
||||
{
|
||||
ds_ybits--;
|
||||
}
|
||||
|
||||
ds_source = r_swtruecolor ? (const uint8_t*)tex->GetPixelsBgra() : tex->GetPixels();
|
||||
ds_source_mipmapped = tex->Mipmapped() && tex->GetWidth() > 1 && tex->GetHeight() > 1;
|
||||
}
|
||||
|
||||
void DrawerStyle::SetSpanColormap(FDynamicColormap *colormap, int shade)
|
||||
{
|
||||
SetDSColorMapLight(colormap, 0, shade);
|
||||
}
|
||||
|
||||
void R_UpdateFuzzPos()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
dc_yl = MAX(dc_yl, 1);
|
||||
dc_yh = MIN(dc_yh, fuzzviewheight);
|
||||
if (dc_yl <= dc_yh)
|
||||
fuzzpos = (fuzzpos + dc_yh - dc_yl + 1) % FUZZTABLE;
|
||||
}
|
||||
|
||||
void DrawerStyle::DrawMaskedColumn(int x, fixed_t iscale, FTexture *tex, fixed_t col, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
// Handle the linear filtered version in a different function to reduce chances of merge conflicts from zdoom.
|
||||
if (r_swtruecolor && !drawer_needs_pal_input) // To do: add support to R_DrawColumnHoriz_rgba
|
||||
{
|
||||
DrawMaskedColumnBgra(x, iscale, tex, col, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, unmasked);
|
||||
return;
|
||||
}
|
||||
|
||||
dc_x = x;
|
||||
dc_iscale = iscale;
|
||||
dc_textureheight = tex->GetHeight();
|
||||
|
||||
const FTexture::Span *span;
|
||||
const BYTE *column;
|
||||
if (r_swtruecolor && !drawer_needs_pal_input)
|
||||
column = (const BYTE *)tex->GetColumnBgra(col >> FRACBITS, &span);
|
||||
else
|
||||
column = tex->GetColumn(col >> FRACBITS, &span);
|
||||
|
||||
FTexture::Span unmaskedSpan[2];
|
||||
if (unmasked)
|
||||
{
|
||||
span = unmaskedSpan;
|
||||
unmaskedSpan[0].TopOffset = 0;
|
||||
unmaskedSpan[0].Length = tex->GetHeight();
|
||||
unmaskedSpan[1].TopOffset = 0;
|
||||
unmaskedSpan[1].Length = 0;
|
||||
}
|
||||
|
||||
int pixelsize = r_swtruecolor ? 4 : 1;
|
||||
|
||||
while (span->Length != 0)
|
||||
{
|
||||
const int length = span->Length;
|
||||
const int top = span->TopOffset;
|
||||
|
||||
// calculate unclipped screen coordinates for post
|
||||
dc_yl = (int)(sprtopscreen + spryscale * top + 0.5);
|
||||
dc_yh = (int)(sprtopscreen + spryscale * (top + length) + 0.5) - 1;
|
||||
|
||||
if (sprflipvert)
|
||||
{
|
||||
swapvalues(dc_yl, dc_yh);
|
||||
}
|
||||
|
||||
if (dc_yh >= mfloorclip[dc_x])
|
||||
{
|
||||
dc_yh = mfloorclip[dc_x] - 1;
|
||||
}
|
||||
if (dc_yl < mceilingclip[dc_x])
|
||||
{
|
||||
dc_yl = mceilingclip[dc_x];
|
||||
}
|
||||
|
||||
if (dc_yl <= dc_yh)
|
||||
{
|
||||
dc_texturefrac = FLOAT2FIXED((dc_yl + 0.5 - sprtopscreen) / spryscale);
|
||||
dc_source = column;
|
||||
dc_source2 = nullptr;
|
||||
dc_dest = (ylookup[dc_yl] + dc_x) * pixelsize + dc_destorg;
|
||||
dc_count = dc_yh - dc_yl + 1;
|
||||
|
||||
fixed_t maxfrac = ((top + length) << FRACBITS) - 1;
|
||||
dc_texturefrac = MAX(dc_texturefrac, 0);
|
||||
dc_texturefrac = MIN(dc_texturefrac, maxfrac);
|
||||
if (dc_iscale > 0)
|
||||
dc_count = MIN(dc_count, (maxfrac - dc_texturefrac + dc_iscale - 1) / dc_iscale);
|
||||
else if (dc_iscale < 0)
|
||||
dc_count = MIN(dc_count, (dc_texturefrac - dc_iscale) / (-dc_iscale));
|
||||
|
||||
(Drawers()->*colfunc)();
|
||||
}
|
||||
span++;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawerStyle::DrawMaskedColumnBgra(int x, fixed_t iscale, FTexture *tex, fixed_t col, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
dc_x = x;
|
||||
dc_iscale = iscale;
|
||||
|
||||
// Normalize to 0-1 range:
|
||||
double uv_stepd = FIXED2DBL(dc_iscale);
|
||||
double v_step = uv_stepd / tex->GetHeight();
|
||||
|
||||
// Convert to uint32:
|
||||
dc_iscale = (uint32_t)(v_step * (1 << 30));
|
||||
|
||||
// Texture mipmap and filter selection:
|
||||
fixed_t xoffset = col;
|
||||
|
||||
double xmagnitude = 1.0; // To do: pass this into R_DrawMaskedColumn
|
||||
double ymagnitude = fabs(uv_stepd);
|
||||
double magnitude = MAX(ymagnitude, xmagnitude);
|
||||
double min_lod = -1000.0;
|
||||
double lod = MAX(log2(magnitude) + r_lod_bias, min_lod);
|
||||
bool magnifying = lod < 0.0f;
|
||||
|
||||
int mipmap_offset = 0;
|
||||
int mip_width = tex->GetWidth();
|
||||
int mip_height = tex->GetHeight();
|
||||
uint32_t xpos = (uint32_t)((((uint64_t)xoffset) << FRACBITS) / mip_width);
|
||||
if (r_mipmap && tex->Mipmapped() && mip_width > 1 && mip_height > 1)
|
||||
{
|
||||
int level = (int)lod;
|
||||
while (level > 0 && mip_width > 1 && mip_height > 1)
|
||||
{
|
||||
mipmap_offset += mip_width * mip_height;
|
||||
level--;
|
||||
mip_width = MAX(mip_width >> 1, 1);
|
||||
mip_height = MAX(mip_height >> 1, 1);
|
||||
}
|
||||
}
|
||||
xoffset = (xpos >> FRACBITS) * mip_width;
|
||||
|
||||
const uint32_t *pixels = tex->GetPixelsBgra() + mipmap_offset;
|
||||
|
||||
bool filter_nearest = (magnifying && !r_magfilter) || (!magnifying && !r_minfilter);
|
||||
if (filter_nearest)
|
||||
{
|
||||
xoffset = MAX(MIN(xoffset, (mip_width << FRACBITS) - 1), 0);
|
||||
|
||||
int tx = xoffset >> FRACBITS;
|
||||
dc_source = (BYTE*)(pixels + tx * mip_height);
|
||||
dc_source2 = nullptr;
|
||||
dc_textureheight = mip_height;
|
||||
dc_texturefracx = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
xoffset = MAX(MIN(xoffset - (FRACUNIT / 2), (mip_width << FRACBITS) - 1), 0);
|
||||
|
||||
int tx0 = xoffset >> FRACBITS;
|
||||
int tx1 = MIN(tx0 + 1, mip_width - 1);
|
||||
dc_source = (BYTE*)(pixels + tx0 * mip_height);
|
||||
dc_source2 = (BYTE*)(pixels + tx1 * mip_height);
|
||||
dc_textureheight = mip_height;
|
||||
dc_texturefracx = (xoffset >> (FRACBITS - 4)) & 15;
|
||||
}
|
||||
|
||||
// Grab the posts we need to draw
|
||||
const FTexture::Span *span;
|
||||
tex->GetColumnBgra(col >> FRACBITS, &span);
|
||||
FTexture::Span unmaskedSpan[2];
|
||||
if (unmasked)
|
||||
{
|
||||
span = unmaskedSpan;
|
||||
unmaskedSpan[0].TopOffset = 0;
|
||||
unmaskedSpan[0].Length = tex->GetHeight();
|
||||
unmaskedSpan[1].TopOffset = 0;
|
||||
unmaskedSpan[1].Length = 0;
|
||||
}
|
||||
|
||||
// Draw each span post
|
||||
while (span->Length != 0)
|
||||
{
|
||||
const int length = span->Length;
|
||||
const int top = span->TopOffset;
|
||||
|
||||
// calculate unclipped screen coordinates for post
|
||||
dc_yl = (int)(sprtopscreen + spryscale * top + 0.5);
|
||||
dc_yh = (int)(sprtopscreen + spryscale * (top + length) + 0.5) - 1;
|
||||
|
||||
if (sprflipvert)
|
||||
{
|
||||
swapvalues(dc_yl, dc_yh);
|
||||
}
|
||||
|
||||
if (dc_yh >= mfloorclip[dc_x])
|
||||
{
|
||||
dc_yh = mfloorclip[dc_x] - 1;
|
||||
}
|
||||
if (dc_yl < mceilingclip[dc_x])
|
||||
{
|
||||
dc_yl = mceilingclip[dc_x];
|
||||
}
|
||||
|
||||
if (dc_yl <= dc_yh)
|
||||
{
|
||||
dc_dest = (ylookup[dc_yl] + dc_x) * 4 + dc_destorg;
|
||||
dc_count = dc_yh - dc_yl + 1;
|
||||
|
||||
double v = ((dc_yl + 0.5 - sprtopscreen) / spryscale) / tex->GetHeight();
|
||||
dc_texturefrac = (uint32_t)(v * (1 << 30));
|
||||
|
||||
(Drawers()->*colfunc)();
|
||||
}
|
||||
span++;
|
||||
}
|
||||
}
|
||||
|
||||
bool DrawerStyle::SetBlendFunc(int op, fixed_t fglevel, fixed_t bglevel, int flags)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
// r_drawtrans is a seriously bad thing to turn off. I wonder if I should
|
||||
// just remove it completely.
|
||||
if (!r_drawtrans || (op == STYLEOP_Add && fglevel == FRACUNIT && bglevel == 0 && !(flags & STYLEF_InvertSource)))
|
||||
{
|
||||
if (flags & STYLEF_ColorIsFixed)
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::FillColumn;
|
||||
}
|
||||
else if (dc_translation == NULL)
|
||||
{
|
||||
colfunc = basecolfunc;
|
||||
}
|
||||
else
|
||||
{
|
||||
colfunc = transcolfunc;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (flags & STYLEF_InvertSource)
|
||||
{
|
||||
dc_srcblend = Col2RGB8_Inverse[fglevel >> 10];
|
||||
dc_destblend = Col2RGB8_LessPrecision[bglevel >> 10];
|
||||
dc_srcalpha = fglevel;
|
||||
dc_destalpha = bglevel;
|
||||
}
|
||||
else if (op == STYLEOP_Add && fglevel + bglevel <= FRACUNIT)
|
||||
{
|
||||
dc_srcblend = Col2RGB8[fglevel >> 10];
|
||||
dc_destblend = Col2RGB8[bglevel >> 10];
|
||||
dc_srcalpha = fglevel;
|
||||
dc_destalpha = bglevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc_srcblend = Col2RGB8_LessPrecision[fglevel >> 10];
|
||||
dc_destblend = Col2RGB8_LessPrecision[bglevel >> 10];
|
||||
dc_srcalpha = fglevel;
|
||||
dc_destalpha = bglevel;
|
||||
}
|
||||
switch (op)
|
||||
{
|
||||
case STYLEOP_Add:
|
||||
if (fglevel == 0 && bglevel == FRACUNIT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (fglevel + bglevel <= FRACUNIT)
|
||||
{ // Colors won't overflow when added
|
||||
if (flags & STYLEF_ColorIsFixed)
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::FillAddColumn;
|
||||
}
|
||||
else if (dc_translation == NULL)
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::DrawAddColumn;
|
||||
}
|
||||
else
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::DrawTranslatedAddColumn;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Colors might overflow when added
|
||||
if (flags & STYLEF_ColorIsFixed)
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::FillAddClampColumn;
|
||||
}
|
||||
else if (dc_translation == NULL)
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::DrawAddClampColumn;
|
||||
}
|
||||
else
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::DrawAddClampTranslatedColumn;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
case STYLEOP_Sub:
|
||||
if (flags & STYLEF_ColorIsFixed)
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::FillSubClampColumn;
|
||||
}
|
||||
else if (dc_translation == NULL)
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::DrawSubClampColumn;
|
||||
}
|
||||
else
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::DrawSubClampTranslatedColumn;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
return true;
|
||||
|
||||
case STYLEOP_RevSub:
|
||||
if (fglevel == 0 && bglevel == FRACUNIT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (flags & STYLEF_ColorIsFixed)
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::FillRevSubClampColumn;
|
||||
}
|
||||
else if (dc_translation == NULL)
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::DrawRevSubClampColumn;
|
||||
}
|
||||
else
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::DrawRevSubClampTranslatedColumn;
|
||||
drawer_needs_pal_input = true;
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
fixed_t DrawerStyle::GetAlpha(int type, fixed_t alpha)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STYLEALPHA_Zero: return 0;
|
||||
case STYLEALPHA_One: return OPAQUE;
|
||||
case STYLEALPHA_Src: return alpha;
|
||||
case STYLEALPHA_InvSrc: return OPAQUE - alpha;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool DrawerStyle::SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
fixed_t fglevel, bglevel;
|
||||
|
||||
drawer_needs_pal_input = false;
|
||||
|
||||
style.CheckFuzz();
|
||||
|
||||
if (style.BlendOp == STYLEOP_Shadow)
|
||||
{
|
||||
style = LegacyRenderStyles[STYLE_TranslucentStencil];
|
||||
alpha = TRANSLUC33;
|
||||
color = 0;
|
||||
}
|
||||
|
||||
if (style.Flags & STYLEF_ForceAlpha)
|
||||
{
|
||||
alpha = clamp<fixed_t>(alpha, 0, OPAQUE);
|
||||
}
|
||||
else if (style.Flags & STYLEF_TransSoulsAlpha)
|
||||
{
|
||||
alpha = fixed_t(transsouls * OPAQUE);
|
||||
}
|
||||
else if (style.Flags & STYLEF_Alpha1)
|
||||
{
|
||||
alpha = FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha = clamp<fixed_t>(alpha, 0, OPAQUE);
|
||||
}
|
||||
|
||||
if (translation != -1)
|
||||
{
|
||||
dc_translation = NULL;
|
||||
if (translation != 0)
|
||||
{
|
||||
FRemapTable *table = TranslationToTable(translation);
|
||||
if (table != NULL && !table->Inactive)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
dc_translation = (uint8_t*)table->Palette;
|
||||
else
|
||||
dc_translation = table->Remap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for special modes
|
||||
if (style.BlendOp == STYLEOP_Fuzz)
|
||||
{
|
||||
colfunc = fuzzcolfunc;
|
||||
return true;
|
||||
}
|
||||
else if (style == LegacyRenderStyles[STYLE_Shaded])
|
||||
{
|
||||
// Shaded drawer only gets 16 levels of alpha because it saves memory.
|
||||
if ((alpha >>= 12) == 0 || basecolormap == nullptr)
|
||||
return false;
|
||||
colfunc = &SWPixelFormatDrawers::DrawShadedColumn;
|
||||
drawer_needs_pal_input = true;
|
||||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
dc_color = cameraLight->fixedcolormap ? cameraLight->fixedcolormap->Maps[APART(color)] : basecolormap->Maps[APART(color)];
|
||||
basecolormap = &ShadeFakeColormap[16 - alpha];
|
||||
if (cameraLight->fixedlightlev >= 0 && cameraLight->fixedcolormap == NULL)
|
||||
{
|
||||
fixed_t shade = shadedlightshade;
|
||||
if (shade == 0) FIXEDLIGHT2SHADE(cameraLight->fixedlightlev);
|
||||
SetColorMapLight(basecolormap, 0, shade);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetColorMapLight(basecolormap, 0, shadedlightshade);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
fglevel = GetAlpha(style.SrcAlpha, alpha);
|
||||
bglevel = GetAlpha(style.DestAlpha, alpha);
|
||||
|
||||
if (style.Flags & STYLEF_ColorIsFixed)
|
||||
{
|
||||
uint32_t x = fglevel >> 10;
|
||||
uint32_t r = RPART(color);
|
||||
uint32_t g = GPART(color);
|
||||
uint32_t b = BPART(color);
|
||||
// dc_color is used by the rt_* routines. It is indexed into dc_srcblend.
|
||||
dc_color = RGB256k.RGB[r >> 2][g >> 2][b >> 2];
|
||||
if (style.Flags & STYLEF_InvertSource)
|
||||
{
|
||||
r = 255 - r;
|
||||
g = 255 - g;
|
||||
b = 255 - b;
|
||||
}
|
||||
uint32_t alpha = clamp(fglevel >> (FRACBITS - 8), 0, 255);
|
||||
dc_srccolor_bgra = (alpha << 24) | (r << 16) | (g << 8) | b;
|
||||
// dc_srccolor is used by the R_Fill* routines. It is premultiplied
|
||||
// with the alpha.
|
||||
dc_srccolor = ((((r*x) >> 4) << 20) | ((g*x) >> 4) | ((((b)*x) >> 4) << 10)) & 0x3feffbff;
|
||||
SetColorMapLight(&identitycolormap, 0, 0);
|
||||
}
|
||||
|
||||
if (!DrawerStyle::SetBlendFunc(style.BlendOp, fglevel, bglevel, style.Flags))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DrawerStyle::SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade)
|
||||
{
|
||||
return SetPatchStyle(style, FLOAT2FIXED(alpha), translation, color, basecolormap, shadedlightshade);
|
||||
}
|
||||
|
||||
DrawerFunc DrawerStyle::GetTransMaskDrawer()
|
||||
{
|
||||
if (colfunc == &SWPixelFormatDrawers::DrawAddColumn)
|
||||
{
|
||||
return &SWPixelFormatDrawers::DrawWallAddColumn;
|
||||
}
|
||||
if (colfunc == &SWPixelFormatDrawers::DrawAddClampColumn)
|
||||
{
|
||||
return &SWPixelFormatDrawers::DrawWallAddClampColumn;
|
||||
}
|
||||
if (colfunc == &SWPixelFormatDrawers::DrawSubClampColumn)
|
||||
{
|
||||
return &SWPixelFormatDrawers::DrawWallSubClampColumn;
|
||||
}
|
||||
if (colfunc == &SWPixelFormatDrawers::DrawRevSubClampColumn)
|
||||
{
|
||||
return &SWPixelFormatDrawers::DrawWallRevSubClampColumn;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DrawerStyle::SetSpanStyle(bool masked, bool additive, fixed_t alpha)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (masked)
|
||||
{
|
||||
if (alpha < OPAQUE || additive)
|
||||
{
|
||||
if (!additive)
|
||||
{
|
||||
spanfunc = &SWPixelFormatDrawers::DrawSpanMaskedTranslucent;
|
||||
dc_srcblend = Col2RGB8[alpha >> 10];
|
||||
dc_destblend = Col2RGB8[(OPAQUE - alpha) >> 10];
|
||||
dc_srcalpha = alpha;
|
||||
dc_destalpha = OPAQUE - alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
spanfunc = &SWPixelFormatDrawers::DrawSpanMaskedAddClamp;
|
||||
dc_srcblend = Col2RGB8_LessPrecision[alpha >> 10];
|
||||
dc_destblend = Col2RGB8_LessPrecision[FRACUNIT >> 10];
|
||||
dc_srcalpha = alpha;
|
||||
dc_destalpha = FRACUNIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spanfunc = &SWPixelFormatDrawers::DrawSpanMasked;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (alpha < OPAQUE || additive)
|
||||
{
|
||||
if (!additive)
|
||||
{
|
||||
spanfunc = &SWPixelFormatDrawers::DrawSpanTranslucent;
|
||||
dc_srcblend = Col2RGB8[alpha >> 10];
|
||||
dc_destblend = Col2RGB8[(OPAQUE - alpha) >> 10];
|
||||
dc_srcalpha = alpha;
|
||||
dc_destalpha = OPAQUE - alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
spanfunc = &SWPixelFormatDrawers::DrawSpanAddClamp;
|
||||
dc_srcblend = Col2RGB8_LessPrecision[alpha >> 10];
|
||||
dc_destblend = Col2RGB8_LessPrecision[FRACUNIT >> 10];
|
||||
dc_srcalpha = alpha;
|
||||
dc_destalpha = FRACUNIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spanfunc = &SWPixelFormatDrawers::DrawSpan;
|
||||
}
|
||||
}
|
||||
int yl = MAX(args.dc_yl, 1);
|
||||
int yh = MIN(args.dc_yh, fuzzviewheight);
|
||||
if (yl <= yh)
|
||||
fuzzpos = (fuzzpos + yh - yl + 1) % FUZZTABLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,81 +19,7 @@ EXTERN_CVAR(Bool, r_dynlights);
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
namespace drawerargs
|
||||
{
|
||||
extern int dc_pitch;
|
||||
extern lighttable_t *dc_colormap;
|
||||
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 FVector3 dc_normal;
|
||||
extern FVector3 dc_viewpos;
|
||||
extern FVector3 dc_viewpos_step;
|
||||
extern TriLight *dc_lights;
|
||||
extern int dc_num_lights;
|
||||
|
||||
extern uint32_t dc_wall_texturefrac[4];
|
||||
extern uint32_t dc_wall_iscale[4];
|
||||
extern uint8_t *dc_wall_colormap[4];
|
||||
extern fixed_t dc_wall_light[4];
|
||||
extern const uint8_t *dc_wall_source[4];
|
||||
extern const uint8_t *dc_wall_source2[4];
|
||||
extern uint32_t dc_wall_texturefracx[4];
|
||||
extern uint32_t dc_wall_sourceheight[4];
|
||||
extern int dc_wall_fracbits;
|
||||
|
||||
extern int ds_y;
|
||||
extern int ds_x1;
|
||||
extern int ds_x2;
|
||||
extern lighttable_t * ds_colormap;
|
||||
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;
|
||||
}
|
||||
class DrawerArgs;
|
||||
|
||||
extern int ylookup[MAXHEIGHT];
|
||||
extern uint8_t shadetables[/*NUMCOLORMAPS*16*256*/];
|
||||
|
@ -120,124 +46,46 @@ namespace swrenderer
|
|||
{
|
||||
public:
|
||||
virtual ~SWPixelFormatDrawers() { }
|
||||
virtual void DrawWallColumn() = 0;
|
||||
virtual void DrawWallMaskedColumn() = 0;
|
||||
virtual void DrawWallAddColumn() = 0;
|
||||
virtual void DrawWallAddClampColumn() = 0;
|
||||
virtual void DrawWallSubClampColumn() = 0;
|
||||
virtual void DrawWallRevSubClampColumn() = 0;
|
||||
virtual void DrawSingleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) = 0;
|
||||
virtual void DrawDoubleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) = 0;
|
||||
virtual void DrawColumn() = 0;
|
||||
virtual void FillColumn() = 0;
|
||||
virtual void FillAddColumn() = 0;
|
||||
virtual void FillAddClampColumn() = 0;
|
||||
virtual void FillSubClampColumn() = 0;
|
||||
virtual void FillRevSubClampColumn() = 0;
|
||||
virtual void DrawFuzzColumn() = 0;
|
||||
virtual void DrawAddColumn() = 0;
|
||||
virtual void DrawTranslatedColumn() = 0;
|
||||
virtual void DrawTranslatedAddColumn() = 0;
|
||||
virtual void DrawShadedColumn() = 0;
|
||||
virtual void DrawAddClampColumn() = 0;
|
||||
virtual void DrawAddClampTranslatedColumn() = 0;
|
||||
virtual void DrawSubClampColumn() = 0;
|
||||
virtual void DrawSubClampTranslatedColumn() = 0;
|
||||
virtual void DrawRevSubClampColumn() = 0;
|
||||
virtual void DrawRevSubClampTranslatedColumn() = 0;
|
||||
virtual void DrawSpan() = 0;
|
||||
virtual void DrawSpanMasked() = 0;
|
||||
virtual void DrawSpanTranslucent() = 0;
|
||||
virtual void DrawSpanMaskedTranslucent() = 0;
|
||||
virtual void DrawSpanAddClamp() = 0;
|
||||
virtual void DrawSpanMaskedAddClamp() = 0;
|
||||
virtual void FillSpan() = 0;
|
||||
virtual void 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, FDynamicColormap *basecolormap) = 0;
|
||||
virtual void DrawColoredSpan(int y, int x1, int x2) = 0;
|
||||
virtual void DrawFogBoundaryLine(int y, int x1, int x2) = 0;
|
||||
virtual void DrawWallColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawWallMaskedColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawWallAddColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawWallAddClampColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawWallSubClampColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawWallRevSubClampColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawSingleSkyColumn(const DrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) = 0;
|
||||
virtual void DrawDoubleSkyColumn(const DrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) = 0;
|
||||
virtual void DrawColumn(const DrawerArgs &args) = 0;
|
||||
virtual void FillColumn(const DrawerArgs &args) = 0;
|
||||
virtual void FillAddColumn(const DrawerArgs &args) = 0;
|
||||
virtual void FillAddClampColumn(const DrawerArgs &args) = 0;
|
||||
virtual void FillSubClampColumn(const DrawerArgs &args) = 0;
|
||||
virtual void FillRevSubClampColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawFuzzColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawAddColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawTranslatedColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawTranslatedAddColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawShadedColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawAddClampColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawAddClampTranslatedColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawSubClampColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawSubClampTranslatedColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawRevSubClampColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawRevSubClampTranslatedColumn(const DrawerArgs &args) = 0;
|
||||
virtual void DrawSpan(const DrawerArgs &args) = 0;
|
||||
virtual void DrawSpanMasked(const DrawerArgs &args) = 0;
|
||||
virtual void DrawSpanTranslucent(const DrawerArgs &args) = 0;
|
||||
virtual void DrawSpanMaskedTranslucent(const DrawerArgs &args) = 0;
|
||||
virtual void DrawSpanAddClamp(const DrawerArgs &args) = 0;
|
||||
virtual void DrawSpanMaskedAddClamp(const DrawerArgs &args) = 0;
|
||||
virtual void FillSpan(const DrawerArgs &args) = 0;
|
||||
virtual void DrawTiltedSpan(const DrawerArgs &args, 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, FDynamicColormap *basecolormap) = 0;
|
||||
virtual void DrawColoredSpan(const DrawerArgs &args, int y, int x1, int x2) = 0;
|
||||
virtual void DrawFogBoundaryLine(const DrawerArgs &args, int y, int x1, int x2) = 0;
|
||||
};
|
||||
|
||||
typedef void(SWPixelFormatDrawers::*DrawerFunc)();
|
||||
|
||||
void R_InitColumnDrawers();
|
||||
void R_InitShadeMaps();
|
||||
void R_InitFuzzTable(int fuzzoff);
|
||||
void R_InitParticleTexture();
|
||||
|
||||
void R_UpdateFuzzPos();
|
||||
|
||||
class DrawerStyle
|
||||
{
|
||||
public:
|
||||
DrawerStyle()
|
||||
{
|
||||
colfunc = &SWPixelFormatDrawers::DrawColumn;
|
||||
basecolfunc = &SWPixelFormatDrawers::DrawColumn;
|
||||
fuzzcolfunc = &SWPixelFormatDrawers::DrawFuzzColumn;
|
||||
transcolfunc = &SWPixelFormatDrawers::DrawTranslatedColumn;
|
||||
spanfunc = &SWPixelFormatDrawers::DrawSpan;
|
||||
}
|
||||
|
||||
bool SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
|
||||
bool SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
|
||||
void SetSpanStyle(bool masked, bool additive, fixed_t alpha);
|
||||
|
||||
void DrawMaskedColumn(int x, fixed_t iscale, FTexture *texture, fixed_t column, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked = false);
|
||||
|
||||
// Sets dc_colormap and dc_light to their appropriate values depending on the output format (pal vs true color)
|
||||
void SetColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
||||
void SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
||||
void SetTranslationMap(lighttable_t *translation);
|
||||
|
||||
void SetSpanTexture(FTexture *tex);
|
||||
void SetSpanColormap(FDynamicColormap *colormap, int shade);
|
||||
|
||||
DrawerFunc GetTransMaskDrawer();
|
||||
|
||||
DrawerFunc colfunc;
|
||||
DrawerFunc basecolfunc;
|
||||
DrawerFunc fuzzcolfunc;
|
||||
DrawerFunc transcolfunc;
|
||||
DrawerFunc spanfunc;
|
||||
|
||||
void 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, FDynamicColormap *basecolormap)
|
||||
{
|
||||
Drawers()->DrawTiltedSpan(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
||||
}
|
||||
|
||||
void DrawFogBoundaryLine(int y, int x1, int x2)
|
||||
{
|
||||
Drawers()->DrawFogBoundaryLine(y, x1, x2);
|
||||
}
|
||||
|
||||
void DrawColoredSpan(int y, int x1, int x2)
|
||||
{
|
||||
Drawers()->DrawColoredSpan(y, x1, x2);
|
||||
}
|
||||
|
||||
void DrawSingleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky)
|
||||
{
|
||||
Drawers()->DrawSingleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||
}
|
||||
|
||||
void DrawDoubleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky)
|
||||
{
|
||||
Drawers()->DrawDoubleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||
}
|
||||
|
||||
void FillColumn()
|
||||
{
|
||||
Drawers()->FillColumn();
|
||||
}
|
||||
|
||||
SWPixelFormatDrawers *Drawers() const;
|
||||
|
||||
private:
|
||||
void DrawMaskedColumnBgra(int x, fixed_t iscale, FTexture *tex, fixed_t column, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked);
|
||||
|
||||
bool SetBlendFunc(int op, fixed_t fglevel, fixed_t bglevel, int flags);
|
||||
static fixed_t GetAlpha(int type, fixed_t alpha);
|
||||
|
||||
bool drawer_needs_pal_input = false;
|
||||
};
|
||||
void R_UpdateFuzzPos(const DrawerArgs &args);
|
||||
}
|
||||
|
|
|
@ -96,24 +96,23 @@ CVAR(Bool, r_blendmethod, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
PalWall1Command::PalWall1Command()
|
||||
PalWall1Command::PalWall1Command(const DrawerArgs &args)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_iscale = dc_iscale;
|
||||
_texturefrac = dc_texturefrac;
|
||||
_colormap = dc_colormap;
|
||||
_count = dc_count;
|
||||
_source = dc_source;
|
||||
_dest = dc_dest;
|
||||
_fracbits = dc_wall_fracbits;
|
||||
_iscale = args.dc_iscale;
|
||||
_texturefrac = args.dc_texturefrac;
|
||||
_colormap = args.dc_colormap;
|
||||
_count = args.dc_count;
|
||||
_source = args.dc_source;
|
||||
_dest = args.Dest();
|
||||
_dest_y = args.DestY();
|
||||
_fracbits = args.dc_wall_fracbits;
|
||||
_pitch = dc_pitch;
|
||||
_srcblend = dc_srcblend;
|
||||
_destblend = dc_destblend;
|
||||
_dynlights = dc_lights;
|
||||
_num_dynlights = dc_num_lights;
|
||||
_viewpos_z = dc_viewpos.Z;
|
||||
_step_viewpos_z = dc_viewpos_step.Z;
|
||||
_srcblend = args.dc_srcblend;
|
||||
_destblend = args.dc_destblend;
|
||||
_dynlights = args.dc_lights;
|
||||
_num_dynlights = args.dc_num_lights;
|
||||
_viewpos_z = args.dc_viewpos.Z;
|
||||
_step_viewpos_z = args.dc_viewpos_step.Z;
|
||||
}
|
||||
|
||||
uint8_t PalWall1Command::AddLights(const TriLight *lights, int num_lights, float viewpos_z, uint8_t fg, uint8_t material)
|
||||
|
@ -560,20 +559,19 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PalSkyCommand::PalSkyCommand(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) : solid_top(solid_top), solid_bottom(solid_bottom), fadeSky(fadeSky)
|
||||
PalSkyCommand::PalSkyCommand(const DrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) : solid_top(solid_top), solid_bottom(solid_bottom), fadeSky(fadeSky)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_dest = dc_dest;
|
||||
_count = dc_count;
|
||||
_dest = args.Dest();
|
||||
_dest_y = args.DestY();
|
||||
_count = args.dc_count;
|
||||
_pitch = dc_pitch;
|
||||
for (int col = 0; col < 4; col++)
|
||||
{
|
||||
_source[col] = dc_wall_source[col];
|
||||
_source2[col] = dc_wall_source2[col];
|
||||
_sourceheight[col] = dc_wall_sourceheight[col];
|
||||
_iscale[col] = dc_wall_iscale[col];
|
||||
_texturefrac[col] = dc_wall_texturefrac[col];
|
||||
_source[col] = args.dc_wall_source[col];
|
||||
_source2[col] = args.dc_wall_source2[col];
|
||||
_sourceheight[col] = args.dc_wall_sourceheight[col];
|
||||
_iscale[col] = args.dc_wall_iscale[col];
|
||||
_texturefrac[col] = args.dc_wall_texturefrac[col];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -866,24 +864,23 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PalColumnCommand::PalColumnCommand()
|
||||
PalColumnCommand::PalColumnCommand(const DrawerArgs &args)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_count = dc_count;
|
||||
_dest = dc_dest;
|
||||
_count = args.dc_count;
|
||||
_dest = args.Dest();
|
||||
_dest_y = args.DestY();
|
||||
_pitch = dc_pitch;
|
||||
_iscale = dc_iscale;
|
||||
_texturefrac = dc_texturefrac;
|
||||
_colormap = dc_colormap;
|
||||
_source = dc_source;
|
||||
_translation = dc_translation;
|
||||
_color = dc_color;
|
||||
_srcblend = dc_srcblend;
|
||||
_destblend = dc_destblend;
|
||||
_srccolor = dc_srccolor;
|
||||
_srcalpha = dc_srcalpha;
|
||||
_destalpha = dc_destalpha;
|
||||
_iscale = args.dc_iscale;
|
||||
_texturefrac = args.dc_texturefrac;
|
||||
_colormap = args.dc_colormap;
|
||||
_source = args.dc_source;
|
||||
_translation = args.dc_translation;
|
||||
_color = args.dc_color;
|
||||
_srcblend = args.dc_srcblend;
|
||||
_destblend = args.dc_destblend;
|
||||
_srccolor = args.dc_srccolor;
|
||||
_srcalpha = args.dc_srcalpha;
|
||||
_destalpha = args.dc_destalpha;
|
||||
}
|
||||
|
||||
void DrawColumnPalCommand::Execute(DrawerThread *thread)
|
||||
|
@ -1764,13 +1761,11 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DrawFuzzColumnPalCommand::DrawFuzzColumnPalCommand()
|
||||
DrawFuzzColumnPalCommand::DrawFuzzColumnPalCommand(const DrawerArgs &args)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_yl = dc_yl;
|
||||
_yh = dc_yh;
|
||||
_x = dc_x;
|
||||
_yl = args.dc_yl;
|
||||
_yh = args.dc_yh;
|
||||
_x = args.dc_x;
|
||||
_destorg = dc_destorg;
|
||||
_pitch = dc_pitch;
|
||||
_fuzzpos = fuzzpos;
|
||||
|
@ -1853,31 +1848,29 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PalSpanCommand::PalSpanCommand()
|
||||
PalSpanCommand::PalSpanCommand(const DrawerArgs &args)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_source = ds_source;
|
||||
_colormap = ds_colormap;
|
||||
_xfrac = ds_xfrac;
|
||||
_yfrac = ds_yfrac;
|
||||
_y = ds_y;
|
||||
_x1 = ds_x1;
|
||||
_x2 = ds_x2;
|
||||
_source = args.ds_source;
|
||||
_colormap = args.ds_colormap;
|
||||
_xfrac = args.ds_xfrac;
|
||||
_yfrac = args.ds_yfrac;
|
||||
_y = args.ds_y;
|
||||
_x1 = args.ds_x1;
|
||||
_x2 = args.ds_x2;
|
||||
_destorg = dc_destorg;
|
||||
_xstep = ds_xstep;
|
||||
_ystep = ds_ystep;
|
||||
_xbits = ds_xbits;
|
||||
_ybits = ds_ybits;
|
||||
_srcblend = dc_srcblend;
|
||||
_destblend = dc_destblend;
|
||||
_color = ds_color;
|
||||
_srcalpha = dc_srcalpha;
|
||||
_destalpha = dc_destalpha;
|
||||
_dynlights = dc_lights;
|
||||
_num_dynlights = dc_num_lights;
|
||||
_viewpos_x = dc_viewpos.X;
|
||||
_step_viewpos_x = dc_viewpos_step.X;
|
||||
_xstep = args.ds_xstep;
|
||||
_ystep = args.ds_ystep;
|
||||
_xbits = args.ds_xbits;
|
||||
_ybits = args.ds_ybits;
|
||||
_srcblend = args.dc_srcblend;
|
||||
_destblend = args.dc_destblend;
|
||||
_color = args.ds_color;
|
||||
_srcalpha = args.dc_srcalpha;
|
||||
_destalpha = args.dc_destalpha;
|
||||
_dynlights = args.dc_lights;
|
||||
_num_dynlights = args.dc_num_lights;
|
||||
_viewpos_x = args.dc_viewpos.X;
|
||||
_step_viewpos_x = args.dc_viewpos_step.X;
|
||||
}
|
||||
|
||||
uint8_t PalSpanCommand::AddLights(const TriLight *lights, int num_lights, float viewpos_x, uint8_t fg, uint8_t material)
|
||||
|
@ -2630,16 +2623,14 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DrawTiltedSpanPalCommand::DrawTiltedSpanPalCommand(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, FDynamicColormap *basecolormap)
|
||||
DrawTiltedSpanPalCommand::DrawTiltedSpanPalCommand(const DrawerArgs &args, 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, FDynamicColormap *basecolormap)
|
||||
: y(y), x1(x1), x2(x2), plane_sz(plane_sz), plane_su(plane_su), plane_sv(plane_sv), plane_shade(plane_shade), planeshade(planeshade), planelightfloat(planelightfloat), pviewx(pviewx), pviewy(pviewy)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_colormap = ds_colormap;
|
||||
_colormap = args.ds_colormap;
|
||||
_destorg = dc_destorg;
|
||||
_ybits = ds_ybits;
|
||||
_xbits = ds_xbits;
|
||||
_source = ds_source;
|
||||
_ybits = args.ds_ybits;
|
||||
_xbits = args.ds_xbits;
|
||||
_source = args.ds_source;
|
||||
basecolormapdata = basecolormap->Maps;
|
||||
}
|
||||
|
||||
|
@ -2878,10 +2869,9 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DrawColoredSpanPalCommand::DrawColoredSpanPalCommand(int y, int x1, int x2) : y(y), x1(x1), x2(x2)
|
||||
DrawColoredSpanPalCommand::DrawColoredSpanPalCommand(const DrawerArgs &args, int y, int x1, int x2) : PalSpanCommand(args), y(y), x1(x1), x2(x2)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
color = ds_color;
|
||||
color = args.ds_color;
|
||||
destorg = dc_destorg;
|
||||
}
|
||||
|
||||
|
@ -2895,10 +2885,9 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DrawFogBoundaryLinePalCommand::DrawFogBoundaryLinePalCommand(int y, int x1, int x2) : y(y), x1(x1), x2(x2)
|
||||
DrawFogBoundaryLinePalCommand::DrawFogBoundaryLinePalCommand(const DrawerArgs &args, int y, int x1, int x2) : PalSpanCommand(args), y(y), x1(x1), x2(x2)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
_colormap = dc_colormap;
|
||||
_colormap = args.dc_colormap;
|
||||
_destorg = dc_destorg;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
#include "r_draw.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_thread.h"
|
||||
#include "r_drawerargs.h"
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
class PalWall1Command : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
PalWall1Command();
|
||||
PalWall1Command(const DrawerArgs &args);
|
||||
FString DebugInfo() override { return "PalWallCommand"; }
|
||||
|
||||
protected:
|
||||
|
@ -22,6 +23,7 @@ namespace swrenderer
|
|||
int _count;
|
||||
const uint8_t *_source;
|
||||
uint8_t *_dest;
|
||||
int _dest_y;
|
||||
int _fracbits;
|
||||
int _pitch;
|
||||
uint32_t *_srcblend;
|
||||
|
@ -32,17 +34,17 @@ namespace swrenderer
|
|||
float _step_viewpos_z;
|
||||
};
|
||||
|
||||
class DrawWall1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallMasked1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallAdd1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallAddClamp1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallSubClamp1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallRevSubClamp1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawWall1PalCommand : public PalWall1Command { public: using PalWall1Command::PalWall1Command; void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallMasked1PalCommand : public PalWall1Command { public: using PalWall1Command::PalWall1Command; void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallAdd1PalCommand : public PalWall1Command { public: using PalWall1Command::PalWall1Command; void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallAddClamp1PalCommand : public PalWall1Command { public: using PalWall1Command::PalWall1Command; void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallSubClamp1PalCommand : public PalWall1Command { public: using PalWall1Command::PalWall1Command; void Execute(DrawerThread *thread) override; };
|
||||
class DrawWallRevSubClamp1PalCommand : public PalWall1Command { public: using PalWall1Command::PalWall1Command; void Execute(DrawerThread *thread) override; };
|
||||
|
||||
class PalSkyCommand : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
PalSkyCommand(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky);
|
||||
PalSkyCommand(const DrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky);
|
||||
FString DebugInfo() override { return "PalSkyCommand"; }
|
||||
|
||||
protected:
|
||||
|
@ -51,6 +53,7 @@ namespace swrenderer
|
|||
bool fadeSky;
|
||||
|
||||
uint8_t *_dest;
|
||||
int _dest_y;
|
||||
int _count;
|
||||
int _pitch;
|
||||
const uint8_t *_source[4];
|
||||
|
@ -66,12 +69,13 @@ namespace swrenderer
|
|||
class PalColumnCommand : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
PalColumnCommand();
|
||||
PalColumnCommand(const DrawerArgs &args);
|
||||
FString DebugInfo() override { return "PalColumnCommand"; }
|
||||
|
||||
protected:
|
||||
int _count;
|
||||
uint8_t *_dest;
|
||||
int _dest_y;
|
||||
int _pitch;
|
||||
fixed_t _iscale;
|
||||
fixed_t _texturefrac;
|
||||
|
@ -86,27 +90,27 @@ namespace swrenderer
|
|||
fixed_t _destalpha;
|
||||
};
|
||||
|
||||
class DrawColumnPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnAddPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnAddClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnSubClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnRevSubClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnAddPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnTranslatedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnTlatedAddPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnShadedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnAddClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnAddClampTranslatedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnSubClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnSubClampTranslatedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnRevSubClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnRevSubClampTranslatedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnAddPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnAddClampPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnSubClampPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class FillColumnRevSubClampPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnAddPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnTranslatedPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnTlatedAddPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnShadedPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnAddClampPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnAddClampTranslatedPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnSubClampPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnSubClampTranslatedPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnRevSubClampPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawColumnRevSubClampTranslatedPalCommand : public PalColumnCommand { public: using PalColumnCommand::PalColumnCommand; void Execute(DrawerThread *thread) override; };
|
||||
|
||||
class DrawFuzzColumnPalCommand : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
DrawFuzzColumnPalCommand();
|
||||
DrawFuzzColumnPalCommand(const DrawerArgs &args);
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override { return "DrawFuzzColumnPalCommand"; }
|
||||
|
||||
|
@ -123,7 +127,7 @@ namespace swrenderer
|
|||
class PalSpanCommand : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
PalSpanCommand();
|
||||
PalSpanCommand(const DrawerArgs &args);
|
||||
FString DebugInfo() override { return "PalSpanCommand"; }
|
||||
|
||||
protected:
|
||||
|
@ -152,18 +156,18 @@ namespace swrenderer
|
|||
float _step_viewpos_x;
|
||||
};
|
||||
|
||||
class DrawSpanPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanMaskedPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanTranslucentPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanMaskedTranslucentPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanAddClampPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanMaskedAddClampPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class FillSpanPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanPalCommand : public PalSpanCommand { public: using PalSpanCommand::PalSpanCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanMaskedPalCommand : public PalSpanCommand { public: using PalSpanCommand::PalSpanCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanTranslucentPalCommand : public PalSpanCommand { public: using PalSpanCommand::PalSpanCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanMaskedTranslucentPalCommand : public PalSpanCommand { public: using PalSpanCommand::PalSpanCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanAddClampPalCommand : public PalSpanCommand { public: using PalSpanCommand::PalSpanCommand; void Execute(DrawerThread *thread) override; };
|
||||
class DrawSpanMaskedAddClampPalCommand : public PalSpanCommand { public: using PalSpanCommand::PalSpanCommand; void Execute(DrawerThread *thread) override; };
|
||||
class FillSpanPalCommand : public PalSpanCommand { public: using PalSpanCommand::PalSpanCommand; void Execute(DrawerThread *thread) override; };
|
||||
|
||||
class DrawTiltedSpanPalCommand : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
DrawTiltedSpanPalCommand(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, FDynamicColormap *basecolormap);
|
||||
DrawTiltedSpanPalCommand(const DrawerArgs &args, 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, FDynamicColormap *basecolormap);
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override { return "DrawTiltedSpanPalCommand"; }
|
||||
|
||||
|
@ -193,7 +197,7 @@ namespace swrenderer
|
|||
class DrawColoredSpanPalCommand : public PalSpanCommand
|
||||
{
|
||||
public:
|
||||
DrawColoredSpanPalCommand(int y, int x1, int x2);
|
||||
DrawColoredSpanPalCommand(const DrawerArgs &args, int y, int x1, int x2);
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override { return "DrawColoredSpanPalCommand"; }
|
||||
|
||||
|
@ -208,7 +212,7 @@ namespace swrenderer
|
|||
class DrawFogBoundaryLinePalCommand : public PalSpanCommand
|
||||
{
|
||||
public:
|
||||
DrawFogBoundaryLinePalCommand(int y, int x1, int x2);
|
||||
DrawFogBoundaryLinePalCommand(const DrawerArgs &args, int y, int x1, int x2);
|
||||
void Execute(DrawerThread *thread) override;
|
||||
|
||||
private:
|
||||
|
@ -226,6 +230,7 @@ namespace swrenderer
|
|||
|
||||
private:
|
||||
uint8_t *_dest;
|
||||
int _dest_y;
|
||||
int _pitch;
|
||||
int _count;
|
||||
uint32_t _fg;
|
||||
|
@ -236,53 +241,53 @@ namespace swrenderer
|
|||
class SWPalDrawers : public SWPixelFormatDrawers
|
||||
{
|
||||
public:
|
||||
void DrawWallColumn() override { DrawerCommandQueue::QueueCommand<DrawWall1PalCommand>(); }
|
||||
void DrawWallMaskedColumn() override { DrawerCommandQueue::QueueCommand<DrawWallMasked1PalCommand>(); }
|
||||
void DrawWallColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWall1PalCommand>(args); }
|
||||
void DrawWallMaskedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallMasked1PalCommand>(args); }
|
||||
|
||||
void DrawWallAddColumn() override
|
||||
void DrawWallAddColumn(const DrawerArgs &args) override
|
||||
{
|
||||
if (drawerargs::dc_num_lights == 0)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd1PalCommand>();
|
||||
if (args.dc_num_lights == 0)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd1PalCommand>(args);
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>();
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>(args);
|
||||
}
|
||||
|
||||
void DrawWallAddClampColumn() override { DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>(); }
|
||||
void DrawWallSubClampColumn() override { DrawerCommandQueue::QueueCommand<DrawWallSubClamp1PalCommand>(); }
|
||||
void DrawWallRevSubClampColumn() override { DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1PalCommand>(); }
|
||||
void DrawSingleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) override { DrawerCommandQueue::QueueCommand<DrawSingleSky1PalCommand>(solid_top, solid_bottom, fadeSky); }
|
||||
void DrawDoubleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) override { DrawerCommandQueue::QueueCommand<DrawDoubleSky1PalCommand>(solid_top, solid_bottom, fadeSky); }
|
||||
void DrawColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnPalCommand>(); }
|
||||
void FillColumn() override { DrawerCommandQueue::QueueCommand<FillColumnPalCommand>(); }
|
||||
void FillAddColumn() override { DrawerCommandQueue::QueueCommand<FillColumnAddPalCommand>(); }
|
||||
void FillAddClampColumn() override { DrawerCommandQueue::QueueCommand<FillColumnAddClampPalCommand>(); }
|
||||
void FillSubClampColumn() override { DrawerCommandQueue::QueueCommand<FillColumnSubClampPalCommand>(); }
|
||||
void FillRevSubClampColumn() override { DrawerCommandQueue::QueueCommand<FillColumnRevSubClampPalCommand>(); }
|
||||
void DrawFuzzColumn() override { DrawerCommandQueue::QueueCommand<DrawFuzzColumnPalCommand>(); R_UpdateFuzzPos(); }
|
||||
void DrawAddColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnAddPalCommand>(); }
|
||||
void DrawTranslatedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnTranslatedPalCommand>(); }
|
||||
void DrawTranslatedAddColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnTlatedAddPalCommand>(); }
|
||||
void DrawShadedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnShadedPalCommand>(); }
|
||||
void DrawAddClampColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnAddClampPalCommand>(); }
|
||||
void DrawAddClampTranslatedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnAddClampTranslatedPalCommand>(); }
|
||||
void DrawSubClampColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnSubClampPalCommand>(); }
|
||||
void DrawSubClampTranslatedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnSubClampTranslatedPalCommand>(); }
|
||||
void DrawRevSubClampColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampPalCommand>(); }
|
||||
void DrawRevSubClampTranslatedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampTranslatedPalCommand>(); }
|
||||
void DrawSpan() override { DrawerCommandQueue::QueueCommand<DrawSpanPalCommand>(); }
|
||||
void DrawSpanMasked() override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedPalCommand>(); }
|
||||
void DrawSpanTranslucent() override { DrawerCommandQueue::QueueCommand<DrawSpanTranslucentPalCommand>(); }
|
||||
void DrawSpanMaskedTranslucent() override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedTranslucentPalCommand>(); }
|
||||
void DrawSpanAddClamp() override { DrawerCommandQueue::QueueCommand<DrawSpanAddClampPalCommand>(); }
|
||||
void DrawSpanMaskedAddClamp() override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedAddClampPalCommand>(); }
|
||||
void FillSpan() override { DrawerCommandQueue::QueueCommand<FillSpanPalCommand>(); }
|
||||
void DrawWallAddClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>(args); }
|
||||
void DrawWallSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallSubClamp1PalCommand>(args); }
|
||||
void DrawWallRevSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1PalCommand>(args); }
|
||||
void DrawSingleSkyColumn(const DrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) override { DrawerCommandQueue::QueueCommand<DrawSingleSky1PalCommand>(args, solid_top, solid_bottom, fadeSky); }
|
||||
void DrawDoubleSkyColumn(const DrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) override { DrawerCommandQueue::QueueCommand<DrawDoubleSky1PalCommand>(args, solid_top, solid_bottom, fadeSky); }
|
||||
void DrawColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnPalCommand>(args); }
|
||||
void FillColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnPalCommand>(args); }
|
||||
void FillAddColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnAddPalCommand>(args); }
|
||||
void FillAddClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnAddClampPalCommand>(args); }
|
||||
void FillSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnSubClampPalCommand>(args); }
|
||||
void FillRevSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnRevSubClampPalCommand>(args); }
|
||||
void DrawFuzzColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawFuzzColumnPalCommand>(args); R_UpdateFuzzPos(args); }
|
||||
void DrawAddColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnAddPalCommand>(args); }
|
||||
void DrawTranslatedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnTranslatedPalCommand>(args); }
|
||||
void DrawTranslatedAddColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnTlatedAddPalCommand>(args); }
|
||||
void DrawShadedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnShadedPalCommand>(args); }
|
||||
void DrawAddClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnAddClampPalCommand>(args); }
|
||||
void DrawAddClampTranslatedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnAddClampTranslatedPalCommand>(args); }
|
||||
void DrawSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnSubClampPalCommand>(args); }
|
||||
void DrawSubClampTranslatedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnSubClampTranslatedPalCommand>(args); }
|
||||
void DrawRevSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampPalCommand>(args); }
|
||||
void DrawRevSubClampTranslatedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampTranslatedPalCommand>(args); }
|
||||
void DrawSpan(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanPalCommand>(args); }
|
||||
void DrawSpanMasked(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedPalCommand>(args); }
|
||||
void DrawSpanTranslucent(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanTranslucentPalCommand>(args); }
|
||||
void DrawSpanMaskedTranslucent(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedTranslucentPalCommand>(args); }
|
||||
void DrawSpanAddClamp(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanAddClampPalCommand>(args); }
|
||||
void DrawSpanMaskedAddClamp(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedAddClampPalCommand>(args); }
|
||||
void FillSpan(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillSpanPalCommand>(args); }
|
||||
|
||||
void 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, FDynamicColormap *basecolormap) override
|
||||
void DrawTiltedSpan(const DrawerArgs &args, 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, FDynamicColormap *basecolormap) override
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawTiltedSpanPalCommand>(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
||||
DrawerCommandQueue::QueueCommand<DrawTiltedSpanPalCommand>(args, y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
||||
}
|
||||
|
||||
void DrawColoredSpan(int y, int x1, int x2) override { DrawerCommandQueue::QueueCommand<DrawColoredSpanPalCommand>(y, x1, x2); }
|
||||
void DrawFogBoundaryLine(int y, int x1, int x2) override { DrawerCommandQueue::QueueCommand<DrawFogBoundaryLinePalCommand>(y, x1, x2); }
|
||||
void DrawColoredSpan(const DrawerArgs &args, int y, int x1, int x2) override { DrawerCommandQueue::QueueCommand<DrawColoredSpanPalCommand>(args, y, x1, x2); }
|
||||
void DrawFogBoundaryLine(const DrawerArgs &args, int y, int x1, int x2) override { DrawerCommandQueue::QueueCommand<DrawFogBoundaryLinePalCommand>(args, y, x1, x2); }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -60,44 +60,42 @@ CVAR(Float, r_lod_bias, -1.5, 0); // To do: add CVAR_ARCHIVE | CVAR_GLOBALCONFIG
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
DrawSpanLLVMCommand::DrawSpanLLVMCommand()
|
||||
DrawSpanLLVMCommand::DrawSpanLLVMCommand(const DrawerArgs &drawerargs)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
args.xfrac = ds_xfrac;
|
||||
args.yfrac = ds_yfrac;
|
||||
args.xstep = ds_xstep;
|
||||
args.ystep = ds_ystep;
|
||||
args.x1 = ds_x1;
|
||||
args.x2 = ds_x2;
|
||||
args.y = ds_y;
|
||||
args.xbits = ds_xbits;
|
||||
args.ybits = ds_ybits;
|
||||
args.xfrac = drawerargs.ds_xfrac;
|
||||
args.yfrac = drawerargs.ds_yfrac;
|
||||
args.xstep = drawerargs.ds_xstep;
|
||||
args.ystep = drawerargs.ds_ystep;
|
||||
args.x1 = drawerargs.ds_x1;
|
||||
args.x2 = drawerargs.ds_x2;
|
||||
args.y = drawerargs.ds_y;
|
||||
args.xbits = drawerargs.ds_xbits;
|
||||
args.ybits = drawerargs.ds_ybits;
|
||||
args.destorg = (uint32_t*)dc_destorg;
|
||||
args.destpitch = dc_pitch;
|
||||
args.source = (const uint32_t*)ds_source;
|
||||
args.light = LightBgra::calc_light_multiplier(ds_light);
|
||||
args.light_red = ds_shade_constants.light_red;
|
||||
args.light_green = ds_shade_constants.light_green;
|
||||
args.light_blue = ds_shade_constants.light_blue;
|
||||
args.light_alpha = ds_shade_constants.light_alpha;
|
||||
args.fade_red = ds_shade_constants.fade_red;
|
||||
args.fade_green = ds_shade_constants.fade_green;
|
||||
args.fade_blue = ds_shade_constants.fade_blue;
|
||||
args.fade_alpha = ds_shade_constants.fade_alpha;
|
||||
args.desaturate = ds_shade_constants.desaturate;
|
||||
args.srcalpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
args.destalpha = dc_destalpha >> (FRACBITS - 8);
|
||||
args.source = (const uint32_t*)drawerargs.ds_source;
|
||||
args.light = LightBgra::calc_light_multiplier(drawerargs.ds_light);
|
||||
args.light_red = drawerargs.ds_shade_constants.light_red;
|
||||
args.light_green = drawerargs.ds_shade_constants.light_green;
|
||||
args.light_blue = drawerargs.ds_shade_constants.light_blue;
|
||||
args.light_alpha = drawerargs.ds_shade_constants.light_alpha;
|
||||
args.fade_red = drawerargs.ds_shade_constants.fade_red;
|
||||
args.fade_green = drawerargs.ds_shade_constants.fade_green;
|
||||
args.fade_blue = drawerargs.ds_shade_constants.fade_blue;
|
||||
args.fade_alpha = drawerargs.ds_shade_constants.fade_alpha;
|
||||
args.desaturate = drawerargs.ds_shade_constants.desaturate;
|
||||
args.srcalpha = drawerargs.dc_srcalpha >> (FRACBITS - 8);
|
||||
args.destalpha = drawerargs.dc_destalpha >> (FRACBITS - 8);
|
||||
args.flags = 0;
|
||||
if (ds_shade_constants.simple_shade)
|
||||
if (drawerargs.ds_shade_constants.simple_shade)
|
||||
args.flags |= DrawSpanArgs::simple_shade;
|
||||
if (!sampler_setup(args.source, args.xbits, args.ybits, ds_source_mipmapped))
|
||||
if (!sampler_setup(drawerargs.ds_lod, args.source, args.xbits, args.ybits, drawerargs.ds_source_mipmapped))
|
||||
args.flags |= DrawSpanArgs::nearest_filter;
|
||||
|
||||
args.viewpos_x = dc_viewpos.X;
|
||||
args.step_viewpos_x = dc_viewpos_step.X;
|
||||
args.dynlights = dc_lights;
|
||||
args.num_dynlights = dc_num_lights;
|
||||
args.viewpos_x = drawerargs.dc_viewpos.X;
|
||||
args.step_viewpos_x = drawerargs.dc_viewpos_step.X;
|
||||
args.dynlights = drawerargs.dc_lights;
|
||||
args.num_dynlights = drawerargs.dc_num_lights;
|
||||
}
|
||||
|
||||
void DrawSpanLLVMCommand::Execute(DrawerThread *thread)
|
||||
|
@ -112,14 +110,12 @@ namespace swrenderer
|
|||
return "DrawSpan\n" + args.ToString();
|
||||
}
|
||||
|
||||
bool DrawSpanLLVMCommand::sampler_setup(const uint32_t * &source, int &xbits, int &ybits, bool mipmapped)
|
||||
bool DrawSpanLLVMCommand::sampler_setup(double lod, const uint32_t * &source, int &xbits, int &ybits, bool mipmapped)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
bool magnifying = ds_lod < 0.0f;
|
||||
bool magnifying = lod < 0.0;
|
||||
if (r_mipmap && mipmapped)
|
||||
{
|
||||
int level = (int)ds_lod;
|
||||
int level = (int)lod;
|
||||
while (level > 0)
|
||||
{
|
||||
if (xbits <= 2 || ybits <= 2)
|
||||
|
@ -184,44 +180,40 @@ namespace swrenderer
|
|||
return d;
|
||||
}
|
||||
|
||||
DrawWall1LLVMCommand::DrawWall1LLVMCommand()
|
||||
DrawWall1LLVMCommand::DrawWall1LLVMCommand(const DrawerArgs &drawerargs)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
args.dest = (uint32_t*)dc_dest;
|
||||
args.dest_y = _dest_y;
|
||||
args.dest = (uint32_t*)drawerargs.Dest();
|
||||
args.dest_y = drawerargs.DestY();
|
||||
args.pitch = dc_pitch;
|
||||
args.count = dc_count;
|
||||
args.texturefrac[0] = dc_texturefrac;
|
||||
args.texturefracx[0] = dc_texturefracx;
|
||||
args.iscale[0] = dc_iscale;
|
||||
args.textureheight[0] = dc_textureheight;
|
||||
args.source[0] = (const uint32 *)dc_source;
|
||||
args.source2[0] = (const uint32 *)dc_source2;
|
||||
args.light[0] = LightBgra::calc_light_multiplier(dc_light);
|
||||
args.light_red = dc_shade_constants.light_red;
|
||||
args.light_green = dc_shade_constants.light_green;
|
||||
args.light_blue = dc_shade_constants.light_blue;
|
||||
args.light_alpha = dc_shade_constants.light_alpha;
|
||||
args.fade_red = dc_shade_constants.fade_red;
|
||||
args.fade_green = dc_shade_constants.fade_green;
|
||||
args.fade_blue = dc_shade_constants.fade_blue;
|
||||
args.fade_alpha = dc_shade_constants.fade_alpha;
|
||||
args.desaturate = dc_shade_constants.desaturate;
|
||||
args.srcalpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
args.destalpha = dc_destalpha >> (FRACBITS - 8);
|
||||
args.count = drawerargs.dc_count;
|
||||
args.texturefrac[0] = drawerargs.dc_texturefrac;
|
||||
args.texturefracx[0] = drawerargs.dc_texturefracx;
|
||||
args.iscale[0] = drawerargs.dc_iscale;
|
||||
args.textureheight[0] = drawerargs.dc_textureheight;
|
||||
args.source[0] = (const uint32 *)drawerargs.dc_source;
|
||||
args.source2[0] = (const uint32 *)drawerargs.dc_source2;
|
||||
args.light[0] = LightBgra::calc_light_multiplier(drawerargs.dc_light);
|
||||
args.light_red = drawerargs.dc_shade_constants.light_red;
|
||||
args.light_green = drawerargs.dc_shade_constants.light_green;
|
||||
args.light_blue = drawerargs.dc_shade_constants.light_blue;
|
||||
args.light_alpha = drawerargs.dc_shade_constants.light_alpha;
|
||||
args.fade_red = drawerargs.dc_shade_constants.fade_red;
|
||||
args.fade_green = drawerargs.dc_shade_constants.fade_green;
|
||||
args.fade_blue = drawerargs.dc_shade_constants.fade_blue;
|
||||
args.fade_alpha = drawerargs.dc_shade_constants.fade_alpha;
|
||||
args.desaturate = drawerargs.dc_shade_constants.desaturate;
|
||||
args.srcalpha = drawerargs.dc_srcalpha >> (FRACBITS - 8);
|
||||
args.destalpha = drawerargs.dc_destalpha >> (FRACBITS - 8);
|
||||
args.flags = 0;
|
||||
if (dc_shade_constants.simple_shade)
|
||||
if (drawerargs.dc_shade_constants.simple_shade)
|
||||
args.flags |= DrawWallArgs::simple_shade;
|
||||
if (args.source2[0] == nullptr)
|
||||
args.flags |= DrawWallArgs::nearest_filter;
|
||||
|
||||
args.z = dc_viewpos.Z;
|
||||
args.step_z = dc_viewpos_step.Z;
|
||||
args.dynlights = dc_lights;
|
||||
args.num_dynlights = dc_num_lights;
|
||||
|
||||
DetectRangeError(args.dest, args.dest_y, args.count);
|
||||
args.z = drawerargs.dc_viewpos.Z;
|
||||
args.step_z = drawerargs.dc_viewpos_step.Z;
|
||||
args.dynlights = drawerargs.dc_lights;
|
||||
args.num_dynlights = drawerargs.dc_num_lights;
|
||||
}
|
||||
|
||||
void DrawWall1LLVMCommand::Execute(DrawerThread *thread)
|
||||
|
@ -252,44 +244,40 @@ namespace swrenderer
|
|||
return "DrawColumn\n" + args.ToString();
|
||||
}
|
||||
|
||||
DrawColumnLLVMCommand::DrawColumnLLVMCommand()
|
||||
DrawColumnLLVMCommand::DrawColumnLLVMCommand(const DrawerArgs &drawerargs)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
args.dest = (uint32_t*)dc_dest;
|
||||
args.source = dc_source;
|
||||
args.source2 = dc_source2;
|
||||
args.colormap = dc_colormap;
|
||||
args.translation = dc_translation;
|
||||
args.dest = (uint32_t*)drawerargs.Dest();
|
||||
args.source = drawerargs.dc_source;
|
||||
args.source2 = drawerargs.dc_source2;
|
||||
args.colormap = drawerargs.dc_colormap;
|
||||
args.translation = drawerargs.dc_translation;
|
||||
args.basecolors = (const uint32_t *)GPalette.BaseColors;
|
||||
args.pitch = dc_pitch;
|
||||
args.count = dc_count;
|
||||
args.dest_y = _dest_y;
|
||||
args.iscale = dc_iscale;
|
||||
args.texturefracx = dc_texturefracx;
|
||||
args.textureheight = dc_textureheight;
|
||||
args.texturefrac = dc_texturefrac;
|
||||
args.light = LightBgra::calc_light_multiplier(dc_light);
|
||||
args.color = LightBgra::shade_pal_index_simple(dc_color, args.light);
|
||||
args.srccolor = dc_srccolor_bgra;
|
||||
args.srcalpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
args.destalpha = dc_destalpha >> (FRACBITS - 8);
|
||||
args.light_red = dc_shade_constants.light_red;
|
||||
args.light_green = dc_shade_constants.light_green;
|
||||
args.light_blue = dc_shade_constants.light_blue;
|
||||
args.light_alpha = dc_shade_constants.light_alpha;
|
||||
args.fade_red = dc_shade_constants.fade_red;
|
||||
args.fade_green = dc_shade_constants.fade_green;
|
||||
args.fade_blue = dc_shade_constants.fade_blue;
|
||||
args.fade_alpha = dc_shade_constants.fade_alpha;
|
||||
args.desaturate = dc_shade_constants.desaturate;
|
||||
args.count = drawerargs.dc_count;
|
||||
args.dest_y = drawerargs.DestY();
|
||||
args.iscale = drawerargs.dc_iscale;
|
||||
args.texturefracx = drawerargs.dc_texturefracx;
|
||||
args.textureheight = drawerargs.dc_textureheight;
|
||||
args.texturefrac = drawerargs.dc_texturefrac;
|
||||
args.light = LightBgra::calc_light_multiplier(drawerargs.dc_light);
|
||||
args.color = LightBgra::shade_pal_index_simple(drawerargs.dc_color, args.light);
|
||||
args.srccolor = drawerargs.dc_srccolor_bgra;
|
||||
args.srcalpha = drawerargs.dc_srcalpha >> (FRACBITS - 8);
|
||||
args.destalpha = drawerargs.dc_destalpha >> (FRACBITS - 8);
|
||||
args.light_red = drawerargs.dc_shade_constants.light_red;
|
||||
args.light_green = drawerargs.dc_shade_constants.light_green;
|
||||
args.light_blue = drawerargs.dc_shade_constants.light_blue;
|
||||
args.light_alpha = drawerargs.dc_shade_constants.light_alpha;
|
||||
args.fade_red = drawerargs.dc_shade_constants.fade_red;
|
||||
args.fade_green = drawerargs.dc_shade_constants.fade_green;
|
||||
args.fade_blue = drawerargs.dc_shade_constants.fade_blue;
|
||||
args.fade_alpha = drawerargs.dc_shade_constants.fade_alpha;
|
||||
args.desaturate = drawerargs.dc_shade_constants.desaturate;
|
||||
args.flags = 0;
|
||||
if (dc_shade_constants.simple_shade)
|
||||
if (drawerargs.dc_shade_constants.simple_shade)
|
||||
args.flags |= DrawColumnArgs::simple_shade;
|
||||
if (args.source2 == nullptr)
|
||||
args.flags |= DrawColumnArgs::nearest_filter;
|
||||
|
||||
DetectRangeError(args.dest, args.dest_y, args.count);
|
||||
}
|
||||
|
||||
void DrawColumnLLVMCommand::Execute(DrawerThread *thread)
|
||||
|
@ -310,28 +298,24 @@ namespace swrenderer
|
|||
return d;
|
||||
}
|
||||
|
||||
DrawSkyLLVMCommand::DrawSkyLLVMCommand(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky)
|
||||
DrawSkyLLVMCommand::DrawSkyLLVMCommand(const DrawerArgs &drawerargs, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
args.dest = (uint32_t*)dc_dest;
|
||||
args.dest_y = _dest_y;
|
||||
args.count = dc_count;
|
||||
args.dest = (uint32_t*)drawerargs.Dest();
|
||||
args.dest_y = drawerargs.DestY();
|
||||
args.count = drawerargs.dc_count;
|
||||
args.pitch = dc_pitch;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
args.texturefrac[i] = dc_wall_texturefrac[i];
|
||||
args.iscale[i] = dc_wall_iscale[i];
|
||||
args.source0[i] = (const uint32_t *)dc_wall_source[i];
|
||||
args.source1[i] = (const uint32_t *)dc_wall_source2[i];
|
||||
args.texturefrac[i] = drawerargs.dc_wall_texturefrac[i];
|
||||
args.iscale[i] = drawerargs.dc_wall_iscale[i];
|
||||
args.source0[i] = (const uint32_t *)drawerargs.dc_wall_source[i];
|
||||
args.source1[i] = (const uint32_t *)drawerargs.dc_wall_source2[i];
|
||||
}
|
||||
args.textureheight0 = dc_wall_sourceheight[0];
|
||||
args.textureheight1 = dc_wall_sourceheight[1];
|
||||
args.textureheight0 = drawerargs.dc_wall_sourceheight[0];
|
||||
args.textureheight1 = drawerargs.dc_wall_sourceheight[1];
|
||||
args.top_color = solid_top;
|
||||
args.bottom_color = solid_bottom;
|
||||
args.flags = fadeSky ? DrawSkyArgs::fade_sky : 0;
|
||||
|
||||
DetectRangeError(args.dest, args.dest_y, args.count);
|
||||
}
|
||||
|
||||
FString DrawSkyLLVMCommand::DebugInfo()
|
||||
|
@ -341,13 +325,11 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DrawFuzzColumnRGBACommand::DrawFuzzColumnRGBACommand()
|
||||
DrawFuzzColumnRGBACommand::DrawFuzzColumnRGBACommand(const DrawerArgs &drawerargs)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_x = dc_x;
|
||||
_yl = dc_yl;
|
||||
_yh = dc_yh;
|
||||
_x = drawerargs.dc_x;
|
||||
_yl = drawerargs.dc_yl;
|
||||
_yh = drawerargs.dc_yh;
|
||||
_destorg = dc_destorg;
|
||||
_pitch = dc_pitch;
|
||||
_fuzzpos = fuzzpos;
|
||||
|
@ -451,16 +433,14 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FillSpanRGBACommand::FillSpanRGBACommand()
|
||||
FillSpanRGBACommand::FillSpanRGBACommand(const DrawerArgs &drawerargs)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_x1 = ds_x1;
|
||||
_x2 = ds_x2;
|
||||
_y = ds_y;
|
||||
_x1 = drawerargs.ds_x1;
|
||||
_x2 = drawerargs.ds_x2;
|
||||
_y = drawerargs.ds_y;
|
||||
_destorg = dc_destorg;
|
||||
_light = ds_light;
|
||||
_color = ds_color;
|
||||
_light = drawerargs.ds_light;
|
||||
_color = drawerargs.ds_color;
|
||||
}
|
||||
|
||||
void FillSpanRGBACommand::Execute(DrawerThread *thread)
|
||||
|
@ -483,17 +463,15 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DrawFogBoundaryLineRGBACommand::DrawFogBoundaryLineRGBACommand(int y, int x, int x2)
|
||||
DrawFogBoundaryLineRGBACommand::DrawFogBoundaryLineRGBACommand(const DrawerArgs &drawerargs, int y, int x, int x2)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_y = y;
|
||||
_x = x;
|
||||
_x2 = x2;
|
||||
|
||||
_destorg = dc_destorg;
|
||||
_light = dc_light;
|
||||
_shade_constants = dc_shade_constants;
|
||||
_light = drawerargs.dc_light;
|
||||
_shade_constants = drawerargs.dc_shade_constants;
|
||||
}
|
||||
|
||||
void DrawFogBoundaryLineRGBACommand::Execute(DrawerThread *thread)
|
||||
|
@ -553,16 +531,14 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DrawTiltedSpanRGBACommand::DrawTiltedSpanRGBACommand(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)
|
||||
DrawTiltedSpanRGBACommand::DrawTiltedSpanRGBACommand(const DrawerArgs &drawerargs, 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)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_x1 = x1;
|
||||
_x2 = x2;
|
||||
_y = y;
|
||||
_destorg = dc_destorg;
|
||||
_light = ds_light;
|
||||
_shade_constants = ds_shade_constants;
|
||||
_light = drawerargs.ds_light;
|
||||
_shade_constants = drawerargs.ds_shade_constants;
|
||||
_plane_sz = plane_sz;
|
||||
_plane_su = plane_su;
|
||||
_plane_sv = plane_sv;
|
||||
|
@ -571,9 +547,9 @@ namespace swrenderer
|
|||
_planelightfloat = planelightfloat;
|
||||
_pviewx = pviewx;
|
||||
_pviewy = pviewy;
|
||||
_source = (const uint32_t*)ds_source;
|
||||
_xbits = ds_xbits;
|
||||
_ybits = ds_ybits;
|
||||
_source = (const uint32_t*)drawerargs.ds_source;
|
||||
_xbits = drawerargs.ds_xbits;
|
||||
_ybits = drawerargs.ds_ybits;
|
||||
}
|
||||
|
||||
void DrawTiltedSpanRGBACommand::Execute(DrawerThread *thread)
|
||||
|
@ -689,17 +665,15 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DrawColoredSpanRGBACommand::DrawColoredSpanRGBACommand(int y, int x1, int x2)
|
||||
DrawColoredSpanRGBACommand::DrawColoredSpanRGBACommand(const DrawerArgs &drawerargs, int y, int x1, int x2)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_y = y;
|
||||
_x1 = x1;
|
||||
_x2 = x2;
|
||||
|
||||
_destorg = dc_destorg;
|
||||
_light = ds_light;
|
||||
_color = ds_color;
|
||||
_light = drawerargs.ds_light;
|
||||
_color = drawerargs.ds_color;
|
||||
}
|
||||
|
||||
void DrawColoredSpanRGBACommand::Execute(DrawerThread *thread)
|
||||
|
@ -726,10 +700,8 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FillTransColumnRGBACommand::FillTransColumnRGBACommand(int x, int y1, int y2, int color, int a)
|
||||
FillTransColumnRGBACommand::FillTransColumnRGBACommand(const DrawerArgs &drawerargs, int x, int y1, int y2, int color, int a)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
_x = x;
|
||||
_y1 = y1;
|
||||
_y2 = y2;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "v_palette.h"
|
||||
#include "r_thread.h"
|
||||
#include "r_drawers.h"
|
||||
#include "r_drawerargs.h"
|
||||
|
||||
#ifdef __arm__
|
||||
#define NO_SSE
|
||||
|
@ -79,7 +80,7 @@ namespace swrenderer
|
|||
class DrawSpanLLVMCommand : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
DrawSpanLLVMCommand();
|
||||
DrawSpanLLVMCommand(const DrawerArgs &drawerargs);
|
||||
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override;
|
||||
|
@ -88,36 +89,41 @@ namespace swrenderer
|
|||
DrawSpanArgs args;
|
||||
|
||||
private:
|
||||
inline static bool sampler_setup(const uint32_t * &source, int &xbits, int &ybits, bool mipmapped);
|
||||
inline static bool sampler_setup(double lod, const uint32_t * &source, int &xbits, int &ybits, bool mipmapped);
|
||||
};
|
||||
|
||||
class DrawSpanMaskedLLVMCommand : public DrawSpanLLVMCommand
|
||||
{
|
||||
public:
|
||||
using DrawSpanLLVMCommand::DrawSpanLLVMCommand;
|
||||
void Execute(DrawerThread *thread) override;
|
||||
};
|
||||
|
||||
class DrawSpanTranslucentLLVMCommand : public DrawSpanLLVMCommand
|
||||
{
|
||||
public:
|
||||
using DrawSpanLLVMCommand::DrawSpanLLVMCommand;
|
||||
void Execute(DrawerThread *thread) override;
|
||||
};
|
||||
|
||||
class DrawSpanMaskedTranslucentLLVMCommand : public DrawSpanLLVMCommand
|
||||
{
|
||||
public:
|
||||
using DrawSpanLLVMCommand::DrawSpanLLVMCommand;
|
||||
void Execute(DrawerThread *thread) override;
|
||||
};
|
||||
|
||||
class DrawSpanAddClampLLVMCommand : public DrawSpanLLVMCommand
|
||||
{
|
||||
public:
|
||||
using DrawSpanLLVMCommand::DrawSpanLLVMCommand;
|
||||
void Execute(DrawerThread *thread) override;
|
||||
};
|
||||
|
||||
class DrawSpanMaskedAddClampLLVMCommand : public DrawSpanLLVMCommand
|
||||
{
|
||||
public:
|
||||
using DrawSpanLLVMCommand::DrawSpanLLVMCommand;
|
||||
void Execute(DrawerThread *thread) override;
|
||||
};
|
||||
|
||||
|
@ -129,7 +135,7 @@ namespace swrenderer
|
|||
WorkerThreadData ThreadData(DrawerThread *thread);
|
||||
|
||||
public:
|
||||
DrawWall1LLVMCommand();
|
||||
DrawWall1LLVMCommand(const DrawerArgs &drawerargs);
|
||||
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override;
|
||||
|
@ -144,7 +150,7 @@ namespace swrenderer
|
|||
FString DebugInfo() override;
|
||||
|
||||
public:
|
||||
DrawColumnLLVMCommand();
|
||||
DrawColumnLLVMCommand(const DrawerArgs &drawerargs);
|
||||
|
||||
void Execute(DrawerThread *thread) override;
|
||||
};
|
||||
|
@ -157,7 +163,7 @@ namespace swrenderer
|
|||
WorkerThreadData ThreadData(DrawerThread *thread);
|
||||
|
||||
public:
|
||||
DrawSkyLLVMCommand(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky);
|
||||
DrawSkyLLVMCommand(const DrawerArgs &drawerargs, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky);
|
||||
FString DebugInfo() override;
|
||||
};
|
||||
|
||||
|
@ -195,7 +201,7 @@ namespace swrenderer
|
|||
int _fuzzviewheight;
|
||||
|
||||
public:
|
||||
DrawFuzzColumnRGBACommand();
|
||||
DrawFuzzColumnRGBACommand(const DrawerArgs &drawerargs);
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override;
|
||||
};
|
||||
|
@ -210,7 +216,7 @@ namespace swrenderer
|
|||
int _color;
|
||||
|
||||
public:
|
||||
FillSpanRGBACommand();
|
||||
FillSpanRGBACommand(const DrawerArgs &drawerargs);
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override;
|
||||
};
|
||||
|
@ -225,7 +231,7 @@ namespace swrenderer
|
|||
ShadeConstants _shade_constants;
|
||||
|
||||
public:
|
||||
DrawFogBoundaryLineRGBACommand(int y, int x, int x2);
|
||||
DrawFogBoundaryLineRGBACommand(const DrawerArgs &drawerargs, int y, int x, int x2);
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override;
|
||||
};
|
||||
|
@ -251,7 +257,7 @@ namespace swrenderer
|
|||
const uint32_t * RESTRICT _source;
|
||||
|
||||
public:
|
||||
DrawTiltedSpanRGBACommand(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);
|
||||
DrawTiltedSpanRGBACommand(const DrawerArgs &drawerargs, 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 Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override;
|
||||
};
|
||||
|
@ -266,7 +272,7 @@ namespace swrenderer
|
|||
int _color;
|
||||
|
||||
public:
|
||||
DrawColoredSpanRGBACommand(int y, int x1, int x2);
|
||||
DrawColoredSpanRGBACommand(const DrawerArgs &drawerargs, int y, int x1, int x2);
|
||||
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override;
|
||||
|
@ -284,7 +290,7 @@ namespace swrenderer
|
|||
fixed_t _light;
|
||||
|
||||
public:
|
||||
FillTransColumnRGBACommand(int x, int y1, int y2, int color, int a);
|
||||
FillTransColumnRGBACommand(const DrawerArgs &drawerargs, int x, int y1, int y2, int color, int a);
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override;
|
||||
};
|
||||
|
@ -335,6 +341,7 @@ namespace swrenderer
|
|||
|
||||
private:
|
||||
uint32_t *_dest;
|
||||
int _dest_y;
|
||||
int _pitch;
|
||||
int _count;
|
||||
uint32_t _fg;
|
||||
|
@ -347,46 +354,46 @@ namespace swrenderer
|
|||
class SWTruecolorDrawers : public SWPixelFormatDrawers
|
||||
{
|
||||
public:
|
||||
void DrawWallColumn() override { DrawerCommandQueue::QueueCommand<DrawWall1LLVMCommand>(); }
|
||||
void DrawWallMaskedColumn() override { DrawerCommandQueue::QueueCommand<DrawWallMasked1LLVMCommand>(); }
|
||||
void DrawWallAddColumn() override { DrawerCommandQueue::QueueCommand<DrawWallAdd1LLVMCommand>(); }
|
||||
void DrawWallAddClampColumn() override { DrawerCommandQueue::QueueCommand<DrawWallAddClamp1LLVMCommand>(); }
|
||||
void DrawWallSubClampColumn() override { DrawerCommandQueue::QueueCommand<DrawWallSubClamp1LLVMCommand>(); }
|
||||
void DrawWallRevSubClampColumn() override { DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1LLVMCommand>(); }
|
||||
void DrawSingleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool skyFade) override { DrawerCommandQueue::QueueCommand<DrawSingleSky1LLVMCommand>(solid_top, solid_bottom, skyFade); }
|
||||
void DrawDoubleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool skyFade) override { DrawerCommandQueue::QueueCommand<DrawDoubleSky1LLVMCommand>(solid_top, solid_bottom, skyFade); }
|
||||
void DrawColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnLLVMCommand>(); }
|
||||
void FillColumn() override { DrawerCommandQueue::QueueCommand<FillColumnLLVMCommand>(); }
|
||||
void FillAddColumn() override { DrawerCommandQueue::QueueCommand<FillColumnAddLLVMCommand>(); }
|
||||
void FillAddClampColumn() override { DrawerCommandQueue::QueueCommand<FillColumnAddClampLLVMCommand>(); }
|
||||
void FillSubClampColumn() override { DrawerCommandQueue::QueueCommand<FillColumnSubClampLLVMCommand>(); }
|
||||
void FillRevSubClampColumn() override { DrawerCommandQueue::QueueCommand<FillColumnRevSubClampLLVMCommand>(); }
|
||||
void DrawFuzzColumn() override { DrawerCommandQueue::QueueCommand<DrawFuzzColumnRGBACommand>(); R_UpdateFuzzPos(); }
|
||||
void DrawAddColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnAddLLVMCommand>(); }
|
||||
void DrawTranslatedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnTranslatedLLVMCommand>(); }
|
||||
void DrawTranslatedAddColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnTlatedAddLLVMCommand>(); }
|
||||
void DrawShadedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnShadedLLVMCommand>(); }
|
||||
void DrawAddClampColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnAddClampLLVMCommand>(); }
|
||||
void DrawAddClampTranslatedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnAddClampTranslatedLLVMCommand>(); }
|
||||
void DrawSubClampColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnSubClampLLVMCommand>(); }
|
||||
void DrawSubClampTranslatedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnSubClampTranslatedLLVMCommand>(); }
|
||||
void DrawRevSubClampColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampLLVMCommand>(); }
|
||||
void DrawRevSubClampTranslatedColumn() override { DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampTranslatedLLVMCommand>(); }
|
||||
void DrawSpan() override { DrawerCommandQueue::QueueCommand<DrawSpanLLVMCommand>(); }
|
||||
void DrawSpanMasked() override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedLLVMCommand>(); }
|
||||
void DrawSpanTranslucent() override { DrawerCommandQueue::QueueCommand<DrawSpanTranslucentLLVMCommand>(); }
|
||||
void DrawSpanMaskedTranslucent() override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedTranslucentLLVMCommand>(); }
|
||||
void DrawSpanAddClamp() override { DrawerCommandQueue::QueueCommand<DrawSpanAddClampLLVMCommand>(); }
|
||||
void DrawSpanMaskedAddClamp() override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedAddClampLLVMCommand>(); }
|
||||
void FillSpan() override { DrawerCommandQueue::QueueCommand<FillSpanRGBACommand>(); }
|
||||
void DrawWallColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWall1LLVMCommand>(args); }
|
||||
void DrawWallMaskedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallMasked1LLVMCommand>(args); }
|
||||
void DrawWallAddColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallAdd1LLVMCommand>(args); }
|
||||
void DrawWallAddClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallAddClamp1LLVMCommand>(args); }
|
||||
void DrawWallSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallSubClamp1LLVMCommand>(args); }
|
||||
void DrawWallRevSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1LLVMCommand>(args); }
|
||||
void DrawSingleSkyColumn(const DrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool skyFade) override { DrawerCommandQueue::QueueCommand<DrawSingleSky1LLVMCommand>(args, solid_top, solid_bottom, skyFade); }
|
||||
void DrawDoubleSkyColumn(const DrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool skyFade) override { DrawerCommandQueue::QueueCommand<DrawDoubleSky1LLVMCommand>(args, solid_top, solid_bottom, skyFade); }
|
||||
void DrawColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnLLVMCommand>(args); }
|
||||
void FillColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnLLVMCommand>(args); }
|
||||
void FillAddColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnAddLLVMCommand>(args); }
|
||||
void FillAddClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnAddClampLLVMCommand>(args); }
|
||||
void FillSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnSubClampLLVMCommand>(args); }
|
||||
void FillRevSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnRevSubClampLLVMCommand>(args); }
|
||||
void DrawFuzzColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawFuzzColumnRGBACommand>(args); R_UpdateFuzzPos(args); }
|
||||
void DrawAddColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnAddLLVMCommand>(args); }
|
||||
void DrawTranslatedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnTranslatedLLVMCommand>(args); }
|
||||
void DrawTranslatedAddColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnTlatedAddLLVMCommand>(args); }
|
||||
void DrawShadedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnShadedLLVMCommand>(args); }
|
||||
void DrawAddClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnAddClampLLVMCommand>(args); }
|
||||
void DrawAddClampTranslatedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnAddClampTranslatedLLVMCommand>(args); }
|
||||
void DrawSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnSubClampLLVMCommand>(args); }
|
||||
void DrawSubClampTranslatedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnSubClampTranslatedLLVMCommand>(args); }
|
||||
void DrawRevSubClampColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampLLVMCommand>(args); }
|
||||
void DrawRevSubClampTranslatedColumn(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnRevSubClampTranslatedLLVMCommand>(args); }
|
||||
void DrawSpan(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanLLVMCommand>(args); }
|
||||
void DrawSpanMasked(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedLLVMCommand>(args); }
|
||||
void DrawSpanTranslucent(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanTranslucentLLVMCommand>(args); }
|
||||
void DrawSpanMaskedTranslucent(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedTranslucentLLVMCommand>(args); }
|
||||
void DrawSpanAddClamp(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanAddClampLLVMCommand>(args); }
|
||||
void DrawSpanMaskedAddClamp(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSpanMaskedAddClampLLVMCommand>(args); }
|
||||
void FillSpan(const DrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillSpanRGBACommand>(args); }
|
||||
|
||||
void 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, FDynamicColormap *basecolormap) override
|
||||
void DrawTiltedSpan(const DrawerArgs &args, 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, FDynamicColormap *basecolormap) override
|
||||
{
|
||||
DrawerCommandQueue::QueueCommand<DrawTiltedSpanRGBACommand>(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy);
|
||||
DrawerCommandQueue::QueueCommand<DrawTiltedSpanRGBACommand>(args, y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy);
|
||||
}
|
||||
|
||||
void DrawColoredSpan(int y, int x1, int x2) override { DrawerCommandQueue::QueueCommand<DrawColoredSpanRGBACommand>(y, x1, x2); }
|
||||
void DrawFogBoundaryLine(int y, int x1, int x2) override { DrawerCommandQueue::QueueCommand<DrawFogBoundaryLineRGBACommand>(y, x1, x2); }
|
||||
void DrawColoredSpan(const DrawerArgs &args, int y, int x1, int x2) override { DrawerCommandQueue::QueueCommand<DrawColoredSpanRGBACommand>(args, y, x1, x2); }
|
||||
void DrawFogBoundaryLine(const DrawerArgs &args, int y, int x1, int x2) override { DrawerCommandQueue::QueueCommand<DrawFogBoundaryLineRGBACommand>(args, y, x1, x2); }
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -108,42 +108,7 @@ public:
|
|||
// Task to be executed by each worker thread
|
||||
class DrawerCommand
|
||||
{
|
||||
protected:
|
||||
int _dest_y;
|
||||
|
||||
void DetectRangeError(uint32_t *&dest, int &dest_y, int &count)
|
||||
{
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
if (dest_y < 0 || count < 0 || dest_y + count > swrenderer::drawerargs::dc_destheight)
|
||||
__debugbreak(); // Buffer overrun detected!
|
||||
#endif
|
||||
|
||||
if (dest_y < 0)
|
||||
{
|
||||
count += dest_y;
|
||||
dest_y = 0;
|
||||
dest = (uint32_t*)swrenderer::drawerargs::dc_destorg;
|
||||
}
|
||||
else if (dest_y >= swrenderer::drawerargs::dc_destheight)
|
||||
{
|
||||
dest_y = 0;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
if (count < 0 || count > MAXHEIGHT) count = 0;
|
||||
if (dest_y + count >= swrenderer::drawerargs::dc_destheight)
|
||||
count = swrenderer::drawerargs::dc_destheight - dest_y;
|
||||
}
|
||||
|
||||
public:
|
||||
DrawerCommand()
|
||||
{
|
||||
if (swrenderer::r_swtruecolor)
|
||||
_dest_y = static_cast<int>((swrenderer::drawerargs::dc_dest - swrenderer::drawerargs::dc_destorg) / (swrenderer::drawerargs::dc_pitch * 4));
|
||||
else
|
||||
_dest_y = static_cast<int>((swrenderer::drawerargs::dc_dest - swrenderer::drawerargs::dc_destorg) / (swrenderer::drawerargs::dc_pitch));
|
||||
}
|
||||
|
||||
virtual ~DrawerCommand() { }
|
||||
|
||||
virtual void Execute(DrawerThread *thread) = 0;
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace swrenderer
|
|||
fillshort(spanend + t2, b2 - t2, x);
|
||||
}
|
||||
|
||||
drawerstyle.SetColorMapLight(basecolormap, (float)light, wallshade);
|
||||
drawerargs.SetColorMapLight(basecolormap, (float)light, wallshade);
|
||||
|
||||
uint8_t *fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
|
||||
|
||||
|
@ -91,7 +91,7 @@ namespace swrenderer
|
|||
fillshort(spanend + t2, b2 - t2, x);
|
||||
}
|
||||
rcolormap = lcolormap;
|
||||
drawerstyle.SetColorMapLight(basecolormap, (float)light, wallshade);
|
||||
drawerargs.SetColorMapLight(basecolormap, (float)light, wallshade);
|
||||
fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
|
||||
}
|
||||
else
|
||||
|
@ -102,13 +102,13 @@ namespace swrenderer
|
|||
while (t2 < stop)
|
||||
{
|
||||
int y = t2++;
|
||||
drawerstyle.DrawFogBoundaryLine(y, xr, spanend[y]);
|
||||
drawerargs.DrawFogBoundaryLine(y, xr, spanend[y]);
|
||||
}
|
||||
stop = MAX(b1, t2);
|
||||
while (b2 > stop)
|
||||
{
|
||||
int y = --b2;
|
||||
drawerstyle.DrawFogBoundaryLine(y, xr, spanend[y]);
|
||||
drawerargs.DrawFogBoundaryLine(y, xr, spanend[y]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -142,7 +142,7 @@ namespace swrenderer
|
|||
{
|
||||
for (; y < y2; ++y)
|
||||
{
|
||||
drawerstyle.DrawFogBoundaryLine(y, x1, spanend[y]);
|
||||
drawerargs.DrawFogBoundaryLine(y, x1, spanend[y]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,6 @@ namespace swrenderer
|
|||
void RenderSection(int y, int y2, int x1);
|
||||
|
||||
short spanend[MAXHEIGHT];
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -72,9 +72,6 @@ namespace swrenderer
|
|||
|
||||
curline = line;
|
||||
|
||||
// [RH] Color if not texturing line
|
||||
drawerargs::dc_color = (((int)(line - segs) * 8) + 4) & 255;
|
||||
|
||||
pt1 = line->v1->fPos() - ViewPos;
|
||||
pt2 = line->v2->fPos() - ViewPos;
|
||||
|
||||
|
@ -933,13 +930,16 @@ namespace swrenderer
|
|||
double yscale;
|
||||
fixed_t xoffset = rw_offset;
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
|
||||
// [RH] Color if not texturing line
|
||||
drawerargs.dc_color = (((int)(curline - segs) * 8) + 4) & 255;
|
||||
|
||||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
if (cameraLight->fixedlightlev >= 0)
|
||||
drawerstyle.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
else if (cameraLight->fixedcolormap != nullptr)
|
||||
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
|
||||
// clip wall to the floor and ceiling
|
||||
auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip;
|
||||
|
@ -1048,7 +1048,7 @@ namespace swrenderer
|
|||
}
|
||||
|
||||
RenderWallPart renderWallpart;
|
||||
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallbottom.ScreenY, rw_midtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||
renderWallpart.Render(drawerargs, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallbottom.ScreenY, rw_midtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||
}
|
||||
fillshort(ceilingclip + x1, x2 - x1, viewheight);
|
||||
fillshort(floorclip + x1, x2 - x1, 0xffff);
|
||||
|
@ -1085,7 +1085,7 @@ namespace swrenderer
|
|||
}
|
||||
|
||||
RenderWallPart renderWallpart;
|
||||
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallupper.ScreenY, rw_toptexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||
renderWallpart.Render(drawerargs, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallupper.ScreenY, rw_toptexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||
}
|
||||
memcpy(ceilingclip + x1, wallupper.ScreenY + x1, (x2 - x1) * sizeof(short));
|
||||
}
|
||||
|
@ -1125,7 +1125,7 @@ namespace swrenderer
|
|||
}
|
||||
|
||||
RenderWallPart renderWallpart;
|
||||
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, walllower.ScreenY, wallbottom.ScreenY, rw_bottomtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||
renderWallpart.Render(drawerargs, frontsector, curline, WallC, rw_pic, x1, x2, walllower.ScreenY, wallbottom.ScreenY, rw_bottomtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||
}
|
||||
memcpy(floorclip + x1, walllower.ScreenY + x1, (x2 - x1) * sizeof(short));
|
||||
}
|
||||
|
|
|
@ -67,8 +67,8 @@ namespace swrenderer
|
|||
curline = ds->curline;
|
||||
|
||||
FDynamicColormap *patchstylecolormap = nullptr;
|
||||
DrawerStyle drawerstyle;
|
||||
bool visible = drawerstyle.SetPatchStyle(LegacyRenderStyles[curline->linedef->flags & ML_ADDTRANS ? STYLE_Add : STYLE_Translucent],
|
||||
DrawerArgs drawerargs;
|
||||
bool visible = drawerargs.SetPatchStyle(LegacyRenderStyles[curline->linedef->flags & ML_ADDTRANS ? STYLE_Add : STYLE_Translucent],
|
||||
(float)MIN(curline->linedef->alpha, 1.), 0, 0, patchstylecolormap);
|
||||
|
||||
if (!visible && !ds->bFogBoundary && !ds->bFakeBoundary)
|
||||
|
@ -142,9 +142,9 @@ namespace swrenderer
|
|||
rw_scalestep = ds->iscalestep;
|
||||
|
||||
if (cameraLight->fixedlightlev >= 0)
|
||||
drawerstyle.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
else if (cameraLight->fixedcolormap != nullptr)
|
||||
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
|
||||
// find positioning
|
||||
texheight = tex->GetScaledHeightDouble();
|
||||
|
@ -273,7 +273,7 @@ namespace swrenderer
|
|||
{
|
||||
if (cameraLight->fixedcolormap == nullptr && cameraLight->fixedlightlev < 0)
|
||||
{
|
||||
drawerstyle.SetColorMapLight(basecolormap, rw_light, wallshade);
|
||||
drawerargs.SetColorMapLight(basecolormap, rw_light, wallshade);
|
||||
}
|
||||
|
||||
fixed_t iscale = xs_Fix<16>::ToFix(MaskedSWall[x] * MaskedScaleY);
|
||||
|
@ -283,7 +283,7 @@ namespace swrenderer
|
|||
else
|
||||
sprtopscreen = CenterY - texturemid * spryscale;
|
||||
|
||||
drawerstyle.DrawMaskedColumn(x, iscale, tex, maskedtexturecol[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
||||
drawerargs.DrawMaskedColumn(x, iscale, tex, maskedtexturecol[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
||||
|
||||
rw_light += rw_lightstep;
|
||||
spryscale += rw_scalestep;
|
||||
|
@ -349,7 +349,7 @@ namespace swrenderer
|
|||
GetMaskedWallTopBottom(ds, top, bot);
|
||||
|
||||
RenderWallPart renderWallpart;
|
||||
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, mceilingclip, mfloorclip, texturemid, MaskedSWall, maskedtexturecol, ds->yscale, top, bot, true, wallshade, rw_offset, rw_light, rw_lightstep, nullptr, ds->foggy, basecolormap);
|
||||
renderWallpart.Render(drawerargs, frontsector, curline, WallC, rw_pic, x1, x2, mceilingclip, mfloorclip, texturemid, MaskedSWall, maskedtexturecol, ds->yscale, top, bot, true, wallshade, rw_offset, rw_light, rw_lightstep, nullptr, ds->foggy, basecolormap);
|
||||
}
|
||||
|
||||
clearfog:
|
||||
|
@ -383,8 +383,8 @@ namespace swrenderer
|
|||
double yscale;
|
||||
|
||||
fixed_t Alpha = Scale(rover->alpha, OPAQUE, 255);
|
||||
DrawerStyle drawerstyle;
|
||||
bool visible = drawerstyle.SetPatchStyle(LegacyRenderStyles[rover->flags & FF_ADDITIVETRANS ? STYLE_Add : STYLE_Translucent],
|
||||
DrawerArgs drawerargs;
|
||||
bool visible = drawerargs.SetPatchStyle(LegacyRenderStyles[rover->flags & FF_ADDITIVETRANS ? STYLE_Add : STYLE_Translucent],
|
||||
Alpha, 0, 0, basecolormap);
|
||||
|
||||
if (!visible)
|
||||
|
@ -445,9 +445,9 @@ namespace swrenderer
|
|||
|
||||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
if (cameraLight->fixedlightlev >= 0)
|
||||
drawerstyle.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
else if (cameraLight->fixedcolormap != nullptr)
|
||||
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
|
||||
WallC.sz1 = ds->sz1;
|
||||
WallC.sz2 = ds->sz2;
|
||||
|
@ -481,7 +481,7 @@ namespace swrenderer
|
|||
GetMaskedWallTopBottom(ds, top, bot);
|
||||
|
||||
RenderWallPart renderWallpart;
|
||||
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, wallupper.ScreenY, walllower.ScreenY, texturemid, MaskedSWall, walltexcoords.UPos, yscale, top, bot, true, wallshade, rw_offset, rw_light, rw_lightstep, nullptr, ds->foggy, basecolormap);
|
||||
renderWallpart.Render(drawerargs, frontsector, curline, WallC, rw_pic, x1, x2, wallupper.ScreenY, walllower.ScreenY, texturemid, MaskedSWall, walltexcoords.UPos, yscale, top, bot, true, wallshade, rw_offset, rw_light, rw_lightstep, nullptr, ds->foggy, basecolormap);
|
||||
}
|
||||
|
||||
// kg3D - walls of fake floors
|
||||
|
|
|
@ -170,8 +170,6 @@ namespace swrenderer
|
|||
// Draw a column with support for non-power-of-two ranges
|
||||
void RenderWallPart::Draw1Column(int x, int y1, int y2, WallSampler &sampler, DrawerFunc draw1column)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_dynlights && light_list)
|
||||
{
|
||||
// Find column position in view space
|
||||
|
@ -180,17 +178,17 @@ namespace swrenderer
|
|||
float t = (x - WallC.sx1 + 0.5f) / (WallC.sx2 - WallC.sx1);
|
||||
float wcol = w1 * (1.0f - t) + w2 * t;
|
||||
float zcol = 1.0f / wcol;
|
||||
dc_viewpos.X = (float)((x + 0.5 - CenterX) / CenterX * zcol);
|
||||
dc_viewpos.Y = zcol;
|
||||
dc_viewpos.Z = (float)((CenterY - y1 - 0.5) / InvZtoScale * zcol);
|
||||
dc_viewpos_step.Z = (float)(-zcol / InvZtoScale);
|
||||
drawerargs.dc_viewpos.X = (float)((x + 0.5 - CenterX) / CenterX * zcol);
|
||||
drawerargs.dc_viewpos.Y = zcol;
|
||||
drawerargs.dc_viewpos.Z = (float)((CenterY - y1 - 0.5) / InvZtoScale * zcol);
|
||||
drawerargs.dc_viewpos_step.Z = (float)(-zcol / InvZtoScale);
|
||||
|
||||
static TriLight lightbuffer[64 * 1024];
|
||||
static int nextlightindex = 0;
|
||||
|
||||
// Setup lights for column
|
||||
dc_num_lights = 0;
|
||||
dc_lights = lightbuffer + nextlightindex;
|
||||
drawerargs.dc_num_lights = 0;
|
||||
drawerargs.dc_lights = lightbuffer + nextlightindex;
|
||||
FLightNode *cur_node = light_list;
|
||||
while (cur_node && nextlightindex < 64 * 1024)
|
||||
{
|
||||
|
@ -200,14 +198,14 @@ namespace swrenderer
|
|||
double lightY = cur_node->lightsource->Y() - ViewPos.Y;
|
||||
double lightZ = cur_node->lightsource->Z() - ViewPos.Z;
|
||||
|
||||
float lx = (float)(lightX * ViewSin - lightY * ViewCos) - dc_viewpos.X;
|
||||
float ly = (float)(lightX * ViewTanCos + lightY * ViewTanSin) - dc_viewpos.Y;
|
||||
float lx = (float)(lightX * ViewSin - lightY * ViewCos) - drawerargs.dc_viewpos.X;
|
||||
float ly = (float)(lightX * ViewTanCos + lightY * ViewTanSin) - drawerargs.dc_viewpos.Y;
|
||||
float lz = (float)lightZ;
|
||||
|
||||
// Precalculate the constant part of the dot here so the drawer doesn't have to.
|
||||
bool is_point_light = (cur_node->lightsource->flags4 & MF4_ATTENUATE) != 0;
|
||||
float lconstant = lx * lx + ly * ly;
|
||||
float nlconstant = is_point_light ? lx * dc_normal.X + ly * dc_normal.Y : 0.0f;
|
||||
float nlconstant = is_point_light ? lx * drawerargs.dc_normal.X + ly * drawerargs.dc_normal.Y : 0.0f;
|
||||
|
||||
// Include light only if it touches this column
|
||||
float radius = cur_node->lightsource->GetRadius();
|
||||
|
@ -218,7 +216,7 @@ namespace swrenderer
|
|||
uint32_t blue = cur_node->lightsource->GetBlue();
|
||||
|
||||
nextlightindex++;
|
||||
auto &light = dc_lights[dc_num_lights++];
|
||||
auto &light = drawerargs.dc_lights[drawerargs.dc_num_lights++];
|
||||
light.x = lconstant;
|
||||
light.y = nlconstant;
|
||||
light.z = lz;
|
||||
|
@ -235,22 +233,22 @@ namespace swrenderer
|
|||
}
|
||||
else
|
||||
{
|
||||
dc_num_lights = 0;
|
||||
drawerargs.dc_num_lights = 0;
|
||||
}
|
||||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
int count = y2 - y1;
|
||||
|
||||
dc_source = sampler.source;
|
||||
dc_source2 = sampler.source2;
|
||||
dc_texturefracx = sampler.texturefracx;
|
||||
dc_dest = (ylookup[y1] + x) * 4 + dc_destorg;
|
||||
dc_count = count;
|
||||
dc_iscale = sampler.uv_step;
|
||||
dc_texturefrac = sampler.uv_pos;
|
||||
dc_textureheight = sampler.height;
|
||||
(drawerstyle.Drawers()->*draw1column)();
|
||||
drawerargs.dc_source = sampler.source;
|
||||
drawerargs.dc_source2 = sampler.source2;
|
||||
drawerargs.dc_texturefracx = sampler.texturefracx;
|
||||
drawerargs.SetDest(x, y1);
|
||||
drawerargs.dc_count = count;
|
||||
drawerargs.dc_iscale = sampler.uv_step;
|
||||
drawerargs.dc_texturefrac = sampler.uv_pos;
|
||||
drawerargs.dc_textureheight = sampler.height;
|
||||
(drawerargs.Drawers()->*draw1column)(drawerargs);
|
||||
|
||||
uint64_t step64 = sampler.uv_step;
|
||||
uint64_t pos64 = sampler.uv_pos;
|
||||
|
@ -262,14 +260,14 @@ namespace swrenderer
|
|||
{
|
||||
int count = y2 - y1;
|
||||
|
||||
dc_source = sampler.source;
|
||||
dc_source2 = sampler.source2;
|
||||
dc_texturefracx = sampler.texturefracx;
|
||||
dc_dest = (ylookup[y1] + x) + dc_destorg;
|
||||
dc_count = count;
|
||||
dc_iscale = sampler.uv_step;
|
||||
dc_texturefrac = sampler.uv_pos;
|
||||
(drawerstyle.Drawers()->*draw1column)();
|
||||
drawerargs.dc_source = sampler.source;
|
||||
drawerargs.dc_source2 = sampler.source2;
|
||||
drawerargs.dc_texturefracx = sampler.texturefracx;
|
||||
drawerargs.SetDest(x, y1);
|
||||
drawerargs.dc_count = count;
|
||||
drawerargs.dc_iscale = sampler.uv_step;
|
||||
drawerargs.dc_texturefrac = sampler.uv_pos;
|
||||
(drawerargs.Drawers()->*draw1column)(drawerargs);
|
||||
|
||||
uint64_t step64 = sampler.uv_step;
|
||||
uint64_t pos64 = sampler.uv_pos;
|
||||
|
@ -288,14 +286,14 @@ namespace swrenderer
|
|||
next_uv_wrap++;
|
||||
uint32_t count = MIN(left, next_uv_wrap);
|
||||
|
||||
dc_source = sampler.source;
|
||||
dc_source2 = sampler.source2;
|
||||
dc_texturefracx = sampler.texturefracx;
|
||||
dc_dest = (ylookup[y1] + x) + dc_destorg;
|
||||
dc_count = count;
|
||||
dc_iscale = sampler.uv_step;
|
||||
dc_texturefrac = uv_pos;
|
||||
(drawerstyle.Drawers()->*draw1column)();
|
||||
drawerargs.dc_source = sampler.source;
|
||||
drawerargs.dc_source2 = sampler.source2;
|
||||
drawerargs.dc_texturefracx = sampler.texturefracx;
|
||||
drawerargs.SetDest(x, y1);
|
||||
drawerargs.dc_count = count;
|
||||
drawerargs.dc_iscale = sampler.uv_step;
|
||||
drawerargs.dc_texturefrac = uv_pos;
|
||||
(drawerargs.Drawers()->*draw1column)(drawerargs);
|
||||
|
||||
left -= count;
|
||||
uv_pos += sampler.uv_step * count;
|
||||
|
@ -310,8 +308,6 @@ namespace swrenderer
|
|||
|
||||
void RenderWallPart::ProcessWallWorker(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal, DrawerFunc drawcolumn)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (rw_pic->UseType == FTexture::TEX_Null)
|
||||
return;
|
||||
|
||||
|
@ -324,33 +320,33 @@ namespace swrenderer
|
|||
texturemid = 0;
|
||||
}
|
||||
|
||||
dc_wall_fracbits = r_swtruecolor ? FRACBITS : fracbits;
|
||||
drawerargs.dc_wall_fracbits = r_swtruecolor ? FRACBITS : fracbits;
|
||||
|
||||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
bool fixed = (cameraLight->fixedcolormap != NULL || cameraLight->fixedlightlev >= 0);
|
||||
if (fixed)
|
||||
{
|
||||
dc_wall_colormap[0] = dc_colormap;
|
||||
dc_wall_colormap[1] = dc_colormap;
|
||||
dc_wall_colormap[2] = dc_colormap;
|
||||
dc_wall_colormap[3] = dc_colormap;
|
||||
dc_wall_light[0] = 0;
|
||||
dc_wall_light[1] = 0;
|
||||
dc_wall_light[2] = 0;
|
||||
dc_wall_light[3] = 0;
|
||||
drawerargs.dc_wall_colormap[0] = drawerargs.dc_colormap;
|
||||
drawerargs.dc_wall_colormap[1] = drawerargs.dc_colormap;
|
||||
drawerargs.dc_wall_colormap[2] = drawerargs.dc_colormap;
|
||||
drawerargs.dc_wall_colormap[3] = drawerargs.dc_colormap;
|
||||
drawerargs.dc_wall_light[0] = 0;
|
||||
drawerargs.dc_wall_light[1] = 0;
|
||||
drawerargs.dc_wall_light[2] = 0;
|
||||
drawerargs.dc_wall_light[3] = 0;
|
||||
}
|
||||
|
||||
if (cameraLight->fixedcolormap)
|
||||
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
else
|
||||
drawerstyle.SetColorMapLight(basecolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight(basecolormap, 0, 0);
|
||||
|
||||
float dx = WallC.tright.X - WallC.tleft.X;
|
||||
float dy = WallC.tright.Y - WallC.tleft.Y;
|
||||
float length = sqrt(dx * dx + dy * dy);
|
||||
dc_normal.X = dy / length;
|
||||
dc_normal.Y = -dx / length;
|
||||
dc_normal.Z = 0.0f;
|
||||
drawerargs.dc_normal.X = dy / length;
|
||||
drawerargs.dc_normal.Y = -dx / length;
|
||||
drawerargs.dc_normal.Z = 0.0f;
|
||||
|
||||
double xmagnitude = 1.0;
|
||||
|
||||
|
@ -362,7 +358,7 @@ namespace swrenderer
|
|||
continue;
|
||||
|
||||
if (!fixed)
|
||||
drawerstyle.SetColorMapLight(basecolormap, light, wallshade);
|
||||
drawerargs.SetColorMapLight(basecolormap, light, wallshade);
|
||||
|
||||
if (x + 1 < x2) xmagnitude = fabs(FIXED2DBL(lwal[x + 1]) - FIXED2DBL(lwal[x]));
|
||||
|
||||
|
@ -392,7 +388,7 @@ namespace swrenderer
|
|||
|
||||
void RenderWallPart::ProcessTranslucentWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal)
|
||||
{
|
||||
DrawerFunc drawcol1 = drawerstyle.GetTransMaskDrawer();
|
||||
DrawerFunc drawcol1 = drawerargs.GetTransMaskDrawer();
|
||||
if (drawcol1 == nullptr)
|
||||
{
|
||||
// The current translucency is unsupported, so draw with regular ProcessMaskedWall instead.
|
||||
|
@ -445,7 +441,7 @@ namespace swrenderer
|
|||
{
|
||||
if (mask)
|
||||
{
|
||||
if (drawerstyle.colfunc == drawerstyle.basecolfunc)
|
||||
if (drawerargs.colfunc == drawerargs.basecolfunc)
|
||||
{
|
||||
ProcessMaskedWall(uwal, dwal, texturemid, swal, lwal);
|
||||
}
|
||||
|
@ -540,9 +536,9 @@ namespace swrenderer
|
|||
}
|
||||
}
|
||||
|
||||
void RenderWallPart::Render(const DrawerStyle &drawerstyle, sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *pic, int x1, int x2, const short *walltop, const short *wallbottom, double texturemid, float *swall, fixed_t *lwall, double yscale, double top, double bottom, bool mask, int wallshade, fixed_t xoffset, float light, float lightstep, FLightNode *light_list, bool foggy, FDynamicColormap *basecolormap)
|
||||
void RenderWallPart::Render(const DrawerArgs &drawerargs, sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *pic, int x1, int x2, const short *walltop, const short *wallbottom, double texturemid, float *swall, fixed_t *lwall, double yscale, double top, double bottom, bool mask, int wallshade, fixed_t xoffset, float light, float lightstep, FLightNode *light_list, bool foggy, FDynamicColormap *basecolormap)
|
||||
{
|
||||
this->drawerstyle = drawerstyle;
|
||||
this->drawerargs = drawerargs;
|
||||
this->x1 = x1;
|
||||
this->x2 = x2;
|
||||
this->frontsector = frontsector;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "swrenderer/drawers/r_draw.h"
|
||||
#include "swrenderer/drawers/r_drawerargs.h"
|
||||
#include "r_line.h"
|
||||
|
||||
class FTexture;
|
||||
|
@ -34,7 +34,7 @@ namespace swrenderer
|
|||
{
|
||||
public:
|
||||
void Render(
|
||||
const DrawerStyle &drawerstyle,
|
||||
const DrawerArgs &drawerargs,
|
||||
sector_t *frontsector,
|
||||
seg_t *curline,
|
||||
const FWallCoords &WallC,
|
||||
|
@ -85,7 +85,7 @@ namespace swrenderer
|
|||
FLightNode *light_list = nullptr;
|
||||
bool mask = false;
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
};
|
||||
|
||||
struct WallSampler
|
||||
|
|
|
@ -46,21 +46,20 @@ namespace swrenderer
|
|||
{
|
||||
void RenderFlatPlane::Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *colormap, FTexture *texture)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (alpha <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
drawerstyle.SetSpanTexture(texture);
|
||||
drawerargs.ds_color = 3;
|
||||
drawerargs.SetSpanTexture(texture);
|
||||
|
||||
double planeang = (pl->xform.Angle + pl->xform.baseAngle).Radians();
|
||||
double xstep, ystep, leftxfrac, leftyfrac, rightxfrac, rightyfrac;
|
||||
double x;
|
||||
|
||||
xscale = xs_ToFixed(32 - ds_xbits, _xscale);
|
||||
yscale = xs_ToFixed(32 - ds_ybits, _yscale);
|
||||
xscale = xs_ToFixed(32 - drawerargs.ds_xbits, _xscale);
|
||||
yscale = xs_ToFixed(32 - drawerargs.ds_ybits, _yscale);
|
||||
if (planeang != 0)
|
||||
{
|
||||
double cosine = cos(planeang), sine = sin(planeang);
|
||||
|
@ -109,16 +108,16 @@ namespace swrenderer
|
|||
|
||||
basecolormap = colormap;
|
||||
GlobVis = LightVisibility::Instance()->FlatPlaneGlobVis() / planeheight;
|
||||
ds_light = 0;
|
||||
drawerargs.ds_light = 0;
|
||||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
if (cameraLight->fixedlightlev >= 0)
|
||||
{
|
||||
drawerstyle.SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
drawerargs.SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
plane_shade = false;
|
||||
}
|
||||
else if (cameraLight->fixedcolormap)
|
||||
{
|
||||
drawerstyle.SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
plane_shade = false;
|
||||
}
|
||||
else
|
||||
|
@ -127,7 +126,7 @@ namespace swrenderer
|
|||
planeshade = LIGHT2SHADE(pl->lightlevel);
|
||||
}
|
||||
|
||||
drawerstyle.SetSpanStyle(masked, additive, alpha);
|
||||
drawerargs.SetSpanStyle(masked, additive, alpha);
|
||||
|
||||
light_list = pl->lights;
|
||||
|
||||
|
@ -136,8 +135,6 @@ namespace swrenderer
|
|||
|
||||
void RenderFlatPlane::RenderLine(int y, int x1, int x2)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
double distance;
|
||||
|
||||
#ifdef RANGECHECK
|
||||
|
@ -152,25 +149,25 @@ namespace swrenderer
|
|||
|
||||
distance = planeheight * yslope[y];
|
||||
|
||||
if (ds_xbits != 0)
|
||||
if (drawerargs.ds_xbits != 0)
|
||||
{
|
||||
ds_xstep = xs_ToFixed(32 - ds_xbits, distance * xstepscale);
|
||||
ds_xfrac = xs_ToFixed(32 - ds_xbits, distance * basexfrac) + pviewx;
|
||||
drawerargs.ds_xstep = xs_ToFixed(32 - drawerargs.ds_xbits, distance * xstepscale);
|
||||
drawerargs.ds_xfrac = xs_ToFixed(32 - drawerargs.ds_xbits, distance * basexfrac) + pviewx;
|
||||
}
|
||||
else
|
||||
{
|
||||
ds_xstep = 0;
|
||||
ds_xfrac = 0;
|
||||
drawerargs.ds_xstep = 0;
|
||||
drawerargs.ds_xfrac = 0;
|
||||
}
|
||||
if (ds_ybits != 0)
|
||||
if (drawerargs.ds_ybits != 0)
|
||||
{
|
||||
ds_ystep = xs_ToFixed(32 - ds_ybits, distance * ystepscale);
|
||||
ds_yfrac = xs_ToFixed(32 - ds_ybits, distance * baseyfrac) + pviewy;
|
||||
drawerargs.ds_ystep = xs_ToFixed(32 - drawerargs.ds_ybits, distance * ystepscale);
|
||||
drawerargs.ds_yfrac = xs_ToFixed(32 - drawerargs.ds_ybits, distance * baseyfrac) + pviewy;
|
||||
}
|
||||
else
|
||||
{
|
||||
ds_ystep = 0;
|
||||
ds_yfrac = 0;
|
||||
drawerargs.ds_ystep = 0;
|
||||
drawerargs.ds_yfrac = 0;
|
||||
}
|
||||
|
||||
if (r_swtruecolor)
|
||||
|
@ -180,35 +177,35 @@ namespace swrenderer
|
|||
double ymagnitude = fabs(xstepscale * (distance2 - distance) * FocalLengthX);
|
||||
double magnitude = MAX(ymagnitude, xmagnitude);
|
||||
double min_lod = -1000.0;
|
||||
ds_lod = MAX(log2(magnitude) + r_lod_bias, min_lod);
|
||||
drawerargs.ds_lod = MAX(log2(magnitude) + r_lod_bias, min_lod);
|
||||
}
|
||||
|
||||
if (plane_shade)
|
||||
{
|
||||
// Determine lighting based on the span's distance from the viewer.
|
||||
drawerstyle.SetDSColorMapLight(basecolormap, (float)(GlobVis * fabs(CenterY - y)), planeshade);
|
||||
drawerargs.SetDSColorMapLight(basecolormap, (float)(GlobVis * fabs(CenterY - y)), planeshade);
|
||||
}
|
||||
|
||||
if (r_dynlights)
|
||||
{
|
||||
// Find row position in view space
|
||||
float zspan = (float)(planeheight / (fabs(y + 0.5 - CenterY) / InvZtoScale));
|
||||
dc_viewpos.X = (float)((x1 + 0.5 - CenterX) / CenterX * zspan);
|
||||
dc_viewpos.Y = zspan;
|
||||
dc_viewpos.Z = (float)((CenterY - y - 0.5) / InvZtoScale * zspan);
|
||||
dc_viewpos_step.X = (float)(zspan / CenterX);
|
||||
drawerargs.dc_viewpos.X = (float)((x1 + 0.5 - CenterX) / CenterX * zspan);
|
||||
drawerargs.dc_viewpos.Y = zspan;
|
||||
drawerargs.dc_viewpos.Z = (float)((CenterY - y - 0.5) / InvZtoScale * zspan);
|
||||
drawerargs.dc_viewpos_step.X = (float)(zspan / CenterX);
|
||||
|
||||
static TriLight lightbuffer[64 * 1024];
|
||||
static int nextlightindex = 0;
|
||||
|
||||
// Plane normal
|
||||
dc_normal.X = 0.0f;
|
||||
dc_normal.Y = 0.0f;
|
||||
dc_normal.Z = (y >= CenterY) ? 1.0f : -1.0f;
|
||||
drawerargs.dc_normal.X = 0.0f;
|
||||
drawerargs.dc_normal.Y = 0.0f;
|
||||
drawerargs.dc_normal.Z = (y >= CenterY) ? 1.0f : -1.0f;
|
||||
|
||||
// Setup lights for row
|
||||
dc_num_lights = 0;
|
||||
dc_lights = lightbuffer + nextlightindex;
|
||||
drawerargs.dc_num_lights = 0;
|
||||
drawerargs.dc_lights = lightbuffer + nextlightindex;
|
||||
VisiblePlaneLight *cur_node = light_list;
|
||||
while (cur_node && nextlightindex < 64 * 1024)
|
||||
{
|
||||
|
@ -217,13 +214,13 @@ namespace swrenderer
|
|||
double lightZ = cur_node->lightsource->Z() - ViewPos.Z;
|
||||
|
||||
float lx = (float)(lightX * ViewSin - lightY * ViewCos);
|
||||
float ly = (float)(lightX * ViewTanCos + lightY * ViewTanSin) - dc_viewpos.Y;
|
||||
float lz = (float)lightZ - dc_viewpos.Z;
|
||||
float ly = (float)(lightX * ViewTanCos + lightY * ViewTanSin) - drawerargs.dc_viewpos.Y;
|
||||
float lz = (float)lightZ - drawerargs.dc_viewpos.Z;
|
||||
|
||||
// Precalculate the constant part of the dot here so the drawer doesn't have to.
|
||||
bool is_point_light = (cur_node->lightsource->flags4 & MF4_ATTENUATE) != 0;
|
||||
float lconstant = ly * ly + lz * lz;
|
||||
float nlconstant = is_point_light ? lz * dc_normal.Z : 0.0f;
|
||||
float nlconstant = is_point_light ? lz * drawerargs.dc_normal.Z : 0.0f;
|
||||
|
||||
// Include light only if it touches this row
|
||||
float radius = cur_node->lightsource->GetRadius();
|
||||
|
@ -234,7 +231,7 @@ namespace swrenderer
|
|||
uint32_t blue = cur_node->lightsource->GetBlue();
|
||||
|
||||
nextlightindex++;
|
||||
auto &light = dc_lights[dc_num_lights++];
|
||||
auto &light = drawerargs.dc_lights[drawerargs.dc_num_lights++];
|
||||
light.x = lx;
|
||||
light.y = lconstant;
|
||||
light.z = nlconstant;
|
||||
|
@ -250,14 +247,14 @@ namespace swrenderer
|
|||
}
|
||||
else
|
||||
{
|
||||
dc_num_lights = 0;
|
||||
drawerargs.dc_num_lights = 0;
|
||||
}
|
||||
|
||||
ds_y = y;
|
||||
ds_x1 = x1;
|
||||
ds_x2 = x2;
|
||||
drawerargs.ds_y = y;
|
||||
drawerargs.ds_x1 = x1;
|
||||
drawerargs.ds_x2 = x2;
|
||||
|
||||
(drawerstyle.Drawers()->*drawerstyle.spanfunc)();
|
||||
(drawerargs.Drawers()->*drawerargs.spanfunc)(drawerargs);
|
||||
}
|
||||
|
||||
void RenderFlatPlane::StepColumn()
|
||||
|
@ -319,6 +316,6 @@ namespace swrenderer
|
|||
|
||||
void RenderColoredPlane::RenderLine(int y, int x1, int x2)
|
||||
{
|
||||
drawerstyle.DrawColoredSpan(y, x1, x2);
|
||||
drawerargs.DrawColoredSpan(y, x1, x2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "r_planerenderer.h"
|
||||
#include "swrenderer/drawers/r_draw.h"
|
||||
#include "swrenderer/drawers/r_drawerargs.h"
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ namespace swrenderer
|
|||
double basexfrac, baseyfrac;
|
||||
VisiblePlaneLight *light_list;
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
|
||||
static float yslope[MAXHEIGHT];
|
||||
};
|
||||
|
@ -55,6 +55,6 @@ namespace swrenderer
|
|||
private:
|
||||
void RenderLine(int y, int x1, int x2) override;
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -151,13 +151,13 @@ namespace swrenderer
|
|||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
if (cameraLight->fixedcolormap)
|
||||
{
|
||||
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
fakefixed = true;
|
||||
cameraLight->fixedcolormap = &NormalLight;
|
||||
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
}
|
||||
|
||||
DrawSky(pl);
|
||||
|
@ -168,8 +168,6 @@ namespace swrenderer
|
|||
|
||||
void RenderSkyPlane::DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, double scale, double texturemid, double yrepeat)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
RenderPortal *renderportal = RenderPortal::Instance();
|
||||
|
||||
uint32_t height = frontskytex->GetHeight();
|
||||
|
@ -203,24 +201,24 @@ namespace swrenderer
|
|||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
dc_wall_source[i] = (const uint8_t *)frontskytex->GetColumnBgra(angle1, nullptr);
|
||||
dc_wall_source2[i] = backskytex ? (const uint8_t *)backskytex->GetColumnBgra(angle2, nullptr) : nullptr;
|
||||
drawerargs.dc_wall_source[i] = (const uint8_t *)frontskytex->GetColumnBgra(angle1, nullptr);
|
||||
drawerargs.dc_wall_source2[i] = backskytex ? (const uint8_t *)backskytex->GetColumnBgra(angle2, nullptr) : nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc_wall_source[i] = (const uint8_t *)frontskytex->GetColumn(angle1, nullptr);
|
||||
dc_wall_source2[i] = backskytex ? (const uint8_t *)backskytex->GetColumn(angle2, nullptr) : nullptr;
|
||||
drawerargs.dc_wall_source[i] = (const uint8_t *)frontskytex->GetColumn(angle1, nullptr);
|
||||
drawerargs.dc_wall_source2[i] = backskytex ? (const uint8_t *)backskytex->GetColumn(angle2, nullptr) : nullptr;
|
||||
}
|
||||
|
||||
dc_wall_iscale[i] = uv_step;
|
||||
dc_wall_texturefrac[i] = uv_pos;
|
||||
drawerargs.dc_wall_iscale[i] = uv_step;
|
||||
drawerargs.dc_wall_texturefrac[i] = uv_pos;
|
||||
}
|
||||
|
||||
dc_wall_sourceheight[0] = height;
|
||||
dc_wall_sourceheight[1] = backskytex ? backskytex->GetHeight() : height;
|
||||
drawerargs.dc_wall_sourceheight[0] = height;
|
||||
drawerargs.dc_wall_sourceheight[1] = backskytex ? backskytex->GetHeight() : height;
|
||||
int pixelsize = r_swtruecolor ? 4 : 1;
|
||||
dc_dest = (ylookup[y1] + start_x) * pixelsize + dc_destorg;
|
||||
dc_count = y2 - y1;
|
||||
drawerargs.SetDest(start_x, y1);
|
||||
drawerargs.dc_count = y2 - y1;
|
||||
|
||||
uint32_t solid_top = frontskytex->GetSkyCapColor(false);
|
||||
uint32_t solid_bottom = frontskytex->GetSkyCapColor(true);
|
||||
|
@ -228,9 +226,9 @@ namespace swrenderer
|
|||
bool fadeSky = (r_skymode == 2 && !(level.flags & LEVEL_FORCETILEDSKY));
|
||||
|
||||
if (!backskytex)
|
||||
drawerstyle.DrawSingleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||
drawerargs.DrawSingleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||
else
|
||||
drawerstyle.DrawDoubleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||
drawerargs.DrawDoubleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||
}
|
||||
|
||||
void RenderSkyPlane::DrawSkyColumn(int start_x, int y1, int y2, int columns)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "r_visibleplane.h"
|
||||
#include "swrenderer/drawers/r_draw.h"
|
||||
#include "swrenderer/drawers/r_drawerargs.h"
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
@ -38,6 +38,6 @@ namespace swrenderer
|
|||
double skymid = 0.0;
|
||||
angle_t skyangle = 0;
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -50,8 +50,6 @@ namespace swrenderer
|
|||
{
|
||||
void RenderSlopePlane::Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *colormap, FTexture *texture)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
static const float ifloatpow2[16] =
|
||||
{
|
||||
// ifloatpow2[i] = 1 / (1 << i)
|
||||
|
@ -72,16 +70,17 @@ namespace swrenderer
|
|||
return;
|
||||
}
|
||||
|
||||
drawerstyle.SetSpanTexture(texture);
|
||||
drawerargs.ds_color = 3;
|
||||
drawerargs.SetSpanTexture(texture);
|
||||
|
||||
lxscale = _xscale * ifloatpow2[ds_xbits];
|
||||
lyscale = _yscale * ifloatpow2[ds_ybits];
|
||||
lxscale = _xscale * ifloatpow2[drawerargs.ds_xbits];
|
||||
lyscale = _yscale * ifloatpow2[drawerargs.ds_ybits];
|
||||
xscale = 64.f / lxscale;
|
||||
yscale = 64.f / lyscale;
|
||||
zeroheight = pl->height.ZatPoint(ViewPos);
|
||||
|
||||
pviewx = xs_ToFixed(32 - ds_xbits, pl->xform.xOffs * pl->xform.xScale);
|
||||
pviewy = xs_ToFixed(32 - ds_ybits, pl->xform.yOffs * pl->xform.yScale);
|
||||
pviewx = xs_ToFixed(32 - drawerargs.ds_xbits, pl->xform.xOffs * pl->xform.xScale);
|
||||
pviewy = xs_ToFixed(32 - drawerargs.ds_ybits, pl->xform.yOffs * pl->xform.yScale);
|
||||
planeang = (pl->xform.Angle + pl->xform.baseAngle).Radians();
|
||||
|
||||
// p is the texture origin in view space
|
||||
|
@ -155,27 +154,27 @@ namespace swrenderer
|
|||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
if (cameraLight->fixedlightlev >= 0)
|
||||
{
|
||||
drawerstyle.SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
drawerargs.SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
plane_shade = false;
|
||||
}
|
||||
else if (cameraLight->fixedcolormap)
|
||||
{
|
||||
drawerstyle.SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
plane_shade = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawerstyle.SetDSColorMapLight(basecolormap, 0, 0);
|
||||
drawerargs.SetDSColorMapLight(basecolormap, 0, 0);
|
||||
plane_shade = true;
|
||||
planeshade = LIGHT2SHADE(pl->lightlevel);
|
||||
}
|
||||
|
||||
// Hack in support for 1 x Z and Z x 1 texture sizes
|
||||
if (ds_ybits == 0)
|
||||
if (drawerargs.ds_ybits == 0)
|
||||
{
|
||||
plane_sv[2] = plane_sv[1] = plane_sv[0] = 0;
|
||||
}
|
||||
if (ds_xbits == 0)
|
||||
if (drawerargs.ds_xbits == 0)
|
||||
{
|
||||
plane_su[2] = plane_su[1] = plane_su[0] = 0;
|
||||
}
|
||||
|
@ -185,6 +184,6 @@ namespace swrenderer
|
|||
|
||||
void RenderSlopePlane::RenderLine(int y, int x1, int x2)
|
||||
{
|
||||
drawerstyle.DrawTiltedSpan(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
||||
drawerargs.DrawTiltedSpan(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "r_planerenderer.h"
|
||||
#include "swrenderer/drawers/r_draw.h"
|
||||
#include "swrenderer/drawers/r_drawerargs.h"
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
@ -33,6 +33,6 @@ namespace swrenderer
|
|||
fixed_t pviewx, pviewy;
|
||||
fixed_t xscale, yscale;
|
||||
FDynamicColormap *basecolormap;
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -326,8 +326,6 @@ namespace swrenderer
|
|||
int i;
|
||||
int vpcount = 0;
|
||||
|
||||
drawerargs::ds_color = 3;
|
||||
|
||||
RenderPortal *renderportal = RenderPortal::Instance();
|
||||
|
||||
for (i = 0; i < MAXVISPLANES; i++)
|
||||
|
@ -352,8 +350,6 @@ namespace swrenderer
|
|||
VisiblePlane *pl;
|
||||
int i;
|
||||
|
||||
drawerargs::ds_color = 3;
|
||||
|
||||
DVector3 oViewPos = ViewPos;
|
||||
DAngle oViewAngle = ViewAngle;
|
||||
|
||||
|
|
|
@ -55,6 +55,10 @@ namespace swrenderer
|
|||
|
||||
double WallTMapScale2;
|
||||
|
||||
uint8_t *dc_destorg;
|
||||
int dc_destheight;
|
||||
int dc_pitch;
|
||||
|
||||
// The xtoviewangleangle[] table maps a screen pixel
|
||||
// to the lowest viewangle that maps back to x ranges
|
||||
// from clipangle to -clipangle.
|
||||
|
@ -148,8 +152,6 @@ namespace swrenderer
|
|||
|
||||
void RenderViewport::SetupBuffer()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
static BYTE *lastbuff = NULL;
|
||||
|
||||
int pitch = RenderTarget->GetPitch();
|
||||
|
|
|
@ -34,6 +34,10 @@ namespace swrenderer
|
|||
extern double globaldclip;
|
||||
extern angle_t xtoviewangle[MAXWIDTH + 1];
|
||||
|
||||
extern uint8_t *dc_destorg;
|
||||
extern int dc_destheight;
|
||||
extern int dc_pitch;
|
||||
|
||||
class RenderViewport
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -274,18 +274,18 @@ namespace swrenderer
|
|||
{
|
||||
int x = x1;
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
|
||||
if (cameraLight->fixedlightlev >= 0)
|
||||
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
else if (cameraLight->fixedcolormap != NULL)
|
||||
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
|
||||
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
|
||||
else
|
||||
calclighting = true;
|
||||
|
||||
bool visible = drawerstyle.SetPatchStyle(decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor, basecolormap);
|
||||
bool visible = drawerargs.SetPatchStyle(decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor, basecolormap);
|
||||
|
||||
// R_SetPatchStyle can modify basecolormap.
|
||||
if (rereadcolormap)
|
||||
|
@ -299,9 +299,9 @@ namespace swrenderer
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
drawerstyle.SetColorMapLight(usecolormap, light, wallshade);
|
||||
drawerargs.SetColorMapLight(usecolormap, light, wallshade);
|
||||
}
|
||||
DrawColumn(drawerstyle, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||
DrawColumn(drawerargs, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||
light += lightstep;
|
||||
x++;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ namespace swrenderer
|
|||
} while (needrepeat--);
|
||||
}
|
||||
|
||||
void RenderDecal::DrawColumn(DrawerStyle &drawerstyle, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
||||
void RenderDecal::DrawColumn(DrawerArgs &drawerargs, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
||||
{
|
||||
float iscale = walltexcoords.VStep[x] * maskedScaleY;
|
||||
double spryscale = 1 / iscale;
|
||||
|
@ -325,6 +325,6 @@ namespace swrenderer
|
|||
else
|
||||
sprtopscreen = CenterY - texturemid * spryscale;
|
||||
|
||||
drawerstyle.DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, walltexcoords.UPos[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
||||
drawerargs.DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, walltexcoords.UPos[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace swrenderer
|
|||
{
|
||||
struct DrawSegment;
|
||||
class ProjectedWallTexcoords;
|
||||
class DrawerStyle;
|
||||
class DrawerArgs;
|
||||
|
||||
class RenderDecal
|
||||
{
|
||||
|
@ -29,6 +29,6 @@ namespace swrenderer
|
|||
|
||||
private:
|
||||
static void Render(side_t *wall, DBaseDecal *first, DrawSegment *clipper, int wallshade, float lightleft, float lightstep, seg_t *curline, const FWallCoords &wallC, bool foggy, FDynamicColormap *basecolormap, const short *walltop, const short *wallbottom, int pass);
|
||||
static void DrawColumn(DrawerStyle &drawerstyle, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||
static void DrawColumn(DrawerArgs &drawerargs, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -208,8 +208,6 @@ namespace swrenderer
|
|||
|
||||
void RenderParticle::Render(short *cliptop, short *clipbottom, int minZ, int maxZ)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
auto vis = this;
|
||||
|
||||
int spacing;
|
||||
|
|
|
@ -587,12 +587,12 @@ namespace swrenderer
|
|||
return;
|
||||
}
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
drawerstyle.SetColorMapLight(Light.BaseColormap, 0, Light.ColormapNum << FRACBITS);
|
||||
DrawerArgs drawerargs;
|
||||
drawerargs.SetColorMapLight(Light.BaseColormap, 0, Light.ColormapNum << FRACBITS);
|
||||
|
||||
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(Light.BaseColormap);
|
||||
|
||||
bool visible = drawerstyle.SetPatchStyle(RenderStyle, Alpha, Translation, FillColor, basecolormap, Light.ColormapNum << FRACBITS);
|
||||
bool visible = drawerargs.SetPatchStyle(RenderStyle, Alpha, Translation, FillColor, basecolormap, Light.ColormapNum << FRACBITS);
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
|
@ -621,7 +621,7 @@ namespace swrenderer
|
|||
fixed_t frac = startfrac;
|
||||
for (int x = x1; x < x2; x++)
|
||||
{
|
||||
drawerstyle.DrawMaskedColumn(x, iscale, pic, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false);
|
||||
drawerargs.DrawMaskedColumn(x, iscale, pic, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false);
|
||||
frac += xiscale;
|
||||
}
|
||||
|
||||
|
|
|
@ -245,12 +245,12 @@ namespace swrenderer
|
|||
return;
|
||||
}
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
drawerstyle.SetColorMapLight(vis->Light.BaseColormap, 0, vis->Light.ColormapNum << FRACBITS);
|
||||
DrawerArgs drawerargs;
|
||||
drawerargs.SetColorMapLight(vis->Light.BaseColormap, 0, vis->Light.ColormapNum << FRACBITS);
|
||||
|
||||
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(vis->Light.BaseColormap);
|
||||
|
||||
bool visible = drawerstyle.SetPatchStyle(vis->RenderStyle, vis->Alpha, vis->Translation, vis->FillColor, basecolormap, vis->Light.ColormapNum << FRACBITS);
|
||||
bool visible = drawerargs.SetPatchStyle(vis->RenderStyle, vis->Alpha, vis->Translation, vis->FillColor, basecolormap, vis->Light.ColormapNum << FRACBITS);
|
||||
|
||||
if (visible)
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ namespace swrenderer
|
|||
while (x < x2)
|
||||
{
|
||||
if (!translucentPass->ClipSpriteColumnWithPortals(x, vis))
|
||||
drawerstyle.DrawMaskedColumn(x, iscale, tex, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false);
|
||||
drawerargs.DrawMaskedColumn(x, iscale, tex, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false);
|
||||
x++;
|
||||
frac += xiscale;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "po_man.h"
|
||||
#include "r_utility.h"
|
||||
#include "swrenderer/drawers/r_draw.h"
|
||||
#include "swrenderer/drawers/r_drawerargs.h"
|
||||
#include "swrenderer/drawers/r_thread.h"
|
||||
#include "swrenderer/things/r_visiblesprite.h"
|
||||
#include "swrenderer/things/r_voxel.h"
|
||||
|
@ -186,10 +187,10 @@ namespace swrenderer
|
|||
|
||||
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(sprite->Light.BaseColormap);
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
drawerstyle.SetColorMapLight(sprite->Light.BaseColormap, 0, sprite->Light.ColormapNum << FRACBITS);
|
||||
DrawerArgs drawerargs;
|
||||
drawerargs.SetColorMapLight(sprite->Light.BaseColormap, 0, sprite->Light.ColormapNum << FRACBITS);
|
||||
|
||||
bool visible = drawerstyle.SetPatchStyle(sprite->RenderStyle, sprite->Alpha, sprite->Translation, sprite->FillColor, basecolormap);
|
||||
bool visible = drawerargs.SetPatchStyle(sprite->RenderStyle, sprite->Alpha, sprite->Translation, sprite->FillColor, basecolormap);
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
|
@ -287,7 +288,7 @@ namespace swrenderer
|
|||
voxel_pos.Y += dirY.X * x + dirY.Y * y;
|
||||
voxel_pos.Z += dirZ * z;
|
||||
|
||||
FillBox(drawerstyle, voxel_pos, sprite_xscale, sprite_yscale, color, cliptop, clipbottom, false, false);
|
||||
FillBox(drawerargs, voxel_pos, sprite_xscale, sprite_yscale, color, cliptop, clipbottom, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -310,7 +311,7 @@ namespace swrenderer
|
|||
return (kvxslab_t*)(((uint8_t*)slab) + 3 + slab->zleng);
|
||||
}
|
||||
|
||||
void RenderVoxel::FillBox(DrawerStyle &drawerstyle, DVector3 origin, double extentX, double extentY, int color, short *cliptop, short *clipbottom, bool viewspace, bool pixelstretch)
|
||||
void RenderVoxel::FillBox(DrawerArgs &drawerargs, DVector3 origin, double extentX, double extentY, int color, short *cliptop, short *clipbottom, bool viewspace, bool pixelstretch)
|
||||
{
|
||||
double viewX, viewY, viewZ;
|
||||
if (viewspace)
|
||||
|
@ -352,11 +353,10 @@ namespace swrenderer
|
|||
int columnY2 = MIN(y2, (int)clipbottom[x]);
|
||||
if (columnY1 < columnY2)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
dc_dest = dc_destorg + (dc_pitch * columnY1 + x) * pixelsize;
|
||||
dc_color = color;
|
||||
dc_count = columnY2 - columnY1;
|
||||
drawerstyle.FillColumn();
|
||||
drawerargs.SetDest(x, columnY1);
|
||||
drawerargs.dc_color = color;
|
||||
drawerargs.dc_count = columnY2 - columnY1;
|
||||
drawerargs.FillColumn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ struct FVoxel;
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
class DrawerStyle;
|
||||
class DrawerArgs;
|
||||
|
||||
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans.
|
||||
struct FCoverageBuffer
|
||||
|
@ -83,7 +83,7 @@ namespace swrenderer
|
|||
|
||||
enum { DVF_OFFSCREEN = 1, DVF_SPANSONLY = 2, DVF_MIRRORED = 4 };
|
||||
|
||||
static void FillBox(DrawerStyle &drawerstyle, DVector3 origin, double extentX, double extentY, int color, short *cliptop, short *clipbottom, bool viewspace, bool pixelstretch);
|
||||
static void FillBox(DrawerArgs &drawerargs, DVector3 origin, double extentX, double extentY, int color, short *cliptop, short *clipbottom, bool viewspace, bool pixelstretch);
|
||||
|
||||
static kvxslab_t *GetSlabStart(const FVoxelMipLevel &mip, int x, int y);
|
||||
static kvxslab_t *GetSlabEnd(const FVoxelMipLevel &mip, int x, int y);
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace swrenderer
|
|||
rereadcolormap = false;
|
||||
}
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
|
||||
int shade = LIGHT2SHADE(spr->sector->lightlevel + R_ActualExtraLight(spr->foggy));
|
||||
double GlobVis = LightVisibility::Instance()->WallGlobVis();
|
||||
|
@ -188,11 +188,11 @@ namespace swrenderer
|
|||
float light = lightleft + (x1 - spr->wallc.sx1) * lightstep;
|
||||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
if (cameraLight->fixedlightlev >= 0)
|
||||
drawerstyle.SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
drawerargs.SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||
else if (cameraLight->fixedcolormap != NULL)
|
||||
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||
else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||
drawerstyle.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
|
||||
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
|
||||
else
|
||||
calclighting = true;
|
||||
|
||||
|
@ -215,7 +215,7 @@ namespace swrenderer
|
|||
|
||||
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(spr->Light.BaseColormap);
|
||||
|
||||
bool visible = drawerstyle.SetPatchStyle(spr->RenderStyle, spr->Alpha, spr->Translation, spr->FillColor, basecolormap);
|
||||
bool visible = drawerargs.SetPatchStyle(spr->RenderStyle, spr->Alpha, spr->Translation, spr->FillColor, basecolormap);
|
||||
|
||||
// R_SetPatchStyle can modify basecolormap.
|
||||
if (rereadcolormap)
|
||||
|
@ -235,17 +235,17 @@ namespace swrenderer
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
drawerstyle.SetColorMapLight(usecolormap, light, shade);
|
||||
drawerargs.SetColorMapLight(usecolormap, light, shade);
|
||||
}
|
||||
if (!translucentPass->ClipSpriteColumnWithPortals(x, spr))
|
||||
DrawColumn(drawerstyle, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||
DrawColumn(drawerargs, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||
light += lightstep;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderWallSprite::DrawColumn(DrawerStyle &drawerstyle, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
||||
void RenderWallSprite::DrawColumn(DrawerArgs &drawerargs, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
||||
{
|
||||
float iscale = walltexcoords.VStep[x] * maskedScaleY;
|
||||
double spryscale = 1 / iscale;
|
||||
|
@ -255,6 +255,6 @@ namespace swrenderer
|
|||
else
|
||||
sprtopscreen = CenterY - texturemid * spryscale;
|
||||
|
||||
drawerstyle.DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, walltexcoords.UPos[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
||||
drawerargs.DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, walltexcoords.UPos[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
namespace swrenderer
|
||||
{
|
||||
class ProjectedWallTexcoords;
|
||||
class DrawerStyle;
|
||||
class DrawerArgs;
|
||||
|
||||
class RenderWallSprite : public VisibleSprite
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace swrenderer
|
|||
void Render(short *cliptop, short *clipbottom, int minZ, int maxZ) override;
|
||||
|
||||
private:
|
||||
static void DrawColumn(DrawerStyle &drawerstyle, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||
static void DrawColumn(DrawerArgs &drawerargs, int x, FTexture *WallSpriteTile, const ProjectedWallTexcoords &walltexcoords, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||
|
||||
FWallCoords wallc;
|
||||
uint32_t Translation = 0;
|
||||
|
|
|
@ -143,7 +143,6 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
|||
{
|
||||
#ifndef NO_SWRENDER
|
||||
using namespace swrenderer;
|
||||
using namespace drawerargs;
|
||||
|
||||
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
|
||||
const BYTE *translation = NULL;
|
||||
|
@ -185,26 +184,26 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
|||
translation = parms.remap->Remap;
|
||||
}
|
||||
|
||||
DrawerStyle drawerstyle;
|
||||
DrawerArgs drawerargs;
|
||||
|
||||
if (translation != NULL)
|
||||
{
|
||||
drawerstyle.SetTranslationMap((lighttable_t *)translation);
|
||||
drawerargs.SetTranslationMap((lighttable_t *)translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
drawerstyle.SetTranslationMap(nullptr);
|
||||
drawerargs.SetTranslationMap(nullptr);
|
||||
else
|
||||
drawerstyle.SetTranslationMap(identitymap);
|
||||
drawerargs.SetTranslationMap(identitymap);
|
||||
}
|
||||
|
||||
bool visible;
|
||||
FDynamicColormap *basecolormap = nullptr;
|
||||
if (r_swtruecolor)
|
||||
visible = drawerstyle.SetPatchStyle(parms.style, parms.Alpha, -1, parms.fillcolor, basecolormap);
|
||||
visible = drawerargs.SetPatchStyle(parms.style, parms.Alpha, -1, parms.fillcolor, basecolormap);
|
||||
else
|
||||
visible = drawerstyle.SetPatchStyle(parms.style, parms.Alpha, 0, parms.fillcolor, basecolormap);
|
||||
visible = drawerargs.SetPatchStyle(parms.style, parms.Alpha, 0, parms.fillcolor, basecolormap);
|
||||
|
||||
BYTE *destorgsave = dc_destorg;
|
||||
int destheightsave = dc_destheight;
|
||||
|
@ -292,7 +291,7 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
|||
|
||||
while (x < x2_i)
|
||||
{
|
||||
drawerstyle.DrawMaskedColumn(x, iscale, img, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, !parms.masked);
|
||||
drawerargs.DrawMaskedColumn(x, iscale, img, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, !parms.masked);
|
||||
x++;
|
||||
frac += xiscale_i;
|
||||
}
|
||||
|
@ -1322,7 +1321,6 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
{
|
||||
#ifndef NO_SWRENDER
|
||||
using namespace swrenderer;
|
||||
using namespace drawerargs;
|
||||
|
||||
// Use an equation similar to player sprites to determine shade
|
||||
fixed_t shade = LIGHT2SHADE(lightlevel) - 12*FRACUNIT;
|
||||
|
@ -1389,31 +1387,31 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
sinrot = sin(rotation.Radians());
|
||||
|
||||
// Setup constant texture mapping parameters.
|
||||
DrawerStyle drawerstyle;
|
||||
drawerstyle.SetSpanTexture(tex);
|
||||
DrawerArgs drawerargs;
|
||||
drawerargs.SetSpanTexture(tex);
|
||||
if (colormap)
|
||||
drawerstyle.SetSpanColormap(colormap, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1));
|
||||
drawerargs.SetSpanColormap(colormap, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1));
|
||||
else
|
||||
drawerstyle.SetSpanColormap(&identitycolormap, 0);
|
||||
if (ds_xbits != 0)
|
||||
drawerargs.SetSpanColormap(&identitycolormap, 0);
|
||||
if (drawerargs.ds_xbits != 0)
|
||||
{
|
||||
scalex = double(1u << (32 - ds_xbits)) / scalex;
|
||||
ds_xstep = xs_RoundToInt(cosrot * scalex);
|
||||
scalex = double(1u << (32 - drawerargs.ds_xbits)) / scalex;
|
||||
drawerargs.ds_xstep = xs_RoundToInt(cosrot * scalex);
|
||||
}
|
||||
else
|
||||
{ // Texture is one pixel wide.
|
||||
scalex = 0;
|
||||
ds_xstep = 0;
|
||||
drawerargs.ds_xstep = 0;
|
||||
}
|
||||
if (ds_ybits != 0)
|
||||
if (drawerargs.ds_ybits != 0)
|
||||
{
|
||||
scaley = double(1u << (32 - ds_ybits)) / scaley;
|
||||
ds_ystep = xs_RoundToInt(sinrot * scaley);
|
||||
scaley = double(1u << (32 - drawerargs.ds_ybits)) / scaley;
|
||||
drawerargs.ds_ystep = xs_RoundToInt(sinrot * scaley);
|
||||
}
|
||||
else
|
||||
{ // Texture is one pixel tall.
|
||||
scaley = 0;
|
||||
ds_ystep = 0;
|
||||
drawerargs.ds_ystep = 0;
|
||||
}
|
||||
|
||||
// Travel down the right edge and create an outline of that edge.
|
||||
|
@ -1479,9 +1477,9 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
#if 0
|
||||
memset(this->Buffer + y * this->Pitch + x1, (int)tex, x2 - x1);
|
||||
#else
|
||||
ds_y = y;
|
||||
ds_x1 = x1;
|
||||
ds_x2 = x2 - 1;
|
||||
drawerargs.ds_y = y;
|
||||
drawerargs.ds_x1 = x1;
|
||||
drawerargs.ds_x2 = x2 - 1;
|
||||
|
||||
DVector2 tex(x1 - originx, y - originy);
|
||||
if (dorotate)
|
||||
|
@ -1490,10 +1488,10 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
tex.X = t * cosrot - tex.Y * sinrot;
|
||||
tex.Y = tex.Y * cosrot + t * sinrot;
|
||||
}
|
||||
ds_xfrac = xs_RoundToInt(tex.X * scalex);
|
||||
ds_yfrac = xs_RoundToInt(tex.Y * scaley);
|
||||
drawerargs.ds_xfrac = xs_RoundToInt(tex.X * scalex);
|
||||
drawerargs.ds_yfrac = xs_RoundToInt(tex.Y * scaley);
|
||||
|
||||
(drawerstyle.Drawers()->*drawerstyle.spanfunc)();
|
||||
(drawerargs.Drawers()->*drawerargs.spanfunc)(drawerargs);
|
||||
#endif
|
||||
}
|
||||
x += xinc;
|
||||
|
|
Loading…
Reference in a new issue