Create DoomLevelMeshSurface

This commit is contained in:
Magnus Norddahl 2023-09-02 13:24:04 +02:00
commit e297b78a25
6 changed files with 43 additions and 29 deletions

View file

@ -102,9 +102,9 @@ void VkLightmap::RenderAtlasImage(size_t pageIndex)
};
beginPass();
for (unsigned int i = 0; i < mesh->Surfaces.Size(); i++)
for (int i = 0, count = mesh->GetSurfaceCount(); i < count; i++)
{
LevelMeshSurface* targetSurface = &mesh->Surfaces[i];
LevelMeshSurface* targetSurface = mesh->GetSurface(i);
if (targetSurface->lightmapperAtlasPage != pageIndex)
continue;
@ -203,9 +203,9 @@ void VkLightmap::CreateAtlasImages()
const int spacing = 3; // Note: the spacing is here to avoid that the resolve sampler finds data from other surface tiles
RectPacker packer(atlasImageSize, atlasImageSize, RectPacker::Spacing(spacing));
for (unsigned int i = 0; i < mesh->Surfaces.Size(); i++)
for (int i = 0, count = mesh->GetSurfaceCount(); i < count; i++)
{
LevelMeshSurface* surface = &mesh->Surfaces[i];
LevelMeshSurface* surface = mesh->GetSurface(i);
auto result = packer.insert(surface->texWidth + 2, surface->texHeight + 2);
surface->lightmapperAtlasX = result.pos.x + 1;
@ -312,9 +312,9 @@ void VkLightmap::DownloadAtlasImage(size_t pageIndex)
hvec4* pixels = (hvec4*)atlasImages[pageIndex].Transfer->Map(0, atlasImageSize * atlasImageSize * sizeof(hvec4));
for (unsigned int i = 0; i < mesh->Surfaces.Size(); i++)
for (int i = 0, count = mesh->GetSurfaceCount(); i < count; i++)
{
LevelMeshSurface* surface = &mesh->Surfaces[i];
LevelMeshSurface* surface = mesh->GetSurface(i);
if (surface->lightmapperAtlasPage != pageIndex)
continue;