summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-04-26 22:17:59 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-04-26 22:17:59 +0100
commit1cf26dffe9dd5f94c7fd5fb812d498349bfda152 (patch)
treef1a6bb3be712e438649b9ba9ca94bbbe98869738
parentSet the face surface type when setting height (diff)
downloadilt-1cf26dffe9dd5f94c7fd5fb812d498349bfda152.tar.bz2
ilt-1cf26dffe9dd5f94c7fd5fb812d498349bfda152.tar.xz
ilt-1cf26dffe9dd5f94c7fd5fb812d498349bfda152.zip
Simplify new face split loop
-rw-r--r--game/geoData.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index 59feac1..5beac94 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -487,16 +487,12 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const
const auto [a, b, c] = newVert;
add_face(a, b, c);
});
- for (auto start = faces_sbegin(); std::any_of(start, faces_end(), [this, &start](const auto fh) {
- static constexpr auto MAX_FACE_AREA = 100'000'000.F;
- if (triangle<3>(fh).area() > MAX_FACE_AREA) {
- split(fh);
- start = FaceIter {*this, FaceHandle(fh), true};
- return true;
- }
- return false;
- });) {
- ;
+ for (auto fhi = FaceIter {*this, FaceHandle {initialFaceCount}, true}; fhi != faces_end(); fhi++) {
+ static constexpr auto MAX_FACE_AREA = 100'000'000.F;
+ const auto fh = *fhi;
+ if (triangle<3>(fh).area() > MAX_FACE_AREA) {
+ split(fh);
+ }
}
std::vector<FaceHandle> newFaces;
std::copy_if(FaceIter {*this, FaceHandle {initialFaceCount}, true}, faces_end(), std::back_inserter(newFaces),