From 5db4aa121eea20965a55b447d01c8f8dcf8ee97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 19 Jun 2023 12:49:33 +0200 Subject: [PATCH] MeshTools: minor code motion. --- src/Magnum/MeshTools/Combine.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Magnum/MeshTools/Combine.cpp b/src/Magnum/MeshTools/Combine.cpp index 82d01de49..59778e0ff 100644 --- a/src/Magnum/MeshTools/Combine.cpp +++ b/src/Magnum/MeshTools/Combine.cpp @@ -45,6 +45,13 @@ Trade::MeshData combineIndexedImplementation( #endif const MeshPrimitive primitive, const Containers::StridedArrayView2D& combinedIndices, const Containers::Iterable& meshes) { + /* Make the combined index array unique */ + Containers::Array indexData{NoInit, combinedIndices.size()[0]*sizeof(UnsignedInt)}; + const auto indexDataI = Containers::arrayCast(indexData); + const UnsignedInt vertexCount = removeDuplicatesInPlaceInto( + combinedIndices, + indexDataI); + /* Calculate attribute count and vertex stride */ UnsignedInt attributeCount = 0; UnsignedInt vertexStride = 0; @@ -60,13 +67,6 @@ Trade::MeshData combineIndexedImplementation( } } - /* Make the combined index array unique */ - Containers::Array indexData{NoInit, combinedIndices.size()[0]*sizeof(UnsignedInt)}; - const auto indexDataI = Containers::arrayCast(indexData); - const UnsignedInt vertexCount = removeDuplicatesInPlaceInto( - combinedIndices, - indexDataI); - /* Allocate resulting attribute and vertex data and duplicate the attributes there according to the combined index buffer */ Containers::Array vertexData{NoInit, vertexStride*vertexCount};