diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index 09a8d5664..04c2b7eb7 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -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; diff --git a/src/polyrenderer/poly_renderer.cpp b/src/polyrenderer/poly_renderer.cpp index f8b27bd98..1de84530d 100644 --- a/src/polyrenderer/poly_renderer.cpp +++ b/src/polyrenderer/poly_renderer.cpp @@ -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(cameraLight->realfixedcolormap, screen); + DrawerCommandQueue::QueueCommand(cameraLight->ShaderColormap(), screen); R_EndDrawerCommands(); } } diff --git a/src/polyrenderer/scene/poly_decal.cpp b/src/polyrenderer/scene/poly_decal.cpp index 024a2dd25..fad44862f 100644 --- a/src/polyrenderer/scene/poly_decal.cpp +++ b/src/polyrenderer/scene/poly_decal.cpp @@ -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; diff --git a/src/polyrenderer/scene/poly_particle.cpp b/src/polyrenderer/scene/poly_particle.cpp index d83ac3cc4..39f5514f4 100644 --- a/src/polyrenderer/scene/poly_particle.cpp +++ b/src/polyrenderer/scene/poly_particle.cpp @@ -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; diff --git a/src/polyrenderer/scene/poly_plane.cpp b/src/polyrenderer/scene/poly_plane.cpp index 1fcbad9c9..2aec6b08d 100644 --- a/src/polyrenderer/scene/poly_plane.cpp +++ b/src/polyrenderer/scene/poly_plane.cpp @@ -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; diff --git a/src/polyrenderer/scene/poly_playersprite.cpp b/src/polyrenderer/scene/poly_playersprite.cpp index 9ebbc7aa1..2bd8f2f65 100644 --- a/src/polyrenderer/scene/poly_playersprite.cpp +++ b/src/polyrenderer/scene/poly_playersprite.cpp @@ -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; diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index 3149f68a6..0599a4b20 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -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; diff --git a/src/polyrenderer/scene/poly_wall.cpp b/src/polyrenderer/scene/poly_wall.cpp index 18df84744..d8fb2a7ae 100644 --- a/src/polyrenderer/scene/poly_wall.cpp +++ b/src/polyrenderer/scene/poly_wall.cpp @@ -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; } diff --git a/src/polyrenderer/scene/poly_wallsprite.cpp b/src/polyrenderer/scene/poly_wallsprite.cpp index 1d321fbc0..31aded9ac 100644 --- a/src/polyrenderer/scene/poly_wallsprite.cpp +++ b/src/polyrenderer/scene/poly_wallsprite.cpp @@ -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; diff --git a/src/swrenderer/line/r_line.cpp b/src/swrenderer/line/r_line.cpp index 6eda3ee4a..cd6cb1962 100644 --- a/src/swrenderer/line/r_line.cpp +++ b/src/swrenderer/line/r_line.cpp @@ -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; diff --git a/src/swrenderer/line/r_renderdrawsegment.cpp b/src/swrenderer/line/r_renderdrawsegment.cpp index 9ff71cc1c..a3074f1d3 100644 --- a/src/swrenderer/line/r_renderdrawsegment.cpp +++ b/src/swrenderer/line/r_renderdrawsegment.cpp @@ -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) { diff --git a/src/swrenderer/line/r_walldraw.cpp b/src/swrenderer/line/r_walldraw.cpp index f55424918..2261fa71a 100644 --- a/src/swrenderer/line/r_walldraw.cpp +++ b/src/swrenderer/line/r_walldraw.cpp @@ -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); } diff --git a/src/swrenderer/plane/r_flatplane.cpp b/src/swrenderer/plane/r_flatplane.cpp index 49a96797f..3e630c13c 100644 --- a/src/swrenderer/plane/r_flatplane.cpp +++ b/src/swrenderer/plane/r_flatplane.cpp @@ -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 diff --git a/src/swrenderer/plane/r_skyplane.cpp b/src/swrenderer/plane/r_skyplane.cpp index 85655c594..091182c49 100644 --- a/src/swrenderer/plane/r_skyplane.cpp +++ b/src/swrenderer/plane/r_skyplane.cpp @@ -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 { diff --git a/src/swrenderer/plane/r_slopeplane.cpp b/src/swrenderer/plane/r_slopeplane.cpp index ee56e5da2..c51bf0276 100644 --- a/src/swrenderer/plane/r_slopeplane.cpp +++ b/src/swrenderer/plane/r_slopeplane.cpp @@ -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 diff --git a/src/swrenderer/scene/r_light.cpp b/src/swrenderer/scene/r_light.cpp index 633e34acb..5be847bf8 100644 --- a/src/swrenderer/scene/r_light.cpp +++ b/src/swrenderer/scene/r_light.cpp @@ -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) { diff --git a/src/swrenderer/scene/r_light.h b/src/swrenderer/scene/r_light.h index 6059028a6..3e4580d92 100644 --- a/src/swrenderer/scene/r_light.h +++ b/src/swrenderer/scene/r_light.h @@ -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 diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index ebd0d9ba8..58e804519 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -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; diff --git a/src/swrenderer/scene/r_scene.cpp b/src/swrenderer/scene/r_scene.cpp index 8fbe1efb2..f232f443f 100644 --- a/src/swrenderer/scene/r_scene.cpp +++ b/src/swrenderer/scene/r_scene.cpp @@ -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(CameraLight::Instance()->realfixedcolormap, screen); + DrawerCommandQueue::QueueCommand(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(); } } diff --git a/src/swrenderer/things/r_decal.cpp b/src/swrenderer/things/r_decal.cpp index 4b37644de..098de1dc2 100644 --- a/src/swrenderer/things/r_decal.cpp +++ b/src/swrenderer/things/r_decal.cpp @@ -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 diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index 3799a7caa..0b8661e52 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -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()) { diff --git a/src/swrenderer/things/r_visiblesprite.cpp b/src/swrenderer/things/r_visiblesprite.cpp index cdb4da2d0..96be5e12c 100644 --- a/src/swrenderer/things/r_visiblesprite.cpp +++ b/src/swrenderer/things/r_visiblesprite.cpp @@ -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)) { diff --git a/src/swrenderer/things/r_wallsprite.cpp b/src/swrenderer/things/r_wallsprite.cpp index 57080743f..8c813f479 100644 --- a/src/swrenderer/things/r_wallsprite.cpp +++ b/src/swrenderer/things/r_wallsprite.cpp @@ -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 diff --git a/src/swrenderer/viewport/r_spritedrawer.cpp b/src/swrenderer/viewport/r_spritedrawer.cpp index fee87e67e..e0f0ccb3f 100644 --- a/src/swrenderer/viewport/r_spritedrawer.cpp +++ b/src/swrenderer/viewport/r_spritedrawer.cpp @@ -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 diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index a96fc7b88..d364306a6 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -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;