summaryrefslogtreecommitdiff
path: root/game/geoData.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-12-21 13:38:51 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-12-21 13:38:51 +0000
commitc99b75bc628469c860970ffdc8268a438740190e (patch)
tree3c27424d686db633bd113494693e84d1c1e7abdc /game/geoData.cpp
parentFix calculating radius and length of curved links (diff)
downloadilt-c99b75bc628469c860970ffdc8268a438740190e.tar.bz2
ilt-c99b75bc628469c860970ffdc8268a438740190e.tar.xz
ilt-c99b75bc628469c860970ffdc8268a438740190e.zip
Set height when reusing vertices during setHeights
Diffstat (limited to 'game/geoData.cpp')
-rw-r--r--game/geoData.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index eef5dc7..d15a51b 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -451,6 +451,7 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const
std::views::iota(fv_begin(face), fv_end(face)) | std::views::transform(vertexDistFrom(tsPoint)), {},
&std::pair<VertexHandle, float>::second);
nearest.second < opts.nearNodeTolerance) {
+ point(nearest.first).z = tsPoint.z;
return nearest.first;
}
// Check edges
@@ -512,16 +513,16 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const
if (linesCross(startPoint, endPoint, nextPoints.front().second, nextPoints.back().second)) {
if (const auto intersection = linesIntersectAt(startPoint.xy(), endPoint.xy(),
nextPoints.front().second.xy(), nextPoints.back().second.xy())) {
- const auto newPosition = positionOnTriangle(*intersection, triangle);
if (const auto nextDist
= std::ranges::min(nexts | std::views::transform(vertexDistFrom(*intersection)), {},
&std::pair<VertexHandle, float>::second);
nextDist.second < opts.nearNodeTolerance) {
+ point(nextDist.first).z = positionOnTriangle(point(nextDist.first), triangle).z;
start = nextDist.first;
return true;
}
else {
- start = split(edge_handle(next), newPosition);
+ start = split(edge_handle(next), positionOnTriangle(*intersection, triangle));
}
addVertexForNormalUpdate(start);
boundaryTriangles.emplace(start, &triangle);