- added map option to disable shadowmaps.
Prompted by 'Hurt' which has > 4000 lights and runs into both performance issues and unpredictable light selection for the limited amount of shadowmap slots.
This commit is contained in:
parent
cb8ae0b560
commit
0cffeef2c6
5 changed files with 15 additions and 7 deletions
|
|
@ -107,10 +107,9 @@ void AddLightToList(FDynLightData &dld, int group, FDynamicLight * light, bool f
|
|||
}
|
||||
|
||||
float shadowIndex;
|
||||
if (gl_light_shadowmap)
|
||||
if (gl_light_shadowmap) // note: with gl_light_shadowmap switched off, we cannot rely on properly set indices anymore.
|
||||
{
|
||||
shadowIndex = light->mShadowmapIndex + 1.0f;
|
||||
|
||||
}
|
||||
else shadowIndex = 1025.f;
|
||||
// Store attenuate flag in the sign bit of the float.
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
|
|||
|
||||
R_SetupFrame(mainvp, r_viewwindow, camera);
|
||||
|
||||
if (mainview && toscreen)
|
||||
if (mainview && toscreen && !(camera->Level->flags3 & LEVEL3_NOSHADOWMAP) && gl_light_shadowmap && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER))
|
||||
{
|
||||
screen->SetAABBTree(camera->Level->aabbTree);
|
||||
screen->mShadowMap.SetCollectLights([=] {
|
||||
|
|
@ -115,6 +115,12 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
|
|||
});
|
||||
screen->UpdateShadowMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
// null all references to the level if we do not need a shadowmap. This will shortcut all internal calculations without further checks.
|
||||
screen->SetAABBTree(nullptr);
|
||||
screen->mShadowMap.SetCollectLights(nullptr);
|
||||
}
|
||||
|
||||
// Update the attenuation flag of all light defaults for each viewpoint.
|
||||
// This function will only do something if the setting differs.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue