summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-03-14 01:09:28 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-03-14 01:09:28 +0000
commit5248847bf08df213f574761455d12673ec1d2ac7 (patch)
tree65b3a34f84e04e07550cad957e73cba04cb5ea05 /game
parentSimplify cut loop and termination case search (diff)
downloadilt-5248847bf08df213f574761455d12673ec1d2ac7.tar.bz2
ilt-5248847bf08df213f574761455d12673ec1d2ac7.tar.xz
ilt-5248847bf08df213f574761455d12673ec1d2ac7.zip
Fix generation of halfedge extrusion extents
Diffstat (limited to 'game')
-rw-r--r--game/geoData.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index c48881f..293cd2b 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -421,9 +421,10 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
};
const auto boundaryVertex = from_vertex_handle(boundaryHeh);
+ const auto nextBoundaryVertex = to_vertex_handle(boundaryHeh);
const auto p0 = point(from_vertex_handle(prev_halfedge_handle(boundaryHeh)));
const auto p1 = point(boundaryVertex);
- const auto p2 = point(to_vertex_handle(boundaryHeh));
+ const auto p2 = point(nextBoundaryVertex);
const auto e0 = glm::normalize(vectorNormal(RelativePosition2D(p1 - p0)));
const auto e1 = glm::normalize(vectorNormal(RelativePosition2D(p2 - p1)));
@@ -465,11 +466,11 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
assert(extrusionVertex.is_valid());
}
// Half edge start/end tangents
- for (const auto p : {p1, p2}) {
+ for (const auto p : {boundaryVertex, nextBoundaryVertex}) {
VertexHandle extrusionVertex;
- extrusionExtents.emplace_back(boundaryVertex, extrusionVertex,
- doExtrusion(extrusionVertex, e1, p, -MAX_SLOPE, lowerExtent.z - 10),
- doExtrusion(extrusionVertex, e1, p, MAX_SLOPE, upperExtent.z + 10));
+ extrusionExtents.emplace_back(p, extrusionVertex,
+ doExtrusion(extrusionVertex, e1, point(p), -MAX_SLOPE, lowerExtent.z - 10),
+ doExtrusion(extrusionVertex, e1, point(p), MAX_SLOPE, upperExtent.z + 10));
assert(extrusionVertex.is_valid());
}
});