From 4cc0afe587b69ac674951e5c70a353b972af702d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 Mar 2021 20:20:00 +0200 Subject: [PATCH] - fixed texture coordinate generation for sloped planes. Since these depend on the slope, the sector's ceiling and floorz need to be the same as for the mesh when creating them. --- source/core/sectorgeometry.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index c3d8a53a3..c9e471773 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -225,6 +225,9 @@ void SectorGeometry::MakeVertices(unsigned int secnum, int plane) polygon.resize(1); curPoly = &polygon.back(); + int fz = sec->floorz, cz = sec->ceilingz; + sec->floorz = sec->ceilingz = 0; + for (int i = 0; i < numvertices; i++) { auto wal = &wall[sec->wallptr + i]; @@ -268,13 +271,9 @@ void SectorGeometry::MakeVertices(unsigned int secnum, int plane) for (auto& pt : polygon[a]) { float planez; - int fz = sec->floorz, cz = sec->ceilingz; - sec->floorz = sec->ceilingz = 0; PlanesAtPoint(sec, (pt.first * 16), (pt.second * -16), plane ? &planez : nullptr, !plane ? &planez : nullptr); FVector3 point = { pt.first, pt.second, planez }; points[p++] = point; - sec->floorz = fz; - sec->ceilingz = cz; } } @@ -293,6 +292,10 @@ void SectorGeometry::MakeVertices(unsigned int secnum, int plane) entry.vertices[i] = pt; entry.texcoords[i] = uvcalc.GetUV(int(pt.X * 16), int(pt.Y * -16), pt.Z); } + + sec->floorz = fz; + sec->ceilingz = cz; + } //==========================================================================