Skip sides that have no valid texture

This commit is contained in:
Magnus Norddahl 2024-01-17 00:04:27 +01:00
parent 01cd022fd6
commit 13df9b2b32
3 changed files with 22 additions and 4 deletions

View file

@ -118,7 +118,18 @@ public:
HIT_Columnmode = HIT_Wall | HIT_Sky | HIT_Sprite
};
FTextureID CheckForTexture(const char* name, ETextureType usetype, uint32_t flags = TEXMAN_TryAny) { return {}; }
FTextureID CheckForTexture(const char* name, ETextureType usetype, uint32_t flags = TEXMAN_TryAny)
{
if (name == nullptr || name[0] == '\0')
return FTextureID(-1);
if (name[0] == '-' && name[1] == '\0')
return FTextureID(0);
// To do: actually build up a list of texture ids
return FTextureID(1);
}
};
extern FTextureManager TexMan;

View file

@ -99,7 +99,12 @@ struct IntSideDef
SideDefSampleProps sampling;
TArray<UDMFKey> props;
FTextureID GetTexture(WallPart part) { return FNullTextureID(); }
FTextureID GetTexture(WallPart part)
{
const char* names[3] = { toptexture, midtexture, bottomtexture };
return TexMan.CheckForTexture(names[(int)part], ETextureType::Wall);
}
float GetTextureYOffset(WallPart part) { return 0.0f; }
float GetTextureYScale(WallPart part) { return 1.0f; }

View file

@ -111,7 +111,10 @@ void DoomLevelSubmesh::CreateSideSurfaces(std::map<LightmapTileBinding, int>& bi
}
else if (!back)
{
CreateFrontWallSurface(bindings, doomMap, side);
if (side->GetTexture(WallPart::MIDDLE).isValid())
{
CreateFrontWallSurface(bindings, doomMap, side);
}
}
else
{
@ -195,7 +198,6 @@ void DoomLevelSubmesh::CreateLineHorizonSurface(std::map<LightmapTileBinding, in
AddWallVertices(surf, verts);
SetSideTextureUVs(surf, side, WallPart::TOP, v1Top, v1Bottom, v2Top, v2Bottom);
AddSurfaceToTile(surf, bindings, doomMap, side->GetSampleDistance(WallPart::MIDDLE));
Surfaces.Push(surf);
}