Browse Source

MeshTools: minor code motion.

pull/623/head
Vladimír Vondruš 3 years ago
parent
commit
5db4aa121e
  1. 14
      src/Magnum/MeshTools/Combine.cpp

14
src/Magnum/MeshTools/Combine.cpp

@ -45,6 +45,13 @@ Trade::MeshData combineIndexedImplementation(
#endif #endif
const MeshPrimitive primitive, const Containers::StridedArrayView2D<char>& combinedIndices, const Containers::Iterable<const Trade::MeshData>& meshes) const MeshPrimitive primitive, const Containers::StridedArrayView2D<char>& combinedIndices, const Containers::Iterable<const Trade::MeshData>& meshes)
{ {
/* Make the combined index array unique */
Containers::Array<char> indexData{NoInit, combinedIndices.size()[0]*sizeof(UnsignedInt)};
const auto indexDataI = Containers::arrayCast<UnsignedInt>(indexData);
const UnsignedInt vertexCount = removeDuplicatesInPlaceInto(
combinedIndices,
indexDataI);
/* Calculate attribute count and vertex stride */ /* Calculate attribute count and vertex stride */
UnsignedInt attributeCount = 0; UnsignedInt attributeCount = 0;
UnsignedInt vertexStride = 0; UnsignedInt vertexStride = 0;
@ -60,13 +67,6 @@ Trade::MeshData combineIndexedImplementation(
} }
} }
/* Make the combined index array unique */
Containers::Array<char> indexData{NoInit, combinedIndices.size()[0]*sizeof(UnsignedInt)};
const auto indexDataI = Containers::arrayCast<UnsignedInt>(indexData);
const UnsignedInt vertexCount = removeDuplicatesInPlaceInto(
combinedIndices,
indexDataI);
/* Allocate resulting attribute and vertex data and duplicate the /* Allocate resulting attribute and vertex data and duplicate the
attributes there according to the combined index buffer */ attributes there according to the combined index buffer */
Containers::Array<char> vertexData{NoInit, vertexStride*vertexCount}; Containers::Array<char> vertexData{NoInit, vertexStride*vertexCount};

Loading…
Cancel
Save