From a74580123fe36ba1227611c3703c1fe1a520719a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 9 Mar 2023 01:41:26 +0000 Subject: Refactor of asset factory to address mutation/face controller logic Fixes issue where face controller extrusions applied to a rotated or scaled mesh would be applied incorrectly. Now we create the mesh at the origin, deform it as required (scale), apply face controllers and finally relocate it as required (position and rotation). A relative level of detail is cascade into the generation for shapes like cylinder, which generate fewer faces for small objects. --- assetFactory/shape.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'assetFactory/shape.cpp') diff --git a/assetFactory/shape.cpp b/assetFactory/shape.cpp index f6e55e8..ec6594e 100644 --- a/assetFactory/shape.cpp +++ b/assetFactory/shape.cpp @@ -5,12 +5,10 @@ #include "shape.h" std::vector -Shape::addMutatedToMesh( - ModelFactoryMesh & mesh, const std::span vertices, const Mutation::Matrix & mutation) +Shape::addToMesh(ModelFactoryMesh & mesh, const std::span vertices) { std::vector vhs; - std::transform(vertices.begin(), vertices.end(), std::back_inserter(vhs), [&mesh, &mutation](const auto & v) { - const auto p = v % mutation; + std::transform(vertices.begin(), vertices.end(), std::back_inserter(vhs), [&mesh](const auto & p) { return mesh.add_vertex({p.x, p.y, p.z}); }); return vhs; -- cgit v1.2.3