mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-27 12:11:22 +08:00
[Unity] Fix extra renderers check.
This commit is contained in:
parent
6316879c1c
commit
f14e898d2d
@ -119,16 +119,16 @@ namespace Spine.Unity.Modules {
|
|||||||
int lastSubmeshInstruction = submeshInstructions.Count - 1;
|
int lastSubmeshInstruction = submeshInstructions.Count - 1;
|
||||||
|
|
||||||
var currentRenderer = partsRenderers[rendererIndex];
|
var currentRenderer = partsRenderers[rendererIndex];
|
||||||
bool skeletonRendererCalculateNormals = skeletonRenderer.calculateNormals;
|
bool useNormals = skeletonRenderer.calculateNormals;
|
||||||
|
|
||||||
for (int i = 0, start = 0; i <= lastSubmeshInstruction; i++) {
|
for (int si = 0, start = 0; si <= lastSubmeshInstruction; si++) {
|
||||||
if (submeshInstructionsItems[i].forceSeparate) {
|
if (submeshInstructionsItems[si].forceSeparate || si == lastSubmeshInstruction) {
|
||||||
currentRenderer.RenderParts(instruction.submeshInstructions, start, i + 1);
|
currentRenderer.RenderParts(instruction.submeshInstructions, start, si + 1);
|
||||||
currentRenderer.MeshGenerator.GenerateNormals = skeletonRendererCalculateNormals;
|
currentRenderer.MeshGenerator.GenerateNormals = useNormals;
|
||||||
if (copyPropertyBlock)
|
if (copyPropertyBlock)
|
||||||
currentRenderer.SetPropertyBlock(block);
|
currentRenderer.SetPropertyBlock(block);
|
||||||
|
|
||||||
start = i + 1;
|
start = si + 1;
|
||||||
rendererIndex++;
|
rendererIndex++;
|
||||||
if (rendererIndex < rendererCount) {
|
if (rendererIndex < rendererCount) {
|
||||||
currentRenderer = partsRenderers[rendererIndex];
|
currentRenderer = partsRenderers[rendererIndex];
|
||||||
@ -136,26 +136,15 @@ namespace Spine.Unity.Modules {
|
|||||||
// Not enough renderers. Skip the rest of the instructions.
|
// Not enough renderers. Skip the rest of the instructions.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (i == lastSubmeshInstruction) {
|
|
||||||
currentRenderer.RenderParts(instruction.submeshInstructions, start, i + 1);
|
|
||||||
currentRenderer.MeshGenerator.GenerateNormals = skeletonRendererCalculateNormals;
|
|
||||||
if (copyPropertyBlock)
|
|
||||||
currentRenderer.SetPropertyBlock(block);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If too many renderers. Clear the rest.
|
// Clear extra renderers if they exist.
|
||||||
rendererIndex++;
|
for (; rendererIndex < rendererCount; rendererIndex++) {
|
||||||
if (rendererIndex < rendererCount - 1) {
|
partsRenderers[rendererIndex].ClearMesh();
|
||||||
for (int i = rendererIndex; i < rendererCount; i++) {
|
|
||||||
currentRenderer = partsRenderers[i];
|
|
||||||
currentRenderer.ClearMesh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user