diff --git a/src/Magnum/SceneTools/OrderClusterParents.cpp b/src/Magnum/SceneTools/OrderClusterParents.cpp index db41636ab..60025f560 100644 --- a/src/Magnum/SceneTools/OrderClusterParents.cpp +++ b/src/Magnum/SceneTools/OrderClusterParents.cpp @@ -26,7 +26,6 @@ #include "OrderClusterParents.h" #include -#include #include #include @@ -94,9 +93,9 @@ void orderClusterParentsInto(const Trade::SceneData& scene, const Containers::St other) and build a list of (id, parent id) where a parent is always before its children */ std::size_t outputOffset = 0; - Containers::Array parentsToProcess; - arrayAppend(parentsToProcess, -1); - for(std::size_t i = 0; i != parentsToProcess.size(); ++i) { + Containers::Array parentsToProcess{NoInit, parents.size() + 1}; + parentsToProcess[0] = -1; + for(std::size_t i = 0; i != outputOffset + 1; ++i) { const Int objectId = parentsToProcess[i]; for(std::size_t j = childrenOffsets[objectId + 1], jMax = childrenOffsets[objectId + 2]; j != jMax; ++j) { /** @todo better diagnostic once we can use a BitArray to detect @@ -105,7 +104,7 @@ void orderClusterParentsInto(const Trade::SceneData& scene, const Containers::St should be instead in a dedicated cycle/sparse checker utility?) */ CORRADE_ASSERT_OUTPUT(outputOffset < parents.size(), "SceneTools::orderClusterParents(): hierarchy is cyclic", ); - arrayAppend(parentsToProcess, children[j]); + parentsToProcess[outputOffset + 1] = children[j]; mappingDestination[outputOffset] = children[j]; parentDestination[outputOffset] = objectId; ++outputOffset;