summaryrefslogtreecommitdiff
path: root/assetFactory
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-03-19 23:52:22 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-03-19 23:52:22 +0000
commitd862385c8956b9cc1002323feddf0b65a777a1c1 (patch)
tree0c88f42c9b85b265aca0fb958420a92a26fad8ca /assetFactory
parentDedupe vertices during asset factory mesh build (diff)
downloadilt-d862385c8956b9cc1002323feddf0b65a777a1c1.tar.bz2
ilt-d862385c8956b9cc1002323feddf0b65a777a1c1.tar.xz
ilt-d862385c8956b9cc1002323feddf0b65a777a1c1.zip
Use OpenMesh built-in to calculate face centre
Diffstat (limited to 'assetFactory')
-rw-r--r--assetFactory/faceController.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/assetFactory/faceController.cpp b/assetFactory/faceController.cpp
index 1ec1467..2fb0412 100644
--- a/assetFactory/faceController.cpp
+++ b/assetFactory/faceController.cpp
@@ -33,8 +33,7 @@ FaceController::apply(ModelFactoryMesh & mesh, const StyleStack & parents, const
return std::move(out);
});
const auto vertexCount = points.size();
- const auto centre
- = std::accumulate(points.begin(), points.end(), glm::vec3 {}) / static_cast<float>(vertexCount);
+ const auto centre = mesh.calc_face_centroid(cf.second);
if (type == "extrude") {
Shape::CreatedFaces newFaces;
// mutate points