- rewrote dynamic lights to not use actors for the internal representation and made DynamicLight a purely scripted class.

This should be less of a drag on the playsim than having each light a separate actor. A quick check with ZDCMP2 showed that the light processing time was reduced to 1/3rd from 0.5 ms to 0.17 ms per tic.
It's also one native actor class less.
This commit is contained in:
Christoph Oelckers 2019-01-01 19:35:55 +01:00
commit d654e02dea
34 changed files with 438 additions and 412 deletions

View file

@ -85,19 +85,19 @@ CUSTOM_CVAR (Bool, gl_light_shadowmap, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
if (!self)
{
// Unset any residual shadow map indices in the light actors.
TThinkerIterator<ADynamicLight> it(STAT_DLIGHT);
while (auto light = it.Next())
{
auto light = level.lights;
while (light)
{
light->mShadowmapIndex = 1024;
light = light->next;
}
}
}
bool IShadowMap::ShadowTest(ADynamicLight *light, const DVector3 &pos)
bool IShadowMap::ShadowTest(FDynamicLight *light, const DVector3 &pos)
{
if (light->shadowmapped && light->radius > 0.0 && IsEnabled() && mAABBTree)
return mAABBTree->RayTest(light->Pos(), pos) >= 1.0f;
if (light->shadowmapped && light->GetRadius() > 0.0 && IsEnabled() && mAABBTree)
return mAABBTree->RayTest(light->Pos, pos) >= 1.0f;
else
return true;
}
@ -113,8 +113,7 @@ void IShadowMap::CollectLights()
int lightindex = 0;
// Todo: this should go through the blockmap in a spiral pattern around the player so that closer lights are preferred.
TThinkerIterator<ADynamicLight> it(STAT_DLIGHT);
while (auto light = it.Next())
for (auto light = level.lights; light; light = light->next)
{
LightsProcessed++;
if (light->shadowmapped && light->IsActive() && lightindex < 1024 * 4)