summaryrefslogtreecommitdiff
path: root/assetFactory
diff options
context:
space:
mode:
Diffstat (limited to 'assetFactory')
-rw-r--r--assetFactory/cuboid.cpp12
-rw-r--r--assetFactory/cylinder.cpp10
-rw-r--r--assetFactory/modelFactoryMesh.cpp8
-rw-r--r--assetFactory/modelFactoryMesh.h9
4 files changed, 17 insertions, 22 deletions
diff --git a/assetFactory/cuboid.cpp b/assetFactory/cuboid.cpp
index 03b1304..f200258 100644
--- a/assetFactory/cuboid.cpp
+++ b/assetFactory/cuboid.cpp
@@ -19,11 +19,11 @@ Cuboid::createMesh(ModelFactoryMesh & mesh, float) const
const auto vhs = addToMesh(mesh, VERTICES);
return {
- mesh.add_namedFace("top", {vhs[4], vhs[5], vhs[6], vhs[7]}),
- mesh.add_namedFace("bottom", {vhs[0], vhs[1], vhs[2], vhs[3]}),
- mesh.add_namedFace("left", {vhs[0], vhs[7], vhs[6], vhs[1]}),
- mesh.add_namedFace("right", {vhs[2], vhs[5], vhs[4], vhs[3]}),
- mesh.add_namedFace("front", {vhs[0], vhs[3], vhs[4], vhs[7]}),
- mesh.add_namedFace("back", {vhs[2], vhs[1], vhs[6], vhs[5]}),
+ mesh.add_namedFace("top", vhs[4], vhs[5], vhs[6], vhs[7]),
+ mesh.add_namedFace("bottom", vhs[0], vhs[1], vhs[2], vhs[3]),
+ mesh.add_namedFace("left", vhs[0], vhs[7], vhs[6], vhs[1]),
+ mesh.add_namedFace("right", vhs[2], vhs[5], vhs[4], vhs[3]),
+ mesh.add_namedFace("front", vhs[0], vhs[3], vhs[4], vhs[7]),
+ mesh.add_namedFace("back", vhs[2], vhs[1], vhs[6], vhs[5]),
};
}
diff --git a/assetFactory/cylinder.cpp b/assetFactory/cylinder.cpp
index e32ebcb..ca08bf8 100644
--- a/assetFactory/cylinder.cpp
+++ b/assetFactory/cylinder.cpp
@@ -25,13 +25,9 @@ Cylinder::createMesh(ModelFactoryMesh & mesh, float lodf) const
const auto xyz2b = (xy2 ^ 0);
const auto xyz1t = (xy1 ^ 1);
const auto xyz2t = (xy2 ^ 1);
- return mesh.add_namedFace("edge",
- {
- mesh.add_vertex({xyz1b.x, xyz1b.y, xyz1b.z}),
- mesh.add_vertex({xyz2b.x, xyz2b.y, xyz2b.z}),
- mesh.add_vertex({xyz2t.x, xyz2t.y, xyz2t.z}),
- mesh.add_vertex({xyz1t.x, xyz1t.y, xyz1t.z}),
- });
+ return mesh.add_namedFace("edge", mesh.add_vertex({xyz1b.x, xyz1b.y, xyz1b.z}),
+ mesh.add_vertex({xyz2b.x, xyz2b.y, xyz2b.z}), mesh.add_vertex({xyz2t.x, xyz2t.y, xyz2t.z}),
+ mesh.add_vertex({xyz1t.x, xyz1t.y, xyz1t.z}));
});
for (const auto & [name, face] : surface) {
mesh.property(mesh.smoothFaceProperty, face) = true;
diff --git a/assetFactory/modelFactoryMesh.cpp b/assetFactory/modelFactoryMesh.cpp
index f9ee6a0..806ac3b 100644
--- a/assetFactory/modelFactoryMesh.cpp
+++ b/assetFactory/modelFactoryMesh.cpp
@@ -5,11 +5,3 @@ ModelFactoryMesh::ModelFactoryMesh()
add_property(smoothFaceProperty);
add_property(nameFaceProperty);
}
-
-std::pair<std::string, OpenMesh::FaceHandle>
-ModelFactoryMesh::add_namedFace(std::string name, std::vector<OpenMesh::VertexHandle> p)
-{
- const auto handle = add_face(std::move(p));
- property(nameFaceProperty, handle) = name;
- return std::make_pair(name, handle);
-}
diff --git a/assetFactory/modelFactoryMesh.h b/assetFactory/modelFactoryMesh.h
index 258913b..ea5f011 100644
--- a/assetFactory/modelFactoryMesh.h
+++ b/assetFactory/modelFactoryMesh.h
@@ -35,5 +35,12 @@ struct ModelFactoryMesh : public OpenMesh::PolyMesh_ArrayKernelT<ModelFactoryTra
OpenMesh::FPropHandleT<bool> smoothFaceProperty;
OpenMesh::FPropHandleT<std::string> nameFaceProperty;
- std::pair<std::string, OpenMesh::FaceHandle> add_namedFace(std::string name, std::vector<OpenMesh::VertexHandle> p);
+ template<typename... Vs>
+ std::pair<std::string, OpenMesh::FaceHandle>
+ add_namedFace(std::string name, Vs &&... vs)
+ {
+ const auto handle = add_face(std::forward<Vs>(vs)...);
+ property(nameFaceProperty, handle) = name;
+ return std::make_pair(name, handle);
+ }
};