[ts] Ensure clipper.clipEnd() is called appropriately. See #1694

This commit is contained in:
Mario Zechner 2021-06-14 15:20:08 +02:00
parent 34b355eabd
commit 8bb38a7fb0
5 changed files with 31 additions and 11 deletions

View File

@ -12244,8 +12244,10 @@ var spine;
for (var i = 0, n = drawOrder.length; i < n; i++) { for (var i = 0, n = drawOrder.length; i < n; i++) {
var vertexSize = clipper.isClipping() ? 2 : SkeletonMesh.VERTEX_SIZE; var vertexSize = clipper.isClipping() ? 2 : SkeletonMesh.VERTEX_SIZE;
var slot = drawOrder[i]; var slot = drawOrder[i];
if (!slot.bone.active) if (!slot.bone.active) {
clipper.clipEndWithSlot(slot);
continue; continue;
}
var attachment = slot.getAttachment(); var attachment = slot.getAttachment();
var attachmentColor = null; var attachmentColor = null;
var texture = null; var texture = null;
@ -12278,8 +12280,10 @@ var spine;
clipper.clipStart(slot, clip); clipper.clipStart(slot, clip);
continue; continue;
} }
else else {
clipper.clipEndWithSlot(slot);
continue; continue;
}
if (texture) { if (texture) {
var skeleton = slot.bone.skeleton; var skeleton = slot.bone.skeleton;
var skeletonColor = skeleton.color; var skeletonColor = skeleton.color;
@ -12358,8 +12362,10 @@ var spine;
finalIndices = triangles; finalIndices = triangles;
finalIndicesLength = triangles.length; finalIndicesLength = triangles.length;
} }
if (finalVerticesLength == 0 || finalIndicesLength == 0) if (finalVerticesLength == 0 || finalIndicesLength == 0) {
clipper.clipEndWithSlot(slot);
continue; continue;
}
if (!batch.canBatch(finalVerticesLength, finalIndicesLength)) { if (!batch.canBatch(finalVerticesLength, finalIndicesLength)) {
batch.end(); batch.end();
batch = this.nextBatch(); batch = this.nextBatch();

File diff suppressed because one or more lines are too long

View File

@ -9365,8 +9365,10 @@ var spine;
for (var i = 0, n = drawOrder.length; i < n; i++) { for (var i = 0, n = drawOrder.length; i < n; i++) {
var vertexSize = clipper.isClipping() ? 2 : SkeletonMesh.VERTEX_SIZE; var vertexSize = clipper.isClipping() ? 2 : SkeletonMesh.VERTEX_SIZE;
var slot = drawOrder[i]; var slot = drawOrder[i];
if (!slot.bone.active) if (!slot.bone.active) {
clipper.clipEndWithSlot(slot);
continue; continue;
}
var attachment = slot.getAttachment(); var attachment = slot.getAttachment();
var attachmentColor = null; var attachmentColor = null;
var texture = null; var texture = null;
@ -9399,8 +9401,10 @@ var spine;
clipper.clipStart(slot, clip); clipper.clipStart(slot, clip);
continue; continue;
} }
else else {
clipper.clipEndWithSlot(slot);
continue; continue;
}
if (texture) { if (texture) {
var skeleton = slot.bone.skeleton; var skeleton = slot.bone.skeleton;
var skeletonColor = skeleton.color; var skeletonColor = skeleton.color;
@ -9479,8 +9483,10 @@ var spine;
finalIndices = triangles; finalIndices = triangles;
finalIndicesLength = triangles.length; finalIndicesLength = triangles.length;
} }
if (finalVerticesLength == 0 || finalIndicesLength == 0) if (finalVerticesLength == 0 || finalIndicesLength == 0) {
clipper.clipEndWithSlot(slot);
continue; continue;
}
if (!batch.canBatch(finalVerticesLength, finalIndicesLength)) { if (!batch.canBatch(finalVerticesLength, finalIndicesLength)) {
batch.end(); batch.end();
batch = this.nextBatch(); batch = this.nextBatch();

File diff suppressed because one or more lines are too long

View File

@ -159,7 +159,10 @@ module spine.threejs {
for (let i = 0, n = drawOrder.length; i < n; i++) { for (let i = 0, n = drawOrder.length; i < n; i++) {
let vertexSize = clipper.isClipping() ? 2 : SkeletonMesh.VERTEX_SIZE; let vertexSize = clipper.isClipping() ? 2 : SkeletonMesh.VERTEX_SIZE;
let slot = drawOrder[i]; let slot = drawOrder[i];
if (!slot.bone.active) continue; if (!slot.bone.active) {
clipper.clipEndWithSlot(slot);
continue;
}
let attachment = slot.getAttachment(); let attachment = slot.getAttachment();
let attachmentColor: Color = null; let attachmentColor: Color = null;
let texture: ThreeJsTexture = null; let texture: ThreeJsTexture = null;
@ -189,7 +192,10 @@ module spine.threejs {
let clip = <ClippingAttachment>(attachment); let clip = <ClippingAttachment>(attachment);
clipper.clipStart(slot, clip); clipper.clipStart(slot, clip);
continue; continue;
} else continue; } else {
clipper.clipEndWithSlot(slot);
continue;
}
if (texture) { if (texture) {
let skeleton = slot.bone.skeleton; let skeleton = slot.bone.skeleton;
@ -273,8 +279,10 @@ module spine.threejs {
finalIndicesLength = triangles.length; finalIndicesLength = triangles.length;
} }
if (finalVerticesLength == 0 || finalIndicesLength == 0) if (finalVerticesLength == 0 || finalIndicesLength == 0) {
clipper.clipEndWithSlot(slot);
continue; continue;
}
// Start new batch if this one can't hold vertices/indices // Start new batch if this one can't hold vertices/indices
if (!batch.canBatch(finalVerticesLength, finalIndicesLength)) { if (!batch.canBatch(finalVerticesLength, finalIndicesLength)) {