Add missing lower and upper

This commit is contained in:
Magnus Norddahl 2025-05-31 20:00:29 +02:00
commit 1d635d9a39
5 changed files with 31 additions and 14 deletions

View file

@ -329,7 +329,7 @@ void DoomLevelMesh::AddSectorsToDrawLists(const TArray<int>& sectors, LevelMeshD
}
}
void DoomLevelMesh::AddSidesToDrawLists(const TArray<int>& sides, LevelMeshDrawLists& lists)
void DoomLevelMesh::AddSidesToDrawLists(const TArray<int>& sides, LevelMeshDrawLists& lists, HWDrawInfo* di)
{
for (int sideIndex : sides)
{
@ -337,6 +337,16 @@ void DoomLevelMesh::AddSidesToDrawLists(const TArray<int>& sides, LevelMeshDrawL
{
lists.Add(di.DrawType, di.PipelineID, { di.IndexStart, di.IndexStart + di.IndexCount });
}
for (const HWMissing& missing : Sides[sideIndex].MissingUpper)
{
di->AddUpperMissingTexture(missing.side, missing.sub, missing.plane);
}
for (const HWMissing& missing : Sides[sideIndex].MissingLower)
{
di->AddLowerMissingTexture(missing.side, missing.sub, missing.plane);
}
}
}
@ -660,6 +670,8 @@ void DoomLevelMesh::FreeSide(FLevelLocals& doomMap, unsigned int sideIndex)
Sides[sideIndex].Uniforms.Clear();
Sides[sideIndex].WallPortals.Clear();
Sides[sideIndex].MissingUpper.Clear();
Sides[sideIndex].MissingLower.Clear();
Sides[sideIndex].Decals.Clear();
}
@ -1090,10 +1102,14 @@ void DoomLevelMesh::CreateSide(FLevelLocals& doomMap, unsigned int sideIndex)
state.SetRenderStyle(STYLE_Normal);
*/
for (HWWall& portal : result.portals)
{
for (const HWWall& portal : result.portals)
sideBlock.WallPortals.Push(portal);
}
for (const HWMissing& missing : result.upper)
sideBlock.MissingUpper.Push(missing);
for (const HWMissing& missing : result.lower)
sideBlock.MissingLower.Push(missing);
// Add portal surface to the level mesh so raytraces can see them
CreateWallSurface(side, disp, state, result.portals, LevelMeshDrawType::Portal, sideIndex, sideBlock.Lights);

View file

@ -19,6 +19,13 @@ struct HWDrawInfo;
class DoomLevelMesh;
class MeshBuilder;
struct HWMissing
{
side_t* side;
subsector_t* sub;
double plane;
};
struct DoomSurfaceInfo
{
DoomLevelMeshSurfaceType Type = ST_NONE;
@ -73,6 +80,8 @@ struct SideSurfaceBlock
TArray<GeometryFreeInfo> Geometries;
TArray<UniformsAllocInfo> Uniforms;
TArray<HWWall> WallPortals;
TArray<HWMissing> MissingUpper;
TArray<HWMissing> MissingLower;
TArray<HWDecalCreateInfo> Decals;
bool InSideDecalsList = false;
TArray<DrawRangeInfo> DrawRanges;
@ -143,7 +152,7 @@ public:
void ProcessDecals(HWDrawInfo* drawinfo, FRenderState& state);
void AddSectorsToDrawLists(const TArray<int>& sectors, LevelMeshDrawLists& lists);
void AddSidesToDrawLists(const TArray<int>& sides, LevelMeshDrawLists& lists);
void AddSidesToDrawLists(const TArray<int>& sides, LevelMeshDrawLists& lists, HWDrawInfo* di);
TArray<HWWall>& GetSidePortals(int sideIndex);

View file

@ -575,7 +575,7 @@ void HWDrawInfo::CreateScene(bool drawpsprites, FRenderState& state)
SeenFlatsDrawLists.Clear();
SeenSidesDrawLists.Clear();
level.levelMesh->AddSectorsToDrawLists(SeenSectors.Get(), SeenFlatsDrawLists);
level.levelMesh->AddSidesToDrawLists(SeenSides.Get(), SeenSidesDrawLists);
level.levelMesh->AddSidesToDrawLists(SeenSides.Get(), SeenSidesDrawLists, this);
// And now the crappy hacks that have to be done to avoid rendering anomalies.
// These cannot be multithreaded when the time comes because all these depend

View file

@ -96,7 +96,6 @@ enum DrawListType
GLDL_TYPES,
};
struct HWDrawInfo
{
struct wallseg

View file

@ -1,12 +1,5 @@
#pragma once
struct HWMissing
{
side_t* side;
subsector_t* sub;
double plane;
};
struct HWMeshHelper
{
TArray<HWWall> opaque;