summaryrefslogtreecommitdiff
path: root/assetFactory/faceController.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-07 23:55:09 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-07 23:55:09 +0100
commit2bcbb86db4061e32005adea8806e4ac552691bcf (patch)
tree28a7142314632b695f8e278798823b1b7041e243 /assetFactory/faceController.h
parentAdd timeouts to asset factory tests (diff)
downloadilt-2bcbb86db4061e32005adea8806e4ac552691bcf.tar.bz2
ilt-2bcbb86db4061e32005adea8806e4ac552691bcf.tar.xz
ilt-2bcbb86db4061e32005adea8806e4ac552691bcf.zip
Extend face controller to support splitting a face along a plane
Individual parts of the splits faces can then be styled separately
Diffstat (limited to 'assetFactory/faceController.h')
-rw-r--r--assetFactory/faceController.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/assetFactory/faceController.h b/assetFactory/faceController.h
index 851292a..91860f4 100644
--- a/assetFactory/faceController.h
+++ b/assetFactory/faceController.h
@@ -10,7 +10,22 @@
class FaceController : public Mutation, public Style, public Persistence::Persistable {
public:
+ class Split : public Persistable {
+ public:
+ std::string id;
+ glm::vec3 origin, normal;
+
+ private:
+ friend Persistence::SelectionPtrBase<std::unique_ptr<Split>>;
+ bool persist(Persistence::PersistenceStore & store) override;
+ std::string
+ getId() const override
+ {
+ return {};
+ };
+ };
using FaceControllers = std::map<std::string, std::unique_ptr<FaceController>>;
+ using Splits = std::map<std::string, std::unique_ptr<Split>>;
void apply(ModelFactoryMesh & mesh, const Style::StyleStack & parents, const std::string & names,
Shape::CreatedFaces & faces) const;
@@ -18,6 +33,7 @@ public:
std::string id;
std::string type;
FaceControllers faceControllers;
+ Splits splits;
private:
friend Persistence::SelectionPtrBase<std::unique_ptr<FaceController>>;
@@ -33,4 +49,6 @@ private:
static std::string getAdjacentFaceName(const ModelFactoryMesh & mesh,
const std::span<const OpenMesh::FaceHandle> ofrange, OpenMesh::FaceHandle nf);
Shape::CreatedFaces extrude(ModelFactoryMesh & mesh, const std::string & faceName, OpenMesh::FaceHandle) const;
+ Shape::CreatedFaces split(
+ ModelFactoryMesh & mesh, const std::string & faceName, OpenMesh::FaceHandle &, const Split &) const;
};