mirror of
https://github.com/minetest/minetest.git
synced 2024-07-07 08:25:28 +02:00
Preallocate the indices vector
This commit is contained in:
parent
da722a833f
commit
b95dcb7e7a
@ -275,8 +275,9 @@ std::optional<std::vector<u16>> CGLTFMeshFileLoader::MeshExtractor::getIndices(
|
|||||||
|
|
||||||
const auto& buf = getBuffer(accessorIdx.value());
|
const auto& buf = getBuffer(accessorIdx.value());
|
||||||
|
|
||||||
std::vector<u16> indices{};
|
std::vector<u16> indices;
|
||||||
const auto count = getElemCount(accessorIdx.value());
|
const auto count = getElemCount(accessorIdx.value());
|
||||||
|
indices.reserve(count);
|
||||||
for (std::size_t i = 0; i < count; ++i) {
|
for (std::size_t i = 0; i < count; ++i) {
|
||||||
std::size_t elemIdx = count - i - 1; // reverse index order
|
std::size_t elemIdx = count - i - 1; // reverse index order
|
||||||
u16 index;
|
u16 index;
|
||||||
|
Loading…
Reference in New Issue
Block a user