summaryrefslogtreecommitdiff
path: root/assetFactory/faceController.h
blob: e940640f02e7fa22c7fd57f8e79bcbbd0e7582bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once

#include "geometricPlane.h"
#include "modelFactoryMesh_fwd.h"
#include "mutation.h"
#include "persistence.h"
#include "shape.h"
#include "style.h"
#include <map>
#include <string>

class FaceController : public Mutation, public Style, public Persistence::Persistable {
public:
	class Split : public Persistable, public GeometricPlaneT<RelativePosition3D> {
	public:
		std::string id;

	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;

	std::string id;
	std::string type;
	FaceControllers faceControllers;
	Splits splits;

private:
	friend Persistence::SelectionPtrBase<std::unique_ptr<FaceController>>;
	bool persist(Persistence::PersistenceStore & store) override;

	std::string
	getId() const override
	{
		return {};
	};

	void applySingle(ModelFactoryMesh & mesh, const Style::StyleStack & parents, const std::string & name,
			Shape::CreatedFaces & faces) const;
	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;
};