Don't let MeshBuffer append functions shrink memory as this prevents optimizations

Couldn't allocate enough memory before appending several buffers for all of them as first append shrunk the memory again.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6495 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2023-05-16 16:33:30 +00:00
parent 428fcca7fb
commit 7c92944860
2 changed files with 4 additions and 4 deletions

View File

@ -128,7 +128,7 @@ namespace scene
const u32 vertexCount = getVertexCount(); const u32 vertexCount = getVertexCount();
VertexBuffer->reallocate(vertexCount+numVertices); VertexBuffer->reallocate(vertexCount+numVertices, false);
switch ( vertexType ) switch ( vertexType )
{ {
case video::EVT_STANDARD: case video::EVT_STANDARD:
@ -154,7 +154,7 @@ namespace scene
break; break;
} }
IndexBuffer->reallocate(getIndexCount()+numIndices); IndexBuffer->reallocate(getIndexCount()+numIndices, false);
switch ( indexType ) switch ( indexType )
{ {
case video::EIT_16BIT: case video::EIT_16BIT:

View File

@ -201,14 +201,14 @@ namespace scene
const u32 vertexCount = getVertexCount(); const u32 vertexCount = getVertexCount();
u32 i; u32 i;
Vertices.reallocate(vertexCount+numVertices); Vertices.reallocate(vertexCount+numVertices, false);
for (i=0; i<numVertices; ++i) for (i=0; i<numVertices; ++i)
{ {
Vertices.push_back(static_cast<const T*>(vertices)[i]); Vertices.push_back(static_cast<const T*>(vertices)[i]);
BoundingBox.addInternalPoint(static_cast<const T*>(vertices)[i].Pos); BoundingBox.addInternalPoint(static_cast<const T*>(vertices)[i].Pos);
} }
Indices.reallocate(getIndexCount()+numIndices); Indices.reallocate(getIndexCount()+numIndices, false);
for (i=0; i<numIndices; ++i) for (i=0; i<numIndices; ++i)
{ {
Indices.push_back(indices[i]+vertexCount); Indices.push_back(indices[i]+vertexCount);