diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-02-25 03:10:25 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-02-25 03:10:25 +0000 |
commit | f6f085d3744990a6e80927aa17f4c5d77456d4f9 (patch) | |
tree | 4fabf3145e619311457676c10bb255f0828cb0a4 | |
parent | Add face name property and wrapper to add a named face (diff) | |
download | ilt-f6f085d3744990a6e80927aa17f4c5d77456d4f9.tar.bz2 ilt-f6f085d3744990a6e80927aa17f4c5d77456d4f9.tar.xz ilt-f6f085d3744990a6e80927aa17f4c5d77456d4f9.zip |
Primitives add named faces
-rw-r--r-- | assetFactory/cuboid.cpp | 12 | ||||
-rw-r--r-- | assetFactory/cylinder.cpp | 10 | ||||
-rw-r--r-- | assetFactory/plane.cpp | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/assetFactory/cuboid.cpp b/assetFactory/cuboid.cpp index 86114e5..24fe4a4 100644 --- a/assetFactory/cuboid.cpp +++ b/assetFactory/cuboid.cpp @@ -19,11 +19,11 @@ Cuboid::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) c const auto vhs = addMutatedToMesh(mesh, VERTICES, mutation); return { - {"top", mesh.add_face({vhs[4], vhs[5], vhs[6], vhs[7]})}, - {"bottom", mesh.add_face({vhs[0], vhs[1], vhs[2], vhs[3]})}, - {"left", mesh.add_face({vhs[0], vhs[7], vhs[6], vhs[1]})}, - {"right", mesh.add_face({vhs[2], vhs[5], vhs[4], vhs[3]})}, - {"front", mesh.add_face({vhs[0], vhs[3], vhs[4], vhs[7]})}, - {"back", mesh.add_face({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 d51dc37..cf0dbfb 100644 --- a/assetFactory/cylinder.cpp +++ b/assetFactory/cylinder.cpp @@ -28,19 +28,19 @@ Cylinder::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) const auto xyz2b = (xy2 ^ 0) % mutation; const auto xyz1t = (xy1 ^ 1) % mutation; const auto xyz2t = (xy2 ^ 1) % mutation; - return std::make_pair(std::string {"edge"}, - mesh.add_face({ + 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; } - surface.emplace("bottom", mesh.add_face(bottom)); - surface.emplace("top", mesh.add_face(top)); + surface.insert(mesh.add_namedFace("bottom", bottom)); + surface.insert(mesh.add_namedFace("top", top)); return surface; } diff --git a/assetFactory/plane.cpp b/assetFactory/plane.cpp index 37c8194..563c4e9 100644 --- a/assetFactory/plane.cpp +++ b/assetFactory/plane.cpp @@ -11,5 +11,5 @@ Plane::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) co {n, y, z}, }}; - return {{"plane", mesh.add_face(addMutatedToMesh(mesh, VERTICES, mutation))}}; + return {mesh.add_namedFace("plane", addMutatedToMesh(mesh, VERTICES, mutation))}; } |