diff --git a/src/swrenderer/drawers/r_draw_pal.cpp b/src/swrenderer/drawers/r_draw_pal.cpp index 0043ed98f1..0248363cbf 100644 --- a/src/swrenderer/drawers/r_draw_pal.cpp +++ b/src/swrenderer/drawers/r_draw_pal.cpp @@ -1849,7 +1849,7 @@ namespace swrenderer PalSpanCommand::PalSpanCommand(const SpanDrawerArgs &args) { _source = args.ds_source; - _colormap = args.ds_colormap; + _colormap = args.dc_colormap; _xfrac = args.ds_xfrac; _yfrac = args.ds_yfrac; _y = args.ds_y; @@ -2624,7 +2624,7 @@ namespace swrenderer DrawTiltedSpanPalCommand::DrawTiltedSpanPalCommand(const SpanDrawerArgs &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) { - _colormap = args.ds_colormap; + _colormap = args.dc_colormap; _destorg = dc_destorg; _ybits = args.ds_ybits; _xbits = args.ds_xbits; diff --git a/src/swrenderer/drawers/r_draw_rgba.cpp b/src/swrenderer/drawers/r_draw_rgba.cpp index 21c5d8484e..cf3ccf48fc 100644 --- a/src/swrenderer/drawers/r_draw_rgba.cpp +++ b/src/swrenderer/drawers/r_draw_rgba.cpp @@ -74,20 +74,20 @@ namespace swrenderer args.destorg = (uint32_t*)dc_destorg; args.destpitch = dc_pitch; 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.light = 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 (drawerargs.ds_shade_constants.simple_shade) + if (drawerargs.dc_shade_constants.simple_shade) args.flags |= DrawSpanArgs::simple_shade; if (!sampler_setup(drawerargs.ds_lod, args.source, args.xbits, args.ybits, drawerargs.ds_source_mipmapped)) args.flags |= DrawSpanArgs::nearest_filter; @@ -436,7 +436,7 @@ namespace swrenderer _x2 = drawerargs.ds_x2; _y = drawerargs.ds_y; _destorg = dc_destorg; - _light = drawerargs.ds_light; + _light = drawerargs.dc_light; _color = drawerargs.ds_color; } @@ -534,8 +534,8 @@ namespace swrenderer _x2 = x2; _y = y; _destorg = dc_destorg; - _light = drawerargs.ds_light; - _shade_constants = drawerargs.ds_shade_constants; + _light = drawerargs.dc_light; + _shade_constants = drawerargs.dc_shade_constants; _plane_sz = plane_sz; _plane_su = plane_su; _plane_sv = plane_sv; @@ -669,7 +669,7 @@ namespace swrenderer _x2 = x2; _destorg = dc_destorg; - _light = drawerargs.ds_light; + _light = drawerargs.dc_light; _color = drawerargs.ds_color; } diff --git a/src/swrenderer/drawers/r_drawerargs.cpp b/src/swrenderer/drawers/r_drawerargs.cpp index af08e8d56f..19a4c3a4ad 100644 --- a/src/swrenderer/drawers/r_drawerargs.cpp +++ b/src/swrenderer/drawers/r_drawerargs.cpp @@ -91,29 +91,6 @@ namespace swrenderer } } - void SpanDrawerArgs::SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade) - { - 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 DrawerArgs::SetTranslationMap(lighttable_t *translation) { if (r_swtruecolor) @@ -156,11 +133,6 @@ namespace swrenderer ds_source_mipmapped = tex->Mipmapped() && tex->GetWidth() > 1 && tex->GetHeight() > 1; } - void SpanDrawerArgs::SetSpanColormap(FDynamicColormap *colormap, int shade) - { - SetDSColorMapLight(colormap, 0, shade); - } - void ColumnDrawerArgs::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) { // Handle the linear filtered version in a different function to reduce chances of merge conflicts from zdoom. diff --git a/src/swrenderer/drawers/r_drawerargs.h b/src/swrenderer/drawers/r_drawerargs.h index d478958ed8..57e741299a 100644 --- a/src/swrenderer/drawers/r_drawerargs.h +++ b/src/swrenderer/drawers/r_drawerargs.h @@ -140,10 +140,7 @@ namespace swrenderer class SpanDrawerArgs : public DrawerArgs { public: - void SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade); - void SetSpanTexture(FTexture *tex); - void SetSpanColormap(FDynamicColormap *colormap, int shade); 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); void DrawColoredSpan(int y, int x1, int x2); @@ -152,9 +149,6 @@ namespace swrenderer int ds_y; int ds_x1; int ds_x2; - uint8_t * ds_colormap; - ShadeConstants ds_shade_constants; - dsfixed_t ds_light; dsfixed_t ds_xfrac; dsfixed_t ds_yfrac; dsfixed_t ds_xstep; diff --git a/src/swrenderer/plane/r_flatplane.cpp b/src/swrenderer/plane/r_flatplane.cpp index c8e14e5da7..0035540736 100644 --- a/src/swrenderer/plane/r_flatplane.cpp +++ b/src/swrenderer/plane/r_flatplane.cpp @@ -108,16 +108,16 @@ namespace swrenderer basecolormap = colormap; GlobVis = LightVisibility::Instance()->FlatPlaneGlobVis() / planeheight; - drawerargs.ds_light = 0; + drawerargs.dc_light = 0; CameraLight *cameraLight = CameraLight::Instance(); if (cameraLight->fixedlightlev >= 0) { - drawerargs.SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); + drawerargs.SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); plane_shade = false; } else if (cameraLight->fixedcolormap) { - drawerargs.SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0); + drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); plane_shade = false; } else @@ -183,7 +183,7 @@ namespace swrenderer if (plane_shade) { // Determine lighting based on the span's distance from the viewer. - drawerargs.SetDSColorMapLight(basecolormap, (float)(GlobVis * fabs(CenterY - y)), planeshade); + drawerargs.SetColorMapLight(basecolormap, (float)(GlobVis * fabs(CenterY - y)), planeshade); } if (r_dynlights) diff --git a/src/swrenderer/plane/r_slopeplane.cpp b/src/swrenderer/plane/r_slopeplane.cpp index 599c279b46..363ff9edfe 100644 --- a/src/swrenderer/plane/r_slopeplane.cpp +++ b/src/swrenderer/plane/r_slopeplane.cpp @@ -154,17 +154,17 @@ namespace swrenderer CameraLight *cameraLight = CameraLight::Instance(); if (cameraLight->fixedlightlev >= 0) { - drawerargs.SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); + drawerargs.SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); plane_shade = false; } else if (cameraLight->fixedcolormap) { - drawerargs.SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0); + drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); plane_shade = false; } else { - drawerargs.SetDSColorMapLight(basecolormap, 0, 0); + drawerargs.SetColorMapLight(basecolormap, 0, 0); plane_shade = true; planeshade = LIGHT2SHADE(pl->lightlevel); } diff --git a/src/v_draw.cpp b/src/v_draw.cpp index c5240c34ae..a016272d06 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -1390,9 +1390,9 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, SpanDrawerArgs drawerargs; drawerargs.SetSpanTexture(tex); if (colormap) - drawerargs.SetSpanColormap(colormap, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1)); + drawerargs.SetColorMapLight(colormap, 0, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1)); else - drawerargs.SetSpanColormap(&identitycolormap, 0); + drawerargs.SetColorMapLight(&identitycolormap, 0, 0); if (drawerargs.ds_xbits != 0) { scalex = double(1u << (32 - drawerargs.ds_xbits)) / scalex;