Fix lightmapper still using hacks to detect levelmesh changes

This commit is contained in:
RaveYard 2023-09-11 15:27:24 +02:00 committed by Magnus Norddahl
commit a340b69c79
3 changed files with 13 additions and 18 deletions

View file

@ -474,6 +474,7 @@ void VulkanRenderDevice::BeginFrame()
{
levelMesh->UpdateLightLists();
GetTextureManager()->CreateLightmap(levelMesh->LMTextureSize, levelMesh->LMTextureCount);
GetLightmap()->SetLevelMesh(levelMesh);
#if 0 // full lightmap generation
TArray<LevelMeshSurface*> surfaces;
@ -483,9 +484,7 @@ void VulkanRenderDevice::BeginFrame()
surfaces[i] = mesh->GetSurface(i);
}
GetLightmap()->Raytrace(mesh, surfaces);
#else
GetLightmap()->Raytrace(levelMesh, {});
GetLightmap()->Raytrace(surfaces);
#endif
}
}
@ -562,12 +561,9 @@ void VulkanRenderDevice::SetLevelMesh(LevelMesh* mesh)
void VulkanRenderDevice::UpdateLightmaps(const TArray<LevelMeshSurface*>& surfaces)
{
if (surfaces.Size() > 0)
if (surfaces.Size() > 0 && levelMesh)
{
if (levelMesh)
{
GetLightmap()->Raytrace(levelMesh, surfaces);
}
GetLightmap()->Raytrace(surfaces);
}
}