mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
[unity] Prospective resizing for MeshGenerator AddSubmesh branch.
This commit is contained in:
parent
d78b2fd024
commit
8d74ef06ac
@ -570,10 +570,13 @@ namespace Spine.Unity {
|
||||
// Add data to vertex buffers
|
||||
{
|
||||
int newVertexCount = ovc + attachmentVertexCount;
|
||||
if (newVertexCount > vertexBuffer.Items.Length) { // Manual ExposedList.Resize()
|
||||
Array.Resize(ref vertexBuffer.Items, newVertexCount);
|
||||
Array.Resize(ref uvBuffer.Items, newVertexCount);
|
||||
Array.Resize(ref colorBuffer.Items, newVertexCount);
|
||||
int oldArraySize = vertexBuffer.Items.Length;
|
||||
if (newVertexCount > oldArraySize) {
|
||||
int newArraySize = (int)(oldArraySize * 1.3f);
|
||||
if (newArraySize < newVertexCount) newArraySize = newVertexCount;
|
||||
Array.Resize(ref vertexBuffer.Items, newArraySize);
|
||||
Array.Resize(ref uvBuffer.Items, newArraySize);
|
||||
Array.Resize(ref colorBuffer.Items, newArraySize);
|
||||
}
|
||||
vertexBuffer.Count = uvBuffer.Count = colorBuffer.Count = newVertexCount;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user