Workaround to make 3d floor side surfaces detectable

This commit is contained in:
RaveYard 2023-09-14 13:59:39 +02:00 committed by Christoph Oelckers
parent 3bf0669c57
commit 294a2c4e3c
3 changed files with 28 additions and 3 deletions

View file

@ -377,9 +377,16 @@ void DoomLevelMesh::BindLightmapSurfacesToGeometry(FLevelLocals& doomMap)
// Runtime helper
for (auto& surface : Surfaces)
{
if ((surface.Type == ST_FLOOR || surface.Type == ST_CEILING) && surface.ControlSector)
if (surface.ControlSector)
{
XFloorToSurface[surface.Subsector->sector].Push(&surface);
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);
}
}
}
}

View file

@ -51,7 +51,8 @@ public:
static_assert(alignof(FVector2) == alignof(float[2]) && sizeof(FVector2) == sizeof(float) * 2);
// runtime utility variables
TMap<sector_t*, TArray<DoomLevelMeshSurface*>> XFloorToSurface;
TMap<const sector_t*, TArray<DoomLevelMeshSurface*>> XFloorToSurface;
TMap<const sector_t*, TArray<DoomLevelMeshSurface*>> XFloorToSurfaceSides;
private:
void CreateSubsectorSurfaces(FLevelLocals &doomMap);

View file

@ -527,6 +527,23 @@ void HWFlat::ProcessSector(HWDrawInfo *di, FRenderState& state, sector_t * front
}
}
}
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 (surface)
{
state.PushVisibleSurface(surface);
}
}
}
}
}
}
//