Move wall drawer args into functions

This commit is contained in:
Magnus Norddahl 2017-02-02 11:16:18 +01:00
parent 226e5238fc
commit f3d968cf41
17 changed files with 112 additions and 90 deletions

View File

@ -98,17 +98,17 @@ namespace swrenderer
{ {
PalWall1Command::PalWall1Command(const WallDrawerArgs &args) PalWall1Command::PalWall1Command(const WallDrawerArgs &args)
{ {
_iscale = args.dc_iscale; _iscale = args.TextureVStep();
_texturefrac = args.dc_texturefrac; _texturefrac = args.TextureVPos();
_colormap = args.Colormap(); _colormap = args.Colormap();
_count = args.dc_count; _count = args.Count();
_source = args.dc_source; _source = args.TexturePixels();
_dest = args.Dest(); _dest = args.Dest();
_dest_y = args.DestY(); _dest_y = args.DestY();
_fracbits = args.dc_wall_fracbits; _fracbits = args.TextureFracBits();
_pitch = RenderViewport::Instance()->RenderTarget->GetPitch(); _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_srcblend = args.dc_srcblend; _srcblend = args.SrcBlend();
_destblend = args.dc_destblend; _destblend = args.DestBlend();
_dynlights = args.dc_lights; _dynlights = args.dc_lights;
_num_dynlights = args.dc_num_lights; _num_dynlights = args.dc_num_lights;
_viewpos_z = args.dc_viewpos.Z; _viewpos_z = args.dc_viewpos.Z;

View File

@ -187,13 +187,13 @@ namespace swrenderer
args.dest = (uint32_t*)drawerargs.Dest(); args.dest = (uint32_t*)drawerargs.Dest();
args.dest_y = drawerargs.DestY(); args.dest_y = drawerargs.DestY();
args.pitch = RenderViewport::Instance()->RenderTarget->GetPitch(); args.pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
args.count = drawerargs.dc_count; args.count = drawerargs.Count();
args.texturefrac[0] = drawerargs.dc_texturefrac; args.texturefrac[0] = drawerargs.TextureVPos();
args.texturefracx[0] = drawerargs.dc_texturefracx; args.texturefracx[0] = drawerargs.TextureUPos();
args.iscale[0] = drawerargs.dc_iscale; args.iscale[0] = drawerargs.TextureVStep();
args.textureheight[0] = drawerargs.dc_textureheight; args.textureheight[0] = drawerargs.TextureHeight();
args.source[0] = (const uint32 *)drawerargs.dc_source; args.source[0] = (const uint32 *)drawerargs.TexturePixels();
args.source2[0] = (const uint32 *)drawerargs.dc_source2; args.source2[0] = (const uint32 *)drawerargs.TexturePixels2();
args.light[0] = LightBgra::calc_light_multiplier(drawerargs.Light()); args.light[0] = LightBgra::calc_light_multiplier(drawerargs.Light());
args.light_red = shade_constants.light_red; args.light_red = shade_constants.light_red;
args.light_green = shade_constants.light_green; args.light_green = shade_constants.light_green;
@ -204,8 +204,8 @@ namespace swrenderer
args.fade_blue = shade_constants.fade_blue; args.fade_blue = shade_constants.fade_blue;
args.fade_alpha = shade_constants.fade_alpha; args.fade_alpha = shade_constants.fade_alpha;
args.desaturate = shade_constants.desaturate; args.desaturate = shade_constants.desaturate;
args.srcalpha = drawerargs.dc_srcalpha >> (FRACBITS - 8); args.srcalpha = drawerargs.SrcAlpha() >> (FRACBITS - 8);
args.destalpha = drawerargs.dc_destalpha >> (FRACBITS - 8); args.destalpha = drawerargs.DestAlpha() >> (FRACBITS - 8);
args.flags = 0; args.flags = 0;
if (shade_constants.simple_shade) if (shade_constants.simple_shade)
args.flags |= DrawWallArgs::simple_shade; args.flags |= DrawWallArgs::simple_shade;

View File

@ -63,7 +63,7 @@ namespace swrenderer
spanfunc = &SWPixelFormatDrawers::DrawSpan; spanfunc = &SWPixelFormatDrawers::DrawSpan;
} }
void DrawerArgs::SetColorMapLight(FSWColormap *base_colormap, float light, int shade) void DrawerArgs::SetLight(FSWColormap *base_colormap, float light, int shade)
{ {
mBaseColormap = base_colormap; mBaseColormap = base_colormap;
mTranslation = nullptr; mTranslation = nullptr;
@ -542,11 +542,11 @@ namespace swrenderer
{ {
fixed_t shade = shadedlightshade; fixed_t shade = shadedlightshade;
if (shade == 0) FIXEDLIGHT2SHADE(cameraLight->fixedlightlev); if (shade == 0) FIXEDLIGHT2SHADE(cameraLight->fixedlightlev);
SetColorMapLight(basecolormap, 0, shade); SetLight(basecolormap, 0, shade);
} }
else else
{ {
SetColorMapLight(basecolormap, 0, shadedlightshade); SetLight(basecolormap, 0, shadedlightshade);
} }
return true; return true;
} }
@ -573,7 +573,7 @@ namespace swrenderer
// dc_srccolor is used by the R_Fill* routines. It is premultiplied // dc_srccolor is used by the R_Fill* routines. It is premultiplied
// with the alpha. // with the alpha.
dc_srccolor = ((((r*x) >> 4) << 20) | ((g*x) >> 4) | ((((b)*x) >> 4) << 10)) & 0x3feffbff; dc_srccolor = ((((r*x) >> 4) << 20) | ((g*x) >> 4) | ((((b)*x) >> 4) << 10)) & 0x3feffbff;
SetColorMapLight(&identitycolormap, 0, 0); SetLight(&identitycolormap, 0, 0);
} }
if (!SpriteDrawerArgs::SetBlendFunc(style.BlendOp, fglevel, bglevel, style.Flags)) if (!SpriteDrawerArgs::SetBlendFunc(style.BlendOp, fglevel, bglevel, style.Flags))

View File

@ -24,7 +24,7 @@ namespace swrenderer
class DrawerArgs class DrawerArgs
{ {
public: public:
void SetColorMapLight(FSWColormap *base_colormap, float light, int shade); void SetLight(FSWColormap *base_colormap, float light, int shade);
void SetTranslationMap(lighttable_t *translation); void SetTranslationMap(lighttable_t *translation);
uint8_t *Colormap() const; uint8_t *Colormap() const;
@ -70,7 +70,7 @@ namespace swrenderer
const uint8_t *FrontTexturePixels() const { return dc_source; } const uint8_t *FrontTexturePixels() const { return dc_source; }
const uint8_t *BackTexturePixels() const { return dc_source2; } const uint8_t *BackTexturePixels() const { return dc_source2; }
int FrontTextureHeight() const { return dc_sourceheight; } int FrontTextureHeight() const { return dc_sourceheight; }
int BackTextureHeight() const { return dc_sourceheight; } int BackTextureHeight() const { return dc_sourceheight2; }
void DrawSingleSkyColumn(); void DrawSingleSkyColumn();
void DrawDoubleSkyColumn(); void DrawDoubleSkyColumn();
@ -164,6 +164,17 @@ namespace swrenderer
public: public:
void SetStyle(bool masked, bool additive, fixed_t alpha); void SetStyle(bool masked, bool additive, fixed_t alpha);
void SetDest(int x, int y); void SetDest(int x, int y);
void SetCount(int count) { dc_count = count; }
void SetTexture(const uint8_t *pixels, const uint8_t *pixels2, int height)
{
dc_source = pixels;
dc_source2 = pixels2;
dc_textureheight = height;
}
void SetTextureFracBits(int bits) { dc_wall_fracbits = bits; }
void SetTextureUPos(uint32_t pos) { dc_texturefracx = pos; }
void SetTextureVPos(fixed_t pos) { dc_texturefrac = pos; }
void SetTextureVStep(fixed_t step) { dc_iscale = step; }
bool IsMaskedDrawer() const; bool IsMaskedDrawer() const;
@ -171,21 +182,22 @@ namespace swrenderer
uint8_t *Dest() const { return dc_dest; } uint8_t *Dest() const { return dc_dest; }
int DestY() const { return dc_dest_y; } int DestY() const { return dc_dest_y; }
int Count() const { return dc_count; }
uint32_t *dc_srcblend; uint32_t *SrcBlend() const { return dc_srcblend; }
uint32_t *dc_destblend; uint32_t *DestBlend() const { return dc_destblend; }
fixed_t dc_srcalpha; fixed_t SrcAlpha() const { return dc_srcalpha; }
fixed_t dc_destalpha; fixed_t DestAlpha() const { return dc_destalpha; }
fixed_t dc_iscale; uint32_t TextureUPos() const { return dc_texturefracx; }
fixed_t dc_texturefrac; fixed_t TextureVPos() const { return dc_texturefrac; }
uint32_t dc_texturefracx; fixed_t TextureVStep() const { return dc_iscale; }
uint32_t dc_textureheight; uint32_t TextureHeight() const { return dc_textureheight; }
const uint8_t *dc_source;
const uint8_t *dc_source2;
int dc_count;
int dc_wall_fracbits; const uint8_t *TexturePixels() const { return dc_source; }
const uint8_t *TexturePixels2() const { return dc_source2; }
int TextureFracBits() const { return dc_wall_fracbits; }
FVector3 dc_normal; FVector3 dc_normal;
FVector3 dc_viewpos; FVector3 dc_viewpos;
@ -196,6 +208,20 @@ namespace swrenderer
private: private:
uint8_t *dc_dest = nullptr; uint8_t *dc_dest = nullptr;
int dc_dest_y = 0; int dc_dest_y = 0;
int dc_count;
fixed_t dc_iscale;
fixed_t dc_texturefrac;
uint32_t dc_texturefracx;
uint32_t dc_textureheight;
const uint8_t *dc_source;
const uint8_t *dc_source2;
int dc_wall_fracbits;
uint32_t *dc_srcblend;
uint32_t *dc_destblend;
fixed_t dc_srcalpha;
fixed_t dc_destalpha;
typedef void(SWPixelFormatDrawers::*WallDrawerFunc)(const WallDrawerArgs &args); typedef void(SWPixelFormatDrawers::*WallDrawerFunc)(const WallDrawerArgs &args);
WallDrawerFunc wallfunc = nullptr; WallDrawerFunc wallfunc = nullptr;

View File

@ -64,7 +64,7 @@ namespace swrenderer
fillshort(spanend + t2, b2 - t2, x); fillshort(spanend + t2, b2 - t2, x);
} }
drawerargs.SetColorMapLight(basecolormap, (float)light, wallshade); drawerargs.SetLight(basecolormap, (float)light, wallshade);
uint8_t *fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT); uint8_t *fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
@ -91,7 +91,7 @@ namespace swrenderer
fillshort(spanend + t2, b2 - t2, x); fillshort(spanend + t2, b2 - t2, x);
} }
rcolormap = lcolormap; rcolormap = lcolormap;
drawerargs.SetColorMapLight(basecolormap, (float)light, wallshade); drawerargs.SetLight(basecolormap, (float)light, wallshade);
fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT); fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
} }
else else

View File

@ -936,9 +936,9 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0) if (cameraLight->fixedlightlev >= 0)
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != nullptr) else if (cameraLight->fixedcolormap != nullptr)
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
// clip wall to the floor and ceiling // clip wall to the floor and ceiling
auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip; auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip;

View File

@ -149,13 +149,13 @@ namespace swrenderer
if (cameraLight->fixedlightlev >= 0) if (cameraLight->fixedlightlev >= 0)
{ {
walldrawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); walldrawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
columndrawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); columndrawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
} }
else if (cameraLight->fixedcolormap != nullptr) else if (cameraLight->fixedcolormap != nullptr)
{ {
walldrawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); walldrawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
columndrawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); columndrawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
} }
// find positioning // find positioning
@ -285,7 +285,7 @@ namespace swrenderer
{ {
if (cameraLight->fixedcolormap == nullptr && cameraLight->fixedlightlev < 0) if (cameraLight->fixedcolormap == nullptr && cameraLight->fixedlightlev < 0)
{ {
columndrawerargs.SetColorMapLight(basecolormap, rw_light, wallshade); columndrawerargs.SetLight(basecolormap, rw_light, wallshade);
} }
fixed_t iscale = xs_Fix<16>::ToFix(MaskedSWall[x] * MaskedScaleY); fixed_t iscale = xs_Fix<16>::ToFix(MaskedSWall[x] * MaskedScaleY);
@ -456,9 +456,9 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0) if (cameraLight->fixedlightlev >= 0)
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != nullptr) else if (cameraLight->fixedcolormap != nullptr)
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
WallC.sz1 = ds->sz1; WallC.sz1 = ds->sz1;
WallC.sz2 = ds->sz2; WallC.sz2 = ds->sz2;

View File

@ -244,14 +244,12 @@ namespace swrenderer
{ {
int count = y2 - y1; int count = y2 - y1;
drawerargs.dc_source = sampler.source; drawerargs.SetTexture(sampler.source, sampler.source2, sampler.height);
drawerargs.dc_source2 = sampler.source2; drawerargs.SetTextureUPos(sampler.texturefracx);
drawerargs.dc_texturefracx = sampler.texturefracx;
drawerargs.SetDest(x, y1); drawerargs.SetDest(x, y1);
drawerargs.dc_count = count; drawerargs.SetCount(count);
drawerargs.dc_iscale = sampler.uv_step; drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.dc_texturefrac = sampler.uv_pos; drawerargs.SetTextureVPos(sampler.uv_pos);
drawerargs.dc_textureheight = sampler.height;
drawerargs.DrawColumn(); drawerargs.DrawColumn();
uint64_t step64 = sampler.uv_step; uint64_t step64 = sampler.uv_step;
@ -264,13 +262,12 @@ namespace swrenderer
{ {
int count = y2 - y1; int count = y2 - y1;
drawerargs.dc_source = sampler.source; drawerargs.SetTexture(sampler.source, sampler.source2, sampler.height);
drawerargs.dc_source2 = sampler.source2; drawerargs.SetTextureUPos(sampler.texturefracx);
drawerargs.dc_texturefracx = sampler.texturefracx;
drawerargs.SetDest(x, y1); drawerargs.SetDest(x, y1);
drawerargs.dc_count = count; drawerargs.SetCount(count);
drawerargs.dc_iscale = sampler.uv_step; drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.dc_texturefrac = sampler.uv_pos; drawerargs.SetTextureVPos(sampler.uv_pos);
drawerargs.DrawColumn(); drawerargs.DrawColumn();
uint64_t step64 = sampler.uv_step; uint64_t step64 = sampler.uv_step;
@ -290,13 +287,12 @@ namespace swrenderer
next_uv_wrap++; next_uv_wrap++;
uint32_t count = MIN(left, next_uv_wrap); uint32_t count = MIN(left, next_uv_wrap);
drawerargs.dc_source = sampler.source; drawerargs.SetTexture(sampler.source, sampler.source2, sampler.height);
drawerargs.dc_source2 = sampler.source2; drawerargs.SetTextureUPos(sampler.texturefracx);
drawerargs.dc_texturefracx = sampler.texturefracx;
drawerargs.SetDest(x, y1); drawerargs.SetDest(x, y1);
drawerargs.dc_count = count; drawerargs.SetCount(count);
drawerargs.dc_iscale = sampler.uv_step; drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.dc_texturefrac = uv_pos; drawerargs.SetTextureVPos(uv_pos);
drawerargs.DrawColumn(); drawerargs.DrawColumn();
left -= count; left -= count;
@ -324,15 +320,15 @@ namespace swrenderer
texturemid = 0; texturemid = 0;
} }
drawerargs.dc_wall_fracbits = RenderViewport::Instance()->RenderTarget->IsBgra() ? FRACBITS : fracbits; drawerargs.SetTextureFracBits(RenderViewport::Instance()->RenderTarget->IsBgra() ? FRACBITS : fracbits);
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
bool fixed = (cameraLight->fixedcolormap != NULL || cameraLight->fixedlightlev >= 0); bool fixed = (cameraLight->fixedcolormap != NULL || cameraLight->fixedlightlev >= 0);
if (cameraLight->fixedcolormap) if (cameraLight->fixedcolormap)
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
else else
drawerargs.SetColorMapLight(basecolormap, 0, 0); drawerargs.SetLight(basecolormap, 0, 0);
float dx = WallC.tright.X - WallC.tleft.X; float dx = WallC.tright.X - WallC.tleft.X;
float dy = WallC.tright.Y - WallC.tleft.Y; float dy = WallC.tright.Y - WallC.tleft.Y;
@ -351,7 +347,7 @@ namespace swrenderer
continue; continue;
if (!fixed) if (!fixed)
drawerargs.SetColorMapLight(basecolormap, light, wallshade); drawerargs.SetLight(basecolormap, light, wallshade);
if (x + 1 < x2) xmagnitude = fabs(FIXED2DBL(lwal[x + 1]) - FIXED2DBL(lwal[x])); if (x + 1 < x2) xmagnitude = fabs(FIXED2DBL(lwal[x + 1]) - FIXED2DBL(lwal[x]));

View File

@ -114,12 +114,12 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0) if (cameraLight->fixedlightlev >= 0)
{ {
drawerargs.SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); drawerargs.SetLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
plane_shade = false; plane_shade = false;
} }
else if (cameraLight->fixedcolormap) else if (cameraLight->fixedcolormap)
{ {
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
plane_shade = false; plane_shade = false;
} }
else else
@ -188,7 +188,7 @@ namespace swrenderer
if (plane_shade) if (plane_shade)
{ {
// Determine lighting based on the span's distance from the viewer. // Determine lighting based on the span's distance from the viewer.
drawerargs.SetColorMapLight(basecolormap, (float)(GlobVis * fabs(viewport->CenterY - y)), planeshade); drawerargs.SetLight(basecolormap, (float)(GlobVis * fabs(viewport->CenterY - y)), planeshade);
} }
if (r_dynlights) if (r_dynlights)

View File

@ -151,13 +151,13 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedcolormap) if (cameraLight->fixedcolormap)
{ {
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
} }
else else
{ {
fakefixed = true; fakefixed = true;
cameraLight->fixedcolormap = &NormalLight; cameraLight->fixedcolormap = &NormalLight;
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
} }
DrawSky(pl); DrawSky(pl);

View File

@ -156,17 +156,17 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0) if (cameraLight->fixedlightlev >= 0)
{ {
drawerargs.SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); drawerargs.SetLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
plane_shade = false; plane_shade = false;
} }
else if (cameraLight->fixedcolormap) else if (cameraLight->fixedcolormap)
{ {
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
plane_shade = false; plane_shade = false;
} }
else else
{ {
drawerargs.SetColorMapLight(basecolormap, 0, 0); drawerargs.SetLight(basecolormap, 0, 0);
plane_shade = true; plane_shade = true;
planeshade = LIGHT2SHADE(pl->lightlevel); planeshade = LIGHT2SHADE(pl->lightlevel);
} }

View File

@ -277,11 +277,11 @@ namespace swrenderer
SpriteDrawerArgs drawerargs; SpriteDrawerArgs drawerargs;
if (cameraLight->fixedlightlev >= 0) if (cameraLight->fixedlightlev >= 0)
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != NULL) else if (cameraLight->fixedcolormap != NULL)
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT)) else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0); drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
else else
calclighting = true; calclighting = true;
@ -299,7 +299,7 @@ namespace swrenderer
{ {
if (calclighting) if (calclighting)
{ // calculate lighting { // calculate lighting
drawerargs.SetColorMapLight(usecolormap, light, wallshade); drawerargs.SetLight(usecolormap, light, wallshade);
} }
DrawColumn(drawerargs, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip); DrawColumn(drawerargs, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
light += lightstep; light += lightstep;

View File

@ -592,7 +592,7 @@ namespace swrenderer
} }
SpriteDrawerArgs drawerargs; SpriteDrawerArgs drawerargs;
drawerargs.SetColorMapLight(Light.BaseColormap, 0, Light.ColormapNum << FRACBITS); drawerargs.SetLight(Light.BaseColormap, 0, Light.ColormapNum << FRACBITS);
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(Light.BaseColormap); FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(Light.BaseColormap);

View File

@ -248,7 +248,7 @@ namespace swrenderer
} }
SpriteDrawerArgs drawerargs; SpriteDrawerArgs drawerargs;
drawerargs.SetColorMapLight(vis->Light.BaseColormap, 0, vis->Light.ColormapNum << FRACBITS); drawerargs.SetLight(vis->Light.BaseColormap, 0, vis->Light.ColormapNum << FRACBITS);
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(vis->Light.BaseColormap); FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(vis->Light.BaseColormap);

View File

@ -189,7 +189,7 @@ namespace swrenderer
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(sprite->Light.BaseColormap); FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(sprite->Light.BaseColormap);
SpriteDrawerArgs drawerargs; SpriteDrawerArgs drawerargs;
drawerargs.SetColorMapLight(sprite->Light.BaseColormap, 0, sprite->Light.ColormapNum << FRACBITS); drawerargs.SetLight(sprite->Light.BaseColormap, 0, sprite->Light.ColormapNum << FRACBITS);
bool visible = drawerargs.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) if (!visible)

View File

@ -188,11 +188,11 @@ namespace swrenderer
float light = lightleft + (x1 - spr->wallc.sx1) * lightstep; float light = lightleft + (x1 - spr->wallc.sx1) * lightstep;
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0) if (cameraLight->fixedlightlev >= 0)
drawerargs.SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); drawerargs.SetLight(usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != NULL) else if (cameraLight->fixedcolormap != NULL)
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT)) else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT))
drawerargs.SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0); drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
else else
calclighting = true; calclighting = true;
@ -235,7 +235,7 @@ namespace swrenderer
{ {
if (calclighting) if (calclighting)
{ // calculate lighting { // calculate lighting
drawerargs.SetColorMapLight(usecolormap, light, shade); drawerargs.SetLight(usecolormap, light, shade);
} }
if (!translucentPass->ClipSpriteColumnWithPortals(x, spr)) if (!translucentPass->ClipSpriteColumnWithPortals(x, spr))
DrawColumn(drawerargs, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip); DrawColumn(drawerargs, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);

View File

@ -1371,9 +1371,9 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
SpanDrawerArgs drawerargs; SpanDrawerArgs drawerargs;
drawerargs.SetTexture(tex); drawerargs.SetTexture(tex);
if (colormap) if (colormap)
drawerargs.SetColorMapLight(colormap, 0, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1)); drawerargs.SetLight(colormap, 0, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1));
else else
drawerargs.SetColorMapLight(&identitycolormap, 0, 0); drawerargs.SetLight(&identitycolormap, 0, 0);
if (drawerargs.TextureWidthBits() != 0) if (drawerargs.TextureWidthBits() != 0)
{ {
scalex = double(1u << (32 - drawerargs.TextureWidthBits())) / scalex; scalex = double(1u << (32 - drawerargs.TextureWidthBits())) / scalex;