diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-11-24 01:45:31 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-11-24 01:50:11 +0000 |
commit | 2a2271fa0f60279a94c0218026cd296fe5b4aee1 (patch) | |
tree | d269d6b0aa04df920b547bd27a7298cb86dc6914 /game | |
parent | Add Triangle::centroid (diff) | |
download | ilt-2a2271fa0f60279a94c0218026cd296fe5b4aee1.tar.bz2 ilt-2a2271fa0f60279a94c0218026cd296fe5b4aee1.tar.xz ilt-2a2271fa0f60279a94c0218026cd296fe5b4aee1.zip |
Surface walk to set face surface property
Diffstat (limited to 'game')
-rw-r--r-- | game/geoData.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp index cc9a056..cd0be29 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -545,5 +545,19 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const } done.insert(heh); } + + auto surfaceStripWalk = [this, &getTriangle, &opts](const auto & surfaceStripWalk, const auto & face) -> void { + if (!property(surface, face)) { + property(surface, face) = &opts.surface; + std::ranges::for_each( + ff_range(face), [this, &getTriangle, &surfaceStripWalk](const auto & adjacentFaceHandle) { + if (getTriangle(this->triangle<2>(adjacentFaceHandle).centroid())) { + surfaceStripWalk(surfaceStripWalk, adjacentFaceHandle); + } + }); + } + }; + surfaceStripWalk(surfaceStripWalk, findPoint(strip.front().centroid())); + update_vertex_normals_only(VertexIter {*this, vertex_handle(initialVertexCount), true}); } |