summaryrefslogtreecommitdiff
path: root/assetFactory
diff options
context:
space:
mode:
Diffstat (limited to 'assetFactory')
-rw-r--r--assetFactory/faceController.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/assetFactory/faceController.cpp b/assetFactory/faceController.cpp
index 28812d8..92cc8d2 100644
--- a/assetFactory/faceController.cpp
+++ b/assetFactory/faceController.cpp
@@ -69,7 +69,6 @@ FaceController::extrude(ModelFactoryMesh & mesh, const std::string & faceName, O
});
const auto vertexCount = points.size();
const auto centre = mesh.calc_face_centroid(faceHandle);
- Shape::CreatedFaces newFaces;
// mutate points
std::for_each(points.begin(), points.end(), [mutation = getMatrix(), &centre](auto && p) {
p = centre + ((p - centre) % mutation);
@@ -79,17 +78,22 @@ FaceController::extrude(ModelFactoryMesh & mesh, const std::string & faceName, O
std::transform(points.begin(), points.end(), std::back_inserter(vertices), [&mesh](auto && p) {
return mesh.add_vertex(p);
});
+ // get new faces names
+ std::vector<std::string> faceNames;
+ for (size_t idx {}; idx < vertexCount; ++idx) {
+ const auto next = (idx + 1) % vertexCount;
+ const auto existingEdge = mesh.find_halfedge(baseVertices[idx], baseVertices[next]);
+ faceNames.push_back(mesh.property(mesh.nameAdjFaceProperty, existingEdge));
+ }
// create new faces
- const auto ofrange = materializeRange(mesh.ff_range(faceHandle));
mesh.delete_face(faceHandle);
+ Shape::CreatedFaces newFaces;
for (size_t idx {}; idx < vertexCount; ++idx) {
const auto next = (idx + 1) % vertexCount;
- const auto newFace = mesh.add_face({baseVertices[idx], baseVertices[next], vertices[next], vertices[idx]});
- auto & newFaceName = mesh.property(mesh.nameFaceProperty, newFace);
- newFaceName = getAdjacentFaceName(mesh, ofrange, newFace);
- newFaces.emplace(newFaceName, newFace);
+ newFaces.emplace(mesh.add_namedFace(
+ faceNames[idx], baseVertices[idx], baseVertices[next], vertices[next], vertices[idx]));
}
- newFaces.emplace(faceName, mesh.add_face(vertices));
+ newFaces.emplace(mesh.add_namedFace(faceName, vertices));
return newFaces;
}