From fe38b3887b695f27baf791df34b7361ee11b379f Mon Sep 17 00:00:00 2001
From: Dan Goodliffe <dan@randomdan.homeip.net>
Date: Sun, 3 Nov 2024 22:00:46 +0000
Subject: Remove extrusion extents that rounded to the same vertex

---
 game/geoData.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'game')

diff --git a/game/geoData.cpp b/game/geoData.cpp
index 8975d46..1a1e530 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -558,6 +558,14 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const
 							doExtrusion(extrusionVertex, direction, p1, -MAX_SLOPE),
 							doExtrusion(extrusionVertex, direction, p1, MAX_SLOPE));
 					assert(extrusionVertex.is_valid());
+					if (extrusionExtents.size() >= 2) {
+						const auto & last = *extrusionExtents.rbegin();
+						const auto & prev = *++extrusionExtents.rbegin();
+						if (last.boundaryVertex == prev.boundaryVertex
+								&& last.extrusionVertex == prev.extrusionVertex) {
+							extrusionExtents.pop_back();
+						}
+					}
 				};
 				if (const Arc arc {e0, e1}; arc.length() < MIN_ARC) {
 					addExtrusionFor(normalize(e0 + e1) / cosf(arc.length() / 2.F));
-- 
cgit v1.2.3