Group LightList variables

This commit is contained in:
Magnus Norddahl 2023-09-30 21:46:27 +02:00
commit b5095a4790
2 changed files with 14 additions and 10 deletions

View file

@ -79,11 +79,15 @@ struct LevelMeshSurface
//
// Utility/Info
//
inline uint32_t Area() const { return AtlasTile.Width * AtlasTile.Height; }
uint32_t Area() const { return AtlasTile.Width * AtlasTile.Height; }
int LightListPos = -1;
int LightListCount = 0;
int LightListResetCounter = -1;
// Light list location in the lightmapper GPU buffers
struct
{
int Pos = -1;
int Count = 0;
int ResetCounter = -1;
} LightList;
};
inline float IsInFrontOfPlane(const FVector4& plane, const FVector3& point)

View file

@ -183,7 +183,7 @@ void VkLightmap::Render()
// Paint all surfaces visible in the tile
for (LevelMeshSurface* surface : targetSurface->tileSurfaces)
{
if (surface->LightListResetCounter != lights.ResetCounter)
if (surface->LightList.ResetCounter != lights.ResetCounter)
{
int lightCount = mesh->AddSurfaceLights(surface, templightlist.Data(), (int)templightlist.Size());
@ -194,9 +194,9 @@ void VkLightmap::Render()
break;
}
surface->LightListPos = lights.Pos;
surface->LightListCount = lightCount;
surface->LightListResetCounter = lights.ResetCounter;
surface->LightList.Pos = lights.Pos;
surface->LightList.Count = lightCount;
surface->LightList.ResetCounter = lights.ResetCounter;
LightInfo* lightinfo = &lights.Lights[lights.Pos];
for (int i = 0; i < lightCount; i++)
@ -216,8 +216,8 @@ void VkLightmap::Render()
lights.Pos += lightCount;
}
pc.LightStart = surface->LightListPos;
pc.LightEnd = pc.LightStart + surface->LightListCount;
pc.LightStart = surface->LightList.Pos;
pc.LightEnd = pc.LightStart + surface->LightList.Count;
#ifdef USE_DRAWINDIRECT
VkDrawIndexedIndirectCommand cmd;