Add functions to CameraLight

This commit is contained in:
Magnus Norddahl 2017-02-03 09:00:46 +01:00
parent a0a40281b3
commit 892350ac2e
25 changed files with 83 additions and 77 deletions

View File

@ -1409,7 +1409,7 @@ void OpenGLSWFrameBuffer::Draw3DPart(bool copy3d)
uint32_t color0, color1;
if (Accel2D)
{
auto &map = swrenderer::CameraLight::Instance()->realfixedcolormap;
auto map = swrenderer::CameraLight::Instance()->ShaderColormap();
if (map == nullptr)
{
color0 = 0;

View File

@ -69,10 +69,10 @@ void PolyRenderer::RenderView(player_t *player)
// Apply special colormap if the target cannot do it
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->realfixedcolormap && viewport->RenderTarget->IsBgra() && !(r_shadercolormaps && screen->Accel2D))
if (cameraLight->ShaderColormap() && viewport->RenderTarget->IsBgra() && !(r_shadercolormaps && screen->Accel2D))
{
R_BeginDrawerCommands();
DrawerCommandQueue::QueueCommand<ApplySpecialColormapRGBACommand>(cameraLight->realfixedcolormap, screen);
DrawerCommandQueue::QueueCommand<ApplySpecialColormapRGBACommand>(cameraLight->ShaderColormap(), screen);
R_EndDrawerCommands();
}
}

View File

@ -140,7 +140,7 @@ void RenderPolyDecal::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
args.SetColormap(front->ColorMap);
args.SetTexture(tex, decal->Translation, true);
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
if (fullbrightSprite || cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
{
args.uniforms.light = 256;
args.uniforms.flags |= TriUniforms::fixed_light;

View File

@ -76,7 +76,7 @@ void RenderPolyParticle::Render(const TriMatrix &worldToClip, const Vec4f &clipP
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->ParticleGlobVis();
if (fullbrightSprite || cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
{
args.uniforms.light = 256;
args.uniforms.flags = TriUniforms::fixed_light;

View File

@ -99,7 +99,7 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, const Vec4f &c
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
int lightlevel = 255;
if (cameraLight->fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
if (cameraLight->FixedLightLevel() < 0 && sub->sector->e->XFloor.lightlist.Size())
{
lightlist_t *light = P_GetPlaneLight(sub->sector, &sub->sector->ceilingplane, false);
//basecolormap = light->extra_colormap;
@ -111,7 +111,7 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, const Vec4f &c
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis() * 48.0f;
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
if (cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
if (cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
args.uniforms.light = 256;
args.uniforms.flags = 0;
args.uniforms.subsectorDepth = subsectorDepth;
@ -307,7 +307,7 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis() * 48.0f;
args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
if (cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
if (cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
args.uniforms.light = 256;
args.uniforms.flags = 0;
args.uniforms.subsectorDepth = isSky ? RenderPolyScene::SkySubsectorDepth : subsectorDepth;

View File

@ -329,14 +329,14 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
// If the main colormap has fixed lights, and this sprite is being drawn with that
// colormap, disable acceleration so that the lights can remain fixed.
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
if (!noaccel && cameraLight->realfixedcolormap == nullptr &&
if (!noaccel && cameraLight->ShaderColormap() == nullptr &&
NormalLightHasFixedLights && mybasecolormap == &NormalLight &&
tex->UseBasePalette())
{
noaccel = true;
}
// [SP] If emulating GZDoom fullbright, disable acceleration
if (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0)
if (r_fullbrightignoresectorcolor && cameraLight->FixedLightLevel() >= 0)
mybasecolormap = &FullNormalLight;
if (r_fullbrightignoresectorcolor && !foggy && sprite->GetState()->GetFullbright())
mybasecolormap = &FullNormalLight;

View File

@ -141,7 +141,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const Vec4f &clipPla
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SpriteGlobVis();
args.uniforms.flags = 0;
if (fullbrightSprite || cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
{
args.uniforms.light = 256;
args.uniforms.flags |= TriUniforms::fixed_light;

View File

@ -353,7 +353,7 @@ FTexture *RenderPolyWall::GetTexture()
int RenderPolyWall::GetLightLevel()
{
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
if (cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
{
return 255;
}

View File

@ -102,7 +102,7 @@ void RenderPolyWallSprite::Render(const TriMatrix &worldToClip, const Vec4f &cli
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
if (fullbrightSprite || cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
{
args.uniforms.light = 256;
args.uniforms.flags = TriUniforms::fixed_light;

View File

@ -899,7 +899,7 @@ namespace swrenderer
walltexcoords.Project(sidedef->TexelLength * lwallscale, WallC.sx1, WallC.sx2, WallT);
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedcolormap == nullptr && cameraLight->fixedlightlev < 0)
if (cameraLight->FixedColormap() == nullptr && cameraLight->FixedLightLevel() < 0)
{
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel) + R_ActualExtraLight(foggy));
double GlobVis = LightVisibility::Instance()->WallGlobVis();
@ -916,7 +916,7 @@ namespace swrenderer
bool SWRenderLine::IsFogBoundary(sector_t *front, sector_t *back) const
{
return r_fogboundary && CameraLight::Instance()->fixedcolormap == nullptr && front->ColorMap->Fade &&
return r_fogboundary && CameraLight::Instance()->FixedColormap() == nullptr && front->ColorMap->Fade &&
front->ColorMap->Fade != back->ColorMap->Fade &&
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
}
@ -935,10 +935,10 @@ namespace swrenderer
drawerargs.SetStyle(false, false, OPAQUE);
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0)
drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != nullptr)
drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
if (cameraLight->FixedLightLevel() >= 0)
drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->FixedLightLevel()));
else if (cameraLight->FixedColormap() != nullptr)
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
// clip wall to the floor and ceiling
auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip;

View File

@ -106,7 +106,7 @@ namespace swrenderer
Clip3DFloors *clip3d = Clip3DFloors::Instance();
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev < 0)
if (cameraLight->FixedLightLevel() < 0)
{
if (!(clip3d->fake3D & FAKE3D_CLIPTOP))
{
@ -148,15 +148,15 @@ namespace swrenderer
spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
rw_scalestep = ds->iscalestep;
if (cameraLight->fixedlightlev >= 0)
if (cameraLight->FixedLightLevel() >= 0)
{
walldrawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
columndrawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
walldrawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->FixedLightLevel()));
columndrawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->FixedLightLevel()));
}
else if (cameraLight->fixedcolormap != nullptr)
else if (cameraLight->FixedColormap() != nullptr)
{
walldrawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
columndrawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
walldrawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
columndrawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
}
// find positioning
@ -284,7 +284,7 @@ namespace swrenderer
{
for (int x = x1; x < x2; ++x)
{
if (cameraLight->fixedcolormap == nullptr && cameraLight->fixedlightlev < 0)
if (cameraLight->FixedColormap() == nullptr && cameraLight->FixedLightLevel() < 0)
{
columndrawerargs.SetLight(basecolormap, rw_light, wallshade);
}
@ -456,10 +456,10 @@ namespace swrenderer
}
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0)
drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != nullptr)
drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
if (cameraLight->FixedLightLevel() >= 0)
drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->FixedLightLevel()));
else if (cameraLight->FixedColormap() != nullptr)
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
WallC.sz1 = ds->sz1;
WallC.sz2 = ds->sz2;
@ -682,7 +682,7 @@ namespace swrenderer
FDynamicColormap *basecolormap = frontsector->ColorMap;
wallshade = ds->shade;
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev < 0)
if (cameraLight->FixedLightLevel() < 0)
{
if ((ds->bFakeBoundary & 3) == 2)
{
@ -857,7 +857,7 @@ namespace swrenderer
FDynamicColormap *basecolormap = frontsector->ColorMap;
wallshade = ds->shade;
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev < 0)
if (cameraLight->FixedLightLevel() < 0)
{
if ((ds->bFakeBoundary & 3) == 2)
{

View File

@ -323,10 +323,10 @@ namespace swrenderer
drawerargs.SetTextureFracBits(RenderViewport::Instance()->RenderTarget->IsBgra() ? FRACBITS : fracbits);
CameraLight *cameraLight = CameraLight::Instance();
bool fixed = (cameraLight->fixedcolormap != NULL || cameraLight->fixedlightlev >= 0);
bool fixed = (cameraLight->FixedColormap() != NULL || cameraLight->FixedLightLevel() >= 0);
if (cameraLight->fixedcolormap)
drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
if (cameraLight->FixedColormap())
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
else
drawerargs.SetLight(basecolormap, 0, 0);
@ -410,7 +410,7 @@ namespace swrenderer
}
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedcolormap != NULL || cameraLight->fixedlightlev >= 0 || !(frontsector->e && frontsector->e->XFloor.lightlist.Size()))
if (cameraLight->FixedColormap() != NULL || cameraLight->FixedLightLevel() >= 0 || !(frontsector->e && frontsector->e->XFloor.lightlist.Size()))
{
ProcessNormalWall(uwal, dwal, texturemid, swal, lwal);
}

View File

@ -112,14 +112,14 @@ namespace swrenderer
GlobVis = LightVisibility::Instance()->FlatPlaneGlobVis() / planeheight;
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0)
if (cameraLight->FixedLightLevel() >= 0)
{
drawerargs.SetLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
drawerargs.SetLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->FixedLightLevel()));
plane_shade = false;
}
else if (cameraLight->fixedcolormap)
else if (cameraLight->FixedColormap())
{
drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
plane_shade = false;
}
else

View File

@ -148,9 +148,9 @@ namespace swrenderer
}
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedcolormap)
if (cameraLight->FixedColormap())
{
drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
}
else
{

View File

@ -154,14 +154,14 @@ namespace swrenderer
basecolormap = colormap;
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0)
if (cameraLight->FixedLightLevel() >= 0)
{
drawerargs.SetLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
drawerargs.SetLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->FixedLightLevel()));
plane_shade = false;
}
else if (cameraLight->fixedcolormap)
else if (cameraLight->FixedColormap())
{
drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
plane_shade = false;
}
else

View File

@ -189,15 +189,15 @@ namespace swrenderer
}
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedcolormap)
if (cameraLight->FixedColormap())
{
BaseColormap = cameraLight->fixedcolormap;
BaseColormap = cameraLight->FixedColormap();
ColormapNum = 0;
}
else if (cameraLight->fixedlightlev >= 0)
else if (cameraLight->FixedLightLevel() >= 0)
{
BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap;
ColormapNum = cameraLight->fixedlightlev >> COLORMAPSHIFT;
ColormapNum = cameraLight->FixedLightLevel() >> COLORMAPSHIFT;
}
else if (fullbright)
{

View File

@ -59,11 +59,17 @@ namespace swrenderer
public:
static CameraLight *Instance();
int FixedLightLevel() const { return fixedlightlev; }
FSWColormap *FixedColormap() const { return fixedcolormap; }
FSpecialColormap *ShaderColormap() const { return realfixedcolormap; }
void SetCamera(AActor *actor);
void ClearShaderColormap() { realfixedcolormap = nullptr; }
private:
int fixedlightlev = 0;
FSWColormap *fixedcolormap = nullptr;
FSpecialColormap *realfixedcolormap = nullptr;
void SetCamera(AActor *actor);
};
class LightVisibility

View File

@ -483,7 +483,7 @@ namespace swrenderer
// kg3D - fake lights
CameraLight *cameraLight = CameraLight::Instance();
FDynamicColormap *basecolormap;
if (cameraLight->fixedlightlev < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
if (cameraLight->FixedLightLevel() < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
{
light = P_GetPlaneLight(frontsector, &frontsector->ceilingplane, false);
basecolormap = light->extra_colormap;
@ -496,7 +496,7 @@ namespace swrenderer
}
else
{
basecolormap = (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
basecolormap = (r_fullbrightignoresectorcolor && cameraLight->FixedLightLevel() >= 0) ? &FullNormalLight : frontsector->ColorMap;
}
portal = frontsector->ValidatePortal(sector_t::ceiling);
@ -521,7 +521,7 @@ namespace swrenderer
if (ceilingplane)
ceilingplane->AddLights(frontsector->lighthead);
if (cameraLight->fixedlightlev < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
if (cameraLight->FixedLightLevel() < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
{
light = P_GetPlaneLight(frontsector, &frontsector->floorplane, false);
basecolormap = light->extra_colormap;
@ -534,7 +534,7 @@ namespace swrenderer
}
else
{
basecolormap = (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
basecolormap = (r_fullbrightignoresectorcolor && cameraLight->FixedLightLevel() >= 0) ? &FullNormalLight : frontsector->ColorMap;
}
// killough 3/7/98: Add (x,y) offsets to flats, add deep water check
@ -606,7 +606,7 @@ namespace swrenderer
else position = sector_t::floor;
frontsector = &tempsec;
if (cameraLight->fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
if (cameraLight->FixedLightLevel() < 0 && sub->sector->e->XFloor.lightlist.Size())
{
light = P_GetPlaneLight(sub->sector, &frontsector->floorplane, false);
basecolormap = light->extra_colormap;
@ -671,7 +671,7 @@ namespace swrenderer
frontsector = &tempsec;
tempsec.ceilingplane.ChangeHeight(-1 / 65536.);
if (cameraLight->fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
if (cameraLight->FixedLightLevel() < 0 && sub->sector->e->XFloor.lightlist.Size())
{
light = P_GetPlaneLight(sub->sector, &frontsector->ceilingplane, false);
basecolormap = light->extra_colormap;

View File

@ -98,9 +98,9 @@ namespace swrenderer
RenderActorView(player->mo);
// Apply special colormap if the target cannot do it
if (CameraLight::Instance()->realfixedcolormap && viewport->RenderTarget->IsBgra() && !(r_shadercolormaps && screen->Accel2D))
if (CameraLight::Instance()->ShaderColormap() && viewport->RenderTarget->IsBgra() && !(r_shadercolormaps && screen->Accel2D))
{
DrawerCommandQueue::QueueCommand<ApplySpecialColormapRGBACommand>(CameraLight::Instance()->realfixedcolormap, screen);
DrawerCommandQueue::QueueCommand<ApplySpecialColormapRGBACommand>(CameraLight::Instance()->ShaderColormap(), screen);
}
R_EndDrawerCommands();
@ -185,7 +185,7 @@ namespace swrenderer
// copy to the screen does not use a special colormap shader.
if (!r_shadercolormaps && !RenderViewport::Instance()->RenderTarget->IsBgra())
{
CameraLight::Instance()->realfixedcolormap = NULL;
CameraLight::Instance()->ClearShaderColormap();
}
}

View File

@ -277,10 +277,10 @@ namespace swrenderer
SpriteDrawerArgs drawerargs;
if (cameraLight->fixedlightlev >= 0)
drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != NULL)
drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
if (cameraLight->FixedLightLevel() >= 0)
drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->FixedLightLevel()));
else if (cameraLight->FixedColormap() != NULL)
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
else

View File

@ -91,7 +91,7 @@ namespace swrenderer
FDynamicColormap *basecolormap;
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev < 0 && viewsector->e && viewsector->e->XFloor.lightlist.Size())
if (cameraLight->FixedLightLevel() < 0 && viewsector->e && viewsector->e->XFloor.lightlist.Size())
{
for (i = viewsector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
{
@ -486,7 +486,7 @@ namespace swrenderer
// If the main colormap has fixed lights, and this sprite is being drawn with that
// colormap, disable acceleration so that the lights can remain fixed.
CameraLight *cameraLight = CameraLight::Instance();
if (!noaccel && cameraLight->realfixedcolormap == nullptr &&
if (!noaccel && cameraLight->ShaderColormap() == nullptr &&
NormalLightHasFixedLights && vis.Light.BaseColormap == &NormalLight &&
vis.pic->UseBasePalette())
{

View File

@ -87,7 +87,7 @@ namespace swrenderer
// kg3D - correct colors now
CameraLight *cameraLight = CameraLight::Instance();
if (!cameraLight->fixedcolormap && cameraLight->fixedlightlev < 0 && spr->sector->e && spr->sector->e->XFloor.lightlist.Size())
if (!cameraLight->FixedColormap() && cameraLight->FixedLightLevel() < 0 && spr->sector->e && spr->sector->e->XFloor.lightlist.Size())
{
if (!(clip3d->fake3D & FAKE3D_CLIPTOP))
{

View File

@ -187,10 +187,10 @@ namespace swrenderer
float lightstep = float((GlobVis / spr->wallc.sz2 - lightleft) / (spr->wallc.sx2 - spr->wallc.sx1));
float light = lightleft + (x1 - spr->wallc.sx1) * lightstep;
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0)
drawerargs.SetLight(usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != NULL)
drawerargs.SetLight(cameraLight->fixedcolormap, 0, 0);
if (cameraLight->FixedLightLevel() >= 0)
drawerargs.SetLight(usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->FixedLightLevel()));
else if (cameraLight->FixedColormap() != NULL)
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT))
drawerargs.SetLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
else

View File

@ -436,12 +436,12 @@ namespace swrenderer
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)];
dc_color = cameraLight->FixedColormap() ? cameraLight->FixedColormap()->Maps[APART(color)] : basecolormap->Maps[APART(color)];
basecolormap = &ShadeFakeColormap[16 - alpha];
if (cameraLight->fixedlightlev >= 0 && cameraLight->fixedcolormap == NULL)
if (cameraLight->FixedLightLevel() >= 0 && !cameraLight->FixedColormap())
{
fixed_t shade = shadedlightshade;
if (shade == 0) FIXEDLIGHT2SHADE(cameraLight->fixedlightlev);
if (shade == 0) FIXEDLIGHT2SHADE(cameraLight->FixedLightLevel());
SetLight(basecolormap, 0, shade);
}
else

View File

@ -1405,7 +1405,7 @@ void D3DFB::Draw3DPart(bool copy3d)
D3DCOLOR color0, color1;
if (Accel2D)
{
auto &map = swrenderer::CameraLight::Instance()->realfixedcolormap;
auto map = swrenderer::CameraLight::Instance()->ShaderColormap();
if (map == NULL)
{
color0 = 0;