Add functions to CameraLight

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

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;