ensure non-dynamic tiles are baked first
This commit is contained in:
parent
36d74cf8f9
commit
c2901404d5
1 changed files with 17 additions and 2 deletions
|
|
@ -687,16 +687,31 @@ void HWDrawInfo::UpdateLightmaps()
|
|||
{
|
||||
if (!outer && VisibleTiles.Size() < unsigned(lm_background_updates))
|
||||
{
|
||||
int unbaked = 0;
|
||||
int dynamic = 0;
|
||||
|
||||
for (auto& e : level.levelMesh->Lightmap.Tiles)
|
||||
{
|
||||
if (e.NeedsUpdate)
|
||||
{
|
||||
if(e.AlwaysUpdate == 0) unbaked++;
|
||||
if(e.AlwaysUpdate != 0) dynamic++;
|
||||
|
||||
VisibleTiles.Push(&e);
|
||||
|
||||
if (VisibleTiles.Size() >= unsigned(lm_background_updates))
|
||||
break;
|
||||
if((!dynamic && (VisibleTiles.Size() >= unsigned(lm_background_updates))) || unbaked >= unsigned(lm_background_updates)) break;
|
||||
}
|
||||
}
|
||||
|
||||
if(unbaked && dynamic)
|
||||
{
|
||||
std::sort(VisibleTiles.begin(), VisibleTiles.end(), [](LightmapTile *a, LightmapTile *b){return (!!a->AlwaysUpdate) < (!!b->AlwaysUpdate);});
|
||||
}
|
||||
|
||||
if(VisibleTiles.Size() > unsigned(lm_background_updates))
|
||||
{
|
||||
VisibleTiles.Resize(lm_background_updates);
|
||||
}
|
||||
}
|
||||
screen->UpdateLightmaps(VisibleTiles);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue