summaryrefslogtreecommitdiff
path: root/game/geoData.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-03-30 13:47:54 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-03-30 13:47:54 +0000
commitee598b61e65e5af588f2cf577845f95f4fce9546 (patch)
tree37d346d15be67b70d274febfd0d5a78c5e2beb0a /game/geoData.cpp
parentDedupe addition of extrusions (diff)
downloadilt-ee598b61e65e5af588f2cf577845f95f4fce9546.tar.bz2
ilt-ee598b61e65e5af588f2cf577845f95f4fce9546.tar.xz
ilt-ee598b61e65e5af588f2cf577845f95f4fce9546.zip
Handle almost straight edges with a simple bisect
Diffstat (limited to 'game/geoData.cpp')
-rw-r--r--game/geoData.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index 544fae2..2339195 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -382,6 +382,7 @@ void
GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
{
static const RelativeDistance MAX_SLOPE = 1.5F;
+ static const RelativeDistance MIN_ARC = 0.01F;
if (triangleStrip.size() < 3) {
return;
@@ -453,7 +454,10 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
doExtrusion(extrusionVertex, direction, p1, MAX_SLOPE));
assert(extrusionVertex.is_valid());
};
- if (const Arc arc {e0, e1}; arc.length() < pi) {
+ if (const Arc arc {e0, e1}; arc.length() < MIN_ARC) {
+ addExtrusionFor(normalize(e0 + e1) / cosf(arc.length() / 2.F));
+ }
+ else if (arc.length() < pi) {
// Previous half edge end to current half end start arc tangents
const auto limit = std::ceil(arc.length() * 5.F / pi);
const auto inc = arc.length() / limit;