diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-03-31 20:31:15 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-03-31 20:35:37 +0100 |
commit | ac71ff90e86baa549904794375ebb2f9245d92b2 (patch) | |
tree | adc8854c16878a4a19d9d6f2fd16a9a82817b386 /game/geoData.cpp | |
parent | Split faces with two large boundary sides (diff) | |
download | ilt-ac71ff90e86baa549904794375ebb2f9245d92b2.tar.bz2 ilt-ac71ff90e86baa549904794375ebb2f9245d92b2.tar.xz ilt-ac71ff90e86baa549904794375ebb2f9245d92b2.zip |
Split long boundary edges
Diffstat (limited to 'game/geoData.cpp')
-rw-r--r-- | game/geoData.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp index d179c47..931eb6a 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -391,6 +391,9 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip) auto hehlength = [diff](const auto heh) { return glm::length(diff(heh)); }; + auto hehcentre = [this, diff](const auto heh) { + return point(from_vertex_handle(heh)) + (diff(heh) / 2.F); + }; if (triangleStrip.size() < 3) { return; @@ -424,6 +427,19 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip) split(faceHandle, centre); }, *voh_begin(newVerts.front())); + // Split long boundary edges + while ([hehlength, hehcentre, this, start = *voh_begin(newVerts.front())]() { + size_t countSplit = 0; + boundaryWalk( + [this, &countSplit, hehlength, hehcentre](const auto boundaryHeh) { + if (hehlength(boundaryHeh) > MAX_EDGE_LENGTH) { + split(edge_handle(boundaryHeh), hehcentre(boundaryHeh)); + ++countSplit; + } + }, + start); + return countSplit; + }() > 0) { } // Extrude corners struct Extrusion { |