summaryrefslogtreecommitdiff
path: root/game/geoData.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-04-26 16:34:19 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-04-26 16:34:19 +0100
commit0d0a9b2f56bedc0b9394b2ad9a1199ef2907f8f2 (patch)
treeff33d20acf1e6a672b217b928d6b0176147207a9 /game/geoData.cpp
parentDon't return newly created faces from split (diff)
downloadilt-0d0a9b2f56bedc0b9394b2ad9a1199ef2907f8f2.tar.bz2
ilt-0d0a9b2f56bedc0b9394b2ad9a1199ef2907f8f2.tar.xz
ilt-0d0a9b2f56bedc0b9394b2ad9a1199ef2907f8f2.zip
Set the face surface type when setting height
Diffstat (limited to 'game/geoData.cpp')
-rw-r--r--game/geoData.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index 68a1298..59feac1 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -464,7 +464,7 @@ GeoData::split(FaceHandle _fh)
}
void
-GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
+GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const Surface & newFaceSurface)
{
static const RelativeDistance MAX_SLOPE = 1.5F;
static const RelativeDistance MIN_ARC = 0.01F;
@@ -482,6 +482,7 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
return add_vertex(tsVert);
});
// Create new faces
+ const auto initialFaceCount = static_cast<int>(n_faces());
std::for_each(strip_begin(newVerts), strip_end(newVerts), [this](const auto & newVert) {
const auto [a, b, c] = newVert;
add_face(a, b, c);
@@ -497,6 +498,11 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
});) {
;
}
+ std::vector<FaceHandle> newFaces;
+ std::copy_if(FaceIter {*this, FaceHandle {initialFaceCount}, true}, faces_end(), std::back_inserter(newFaces),
+ [this](FaceHandle fh) {
+ return !this->status(fh).deleted();
+ });
// Extrude corners
struct Extrusion {
@@ -667,4 +673,8 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
// Tidy up
update_vertex_normals_only(VertexIter {*this, vertex_handle(initialVertexCount), true});
+
+ std::for_each(newFaces.begin(), newFaces.end(), [&newFaceSurface, this](const auto fh) {
+ property(surface, fh) = &newFaceSurface;
+ });
}