summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-02-16 23:54:22 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-02-16 23:54:22 +0000
commitc22c676dfee583bd48e1f962378f580f8310838b (patch)
treea060664c21934da0c54d54ac42f0a5ded5813498
parentFirst cut of the model factory and the hardcoded Brush 47 model (diff)
downloadilt-c22c676dfee583bd48e1f962378f580f8310838b.tar.bz2
ilt-c22c676dfee583bd48e1f962378f580f8310838b.tar.xz
ilt-c22c676dfee583bd48e1f962378f580f8310838b.zip
Refactor so ModelFactoryMesh can define the smooth property on faces
-rw-r--r--assetFactory/assetFactoryConfig_fwd.h8
-rw-r--r--assetFactory/cuboid.cpp2
-rw-r--r--assetFactory/cylinder.cpp2
-rw-r--r--assetFactory/faceController.cpp2
-rw-r--r--assetFactory/faceController.h2
-rw-r--r--assetFactory/factoryMesh.cpp2
-rw-r--r--assetFactory/modelFactory.cpp2
-rw-r--r--assetFactory/modelFactoryMesh.cpp6
-rw-r--r--assetFactory/modelFactoryMesh.h (renamed from assetFactory/assetFactoryConfig.h)8
-rw-r--r--assetFactory/modelFactoryMesh_fwd.h3
-rw-r--r--assetFactory/plane.cpp2
-rw-r--r--assetFactory/shape.cpp2
-rw-r--r--assetFactory/shape.h2
-rw-r--r--assetFactory/use.h2
14 files changed, 26 insertions, 19 deletions
diff --git a/assetFactory/assetFactoryConfig_fwd.h b/assetFactory/assetFactoryConfig_fwd.h
deleted file mode 100644
index 28489ff..0000000
--- a/assetFactory/assetFactoryConfig_fwd.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-namespace OpenMesh {
- template<typename> class PolyMesh_ArrayKernelT;
-}
-struct ModelFactoryTraits;
-
-using ModelFactoryMesh = OpenMesh::PolyMesh_ArrayKernelT<ModelFactoryTraits>;
diff --git a/assetFactory/cuboid.cpp b/assetFactory/cuboid.cpp
index 90b2108..86114e5 100644
--- a/assetFactory/cuboid.cpp
+++ b/assetFactory/cuboid.cpp
@@ -1,5 +1,5 @@
#include "cuboid.h"
-#include "assetFactoryConfig.h"
+#include "modelFactoryMesh.h"
Cuboid::CreatedFaces
Cuboid::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) const
diff --git a/assetFactory/cylinder.cpp b/assetFactory/cylinder.cpp
index 66d456d..83cf035 100644
--- a/assetFactory/cylinder.cpp
+++ b/assetFactory/cylinder.cpp
@@ -1,6 +1,6 @@
#include "cylinder.h"
-#include "assetFactoryConfig.h"
#include "maths.h"
+#include "modelFactoryMesh.h"
Cylinder::CreatedFaces
Cylinder::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) const
diff --git a/assetFactory/faceController.cpp b/assetFactory/faceController.cpp
index bdef74b..c04a656 100644
--- a/assetFactory/faceController.cpp
+++ b/assetFactory/faceController.cpp
@@ -1,6 +1,6 @@
#include "faceController.h"
-#include "assetFactoryConfig.h"
#include "maths.h"
+#include "modelFactoryMesh.h"
void
FaceController::apply(ModelFactoryMesh & mesh, const std::string & name, Shape::CreatedFaces & faces) const
diff --git a/assetFactory/faceController.h b/assetFactory/faceController.h
index 64c33f3..9974caf 100644
--- a/assetFactory/faceController.h
+++ b/assetFactory/faceController.h
@@ -1,6 +1,6 @@
#pragma once
-#include "assetFactoryConfig_fwd.h"
+#include "modelFactoryMesh_fwd.h"
#include "mutation.h"
#include "shape.h"
#include <map>
diff --git a/assetFactory/factoryMesh.cpp b/assetFactory/factoryMesh.cpp
index 1b89d14..9d30ac9 100644
--- a/assetFactory/factoryMesh.cpp
+++ b/assetFactory/factoryMesh.cpp
@@ -1,7 +1,7 @@
#include "factoryMesh.h"
-#include "assetFactoryConfig.h"
#include "collections.hpp"
#include "gfx/models/vertex.hpp"
+#include "modelFactoryMesh.h"
#include <glm/ext/matrix_transform.hpp>
Mesh::Ptr
diff --git a/assetFactory/modelFactory.cpp b/assetFactory/modelFactory.cpp
index 3a89157..4c25e48 100644
--- a/assetFactory/modelFactory.cpp
+++ b/assetFactory/modelFactory.cpp
@@ -1,7 +1,7 @@
#include "modelFactory.h"
-#include "assetFactoryConfig.h"
#include "cuboid.h"
#include "cylinder.h"
+#include "modelFactoryMesh_fwd.h"
#include "plane.h"
ModelFactory::ModelFactory() :
diff --git a/assetFactory/modelFactoryMesh.cpp b/assetFactory/modelFactoryMesh.cpp
new file mode 100644
index 0000000..6c772ad
--- /dev/null
+++ b/assetFactory/modelFactoryMesh.cpp
@@ -0,0 +1,6 @@
+#include "modelFactoryMesh.h"
+
+ModelFactoryMesh::ModelFactoryMesh()
+{
+ add_property(smoothFaceProperty);
+}
diff --git a/assetFactory/assetFactoryConfig.h b/assetFactory/modelFactoryMesh.h
index 171b81a..d0ffc26 100644
--- a/assetFactory/assetFactoryConfig.h
+++ b/assetFactory/modelFactoryMesh.h
@@ -1,6 +1,6 @@
#pragma once
-#include "assetFactoryConfig_fwd.h"
+#include "modelFactoryMesh_fwd.h"
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
#include <OpenMesh/Core/Mesh/Traits.hh>
#include <glm/geometric.hpp>
@@ -26,3 +26,9 @@ struct ModelFactoryTraits : public OpenMesh::DefaultTraits {
using Point = OpenMesh::glmvec<float, 3>;
using Normal = OpenMesh::glmvec<float, 3>;
};
+
+struct ModelFactoryMesh : public OpenMesh::PolyMesh_ArrayKernelT<ModelFactoryTraits> {
+ ModelFactoryMesh();
+
+ OpenMesh::FPropHandleT<bool> smoothFaceProperty;
+};
diff --git a/assetFactory/modelFactoryMesh_fwd.h b/assetFactory/modelFactoryMesh_fwd.h
new file mode 100644
index 0000000..ac10f2d
--- /dev/null
+++ b/assetFactory/modelFactoryMesh_fwd.h
@@ -0,0 +1,3 @@
+#pragma once
+
+struct ModelFactoryMesh;
diff --git a/assetFactory/plane.cpp b/assetFactory/plane.cpp
index 1e522ad..37c8194 100644
--- a/assetFactory/plane.cpp
+++ b/assetFactory/plane.cpp
@@ -1,5 +1,5 @@
#include "plane.h"
-#include "assetFactoryConfig.h"
+#include "modelFactoryMesh.h"
Plane::CreatedFaces
Plane::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) const
diff --git a/assetFactory/shape.cpp b/assetFactory/shape.cpp
index 0994898..f6e55e8 100644
--- a/assetFactory/shape.cpp
+++ b/assetFactory/shape.cpp
@@ -1,7 +1,7 @@
#include "shape.h"
-#include "assetFactoryConfig.h"
#include "gfx/models/vertex.hpp"
#include "maths.h"
+#include "modelFactoryMesh.h"
#include "shape.h"
std::vector<OpenMesh::VertexHandle>
diff --git a/assetFactory/shape.h b/assetFactory/shape.h
index 9510538..5a2b59c 100644
--- a/assetFactory/shape.h
+++ b/assetFactory/shape.h
@@ -1,6 +1,6 @@
#pragma once
-#include "assetFactoryConfig_fwd.h"
+#include "modelFactoryMesh_fwd.h"
#include "mutation.h"
#include "stdTypeDefs.hpp"
#include <OpenMesh/Core/Mesh/Handles.hh>
diff --git a/assetFactory/use.h b/assetFactory/use.h
index 4bfce97..28f5459 100644
--- a/assetFactory/use.h
+++ b/assetFactory/use.h
@@ -1,7 +1,7 @@
#pragma once
-#include "assetFactoryConfig_fwd.h"
#include "faceController.h"
+#include "modelFactoryMesh_fwd.h"
#include "shape.h"
#include "stdTypeDefs.hpp"