From 1cf26dffe9dd5f94c7fd5fb812d498349bfda152 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 26 Apr 2024 22:17:59 +0100 Subject: Simplify new face split loop --- game/geoData.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'game') 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 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 newFaces; std::copy_if(FaceIter {*this, FaceHandle {initialFaceCount}, true}, faces_end(), std::back_inserter(newFaces), -- cgit v1.2.3