mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-18 04:51:47 +08:00
[starling] Updated to Starling 2.4, fixed #1125. When clipping, we can't reuse the cached Mesh of the clipped attachment, but must allocate a new one. Otherwise the Starling MeshBatcher explodes.
This commit is contained in:
parent
82295f52b5
commit
966ed65465
@ -5,5 +5,5 @@
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-starling.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-as3.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.1.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.4.swc</AS3Classpath>
|
||||
</AS3Classpath>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
spine-starling/spine-starling-example/lib/starling-2.4.swc
Normal file
BIN
spine-starling/spine-starling-example/lib/starling-2.4.swc
Normal file
Binary file not shown.
@ -4,5 +4,5 @@
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-as3.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/air/airglobal.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.1.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.4.swc</AS3Classpath>
|
||||
</AS3Classpath>
|
||||
|
||||
Binary file not shown.
BIN
spine-starling/spine-starling/lib/starling-2.4.swc
Normal file
BIN
spine-starling/spine-starling/lib/starling-2.4.swc
Normal file
Binary file not shown.
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user