Remove XFloorToSurface and XFloorToSurfaceSides as they aren't needed

This commit is contained in:
Magnus Norddahl 2023-09-30 22:56:10 +02:00
commit 61635772fe
4 changed files with 9 additions and 48 deletions

View file

@ -170,22 +170,6 @@ void DoomLevelMesh::PackLightmapAtlas()
void DoomLevelMesh::BindLightmapSurfacesToGeometry(FLevelLocals& doomMap)
{
static_cast<DoomLevelSubmesh*>(StaticMesh.get())->BindLightmapSurfacesToGeometry(doomMap);
// Runtime helper
for (auto& surface : static_cast<DoomLevelSubmesh*>(StaticMesh.get())->Surfaces)
{
if (surface.ControlSector)
{
if (surface.Type == ST_FLOOR || surface.Type == ST_CEILING)
{
XFloorToSurface[surface.Subsector->sector].Push(&surface);
}
else if (surface.Type == ST_MIDDLESIDE)
{
XFloorToSurfaceSides[surface.ControlSector].Push(&surface);
}
}
}
}
void DoomLevelMesh::DisableLightmaps()

View file

@ -140,8 +140,4 @@ public:
void BindLightmapSurfacesToGeometry(FLevelLocals& doomMap);
void DisableLightmaps();
void DumpMesh(const FString& objFilename, const FString& mtlFilename) const;
// To do: remove these. Use ffloors on flats and sides to find the 3d surfaces as that is both faster and culls better
TMap<const sector_t*, TArray<DoomLevelMeshSurface*>> XFloorToSurface;
TMap<const sector_t*, TArray<DoomLevelMeshSurface*>> XFloorToSurfaceSides;
};

View file

@ -525,36 +525,12 @@ void HWFlat::ProcessSector(HWDrawInfo *di, FRenderState& state, sector_t * front
{
for (int plane = 0; plane < 2; ++plane)
{
if (auto lightmap = sector->subsectors[i]->lightmap[plane][0])
unsigned int count = sector->e->XFloor.ffloors.Size() + 1;
for (unsigned int j = 0; j < count; j++)
{
di->PushVisibleSurface(lightmap);
}
}
}
if (auto subsectors = sector->Level->levelMesh->XFloorToSurface.CheckKey(sector))
{
for (auto* surface : *subsectors)
{
if (surface)
{
di->PushVisibleSurface(surface);
}
}
}
if (sector->e->XFloor.ffloors.Size())
{
for (auto* floor : sector->e->XFloor.ffloors)
{
if (auto sides = sector->Level->levelMesh->XFloorToSurfaceSides.CheckKey(floor->model))
{
for (auto* surface : *sides)
if (auto lightmap = sector->subsectors[i]->lightmap[plane][j])
{
if (surface)
{
di->PushVisibleSurface(surface);
}
di->PushVisibleSurface(lightmap);
}
}
}

View file

@ -1671,6 +1671,11 @@ void HWWall::BuildFFBlock(HWDrawInfo *di, FRenderState& state, seg_t * seg, F3DF
else
lightmap = seg->linedef->sidedef[0]->lightmap ? seg->linedef->sidedef[0]->lightmap[4 + roverIndex] : nullptr;
if (lightmap)
{
di->PushVisibleSurface(lightmap);
}
if (rover->flags&FF_FOG)
{
if (!di->isFullbrightScene())