|
@@ -98,6 +98,7 @@ package spine.starling {
|
|
|
for (var i : int = 0, n : int = drawOrder.length; i < n; ++i) {
|
|
|
var worldVertices : Vector.<Number> = _tempVertices;
|
|
|
var slot : Slot = drawOrder[i];
|
|
|
+
|
|
|
if (slot.attachment is RegionAttachment) {
|
|
|
var region : RegionAttachment = slot.attachment as RegionAttachment;
|
|
|
verticesLength = 4 * 2;
|
|
@@ -146,7 +147,7 @@ package spine.starling {
|
|
|
indexData.numIndices = indicesLength;
|
|
|
indexData.trim();
|
|
|
}
|
|
|
- indexData = mesh.getIndexData();
|
|
|
+ indexData = mesh.getIndexData();
|
|
|
attachmentColor = meshAttachment.color;
|
|
|
uvs = meshAttachment.uvs;
|
|
|
} else if (slot.attachment is ClippingAttachment) {
|
|
@@ -169,17 +170,22 @@ package spine.starling {
|
|
|
if (clipper.isClipping()) {
|
|
|
clipper.clipTriangles(worldVertices, indices, indices.length, uvs);
|
|
|
|
|
|
+ // Need to create a new mesh here, see https://github.com/EsotericSoftware/spine-runtimes/issues/1125
|
|
|
+ mesh = new SkeletonMesh(mesh.texture);
|
|
|
+ if (_twoColorTint) mesh.setStyle(mesh.style);
|
|
|
+ indexData = mesh.getIndexData();
|
|
|
+
|
|
|
verticesCount = clipper.clippedVertices.length >> 1;
|
|
|
worldVertices = clipper.clippedVertices;
|
|
|
uvs = clipper.clippedUvs;
|
|
|
|
|
|
indices = clipper.clippedTriangles;
|
|
|
indicesLength = indices.length;
|
|
|
+ indexData.numIndices = indicesLength;
|
|
|
+ indexData.trim();
|
|
|
for (ii = 0; ii < indicesLength; ii++) {
|
|
|
indexData.setIndex(ii, indices[ii]);
|
|
|
}
|
|
|
- indexData.numIndices = indicesLength;
|
|
|
- indexData.trim();
|
|
|
}
|
|
|
|
|
|
vertexData = mesh.getVertexData();
|
|
@@ -214,8 +220,11 @@ package spine.starling {
|
|
|
mesh.setTexCoords(ii, uvs[iii], uvs[iii + 1]);
|
|
|
}
|
|
|
}
|
|
|
- painter.state.blendMode = blendModes[slot.data.blendMode.ordinal];
|
|
|
- painter.batchMesh(mesh);
|
|
|
+ if (indexData.numIndices > 0 && vertexData.numVertices > 0) {
|
|
|
+ painter.state.blendMode = blendModes[slot.data.blendMode.ordinal];
|
|
|
+ painter.batchMesh(mesh);
|
|
|
+ painter.finishMeshBatch();
|
|
|
+ }
|
|
|
|
|
|
clipper.clipEndWithSlot(slot);
|
|
|
}
|