diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-08-18 16:18:34 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-08-18 16:18:34 +0100 |
commit | d56d17794ce60f943bc0a08d720412780741e76e (patch) | |
tree | 161c363721c661aca523a641a2832f5d7130fd67 /assetFactory | |
parent | Don't set face material on each vertex index pass (diff) | |
download | ilt-d56d17794ce60f943bc0a08d720412780741e76e.tar.bz2 ilt-d56d17794ce60f943bc0a08d720412780741e76e.tar.xz ilt-d56d17794ce60f943bc0a08d720412780741e76e.zip |
Don't create lots of unnecessary tmps
Diffstat (limited to 'assetFactory')
-rw-r--r-- | assetFactory/factoryMesh.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/assetFactory/factoryMesh.cpp b/assetFactory/factoryMesh.cpp index bf4706e..eb9d525 100644 --- a/assetFactory/factoryMesh.cpp +++ b/assetFactory/factoryMesh.cpp @@ -25,11 +25,12 @@ FactoryMesh::createMesh() const std::vector<unsigned int> faceIndices; for (const auto & heh : mesh.fh_range(face)) { const auto & vertex = mesh.to_vertex_handle(heh); - const auto & textureUV = mesh.texcoord2D(heh); - const auto & point = mesh.point(vertex); - const auto & normal = useVertexNormals ? mesh.property(mesh.vertex_normals_pph(), vertex) - : mesh.property(mesh.face_normals_pph(), face); - Vertex outVertex {point * 1000.F, textureUV, normal, colour, material}; + Vertex outVertex {.pos = mesh.point(vertex) * 1000.F, + .texCoord = mesh.texcoord2D(heh), + .normal = useVertexNormals ? mesh.property(mesh.vertex_normals_pph(), vertex) + : mesh.property(mesh.face_normals_pph(), face), + .colour = colour, + .material = material}; if (const auto existingItr = std::find(vertices.rbegin(), vertices.rend(), outVertex); existingItr != vertices.rend()) { faceIndices.push_back(static_cast<unsigned int>(std::distance(existingItr, vertices.rend()) - 1)); |