This commit is contained in:
badlogic 2018-11-15 10:58:37 +01:00
commit 8eec72023a

View File

@ -175,6 +175,10 @@ namespace Spine.Unity {
}
}
public MeshGenerator () {
submeshes.TrimExcess();
}
#region Step 1 : Generate Instructions
public static void GenerateSingleSubmeshInstruction (SkeletonRendererInstruction instructionOutput, Skeleton skeleton, Material material) {
ExposedList<Slot> drawOrder = skeleton.drawOrder;
@ -866,12 +870,13 @@ namespace Spine.Unity {
this.meshBoundsMax = bmax;
this.meshBoundsThickness = lastSlotIndex * settings.zSpacing;
int submeshInstructionCount = instruction.submeshInstructions.Count;
submeshes.Count = submeshInstructionCount;
// Add triangles
if (updateTriangles) {
int submeshInstructionCount = instruction.submeshInstructions.Count;
// Match submesh buffers count with submeshInstruction count.
if (this.submeshes.Count < submeshInstructionCount) {
if (this.submeshes.Items.Length < submeshInstructionCount) {
this.submeshes.Resize(submeshInstructionCount);
for (int i = 0, n = submeshInstructionCount; i < n; i++) {
var submeshBuffer = this.submeshes.Items[i];