[gdx] Throw if SkeletonRenderer batch doesn't support clipping.

This commit is contained in:
Nathan Sweet 2022-04-16 14:33:50 -04:00
parent f295669ed4
commit b7d6cf819c

View File

@ -91,10 +91,7 @@ public class SkeletonRenderer {
Object[] drawOrder = skeleton.drawOrder.items;
for (int i = 0, n = skeleton.drawOrder.size; i < n; i++) {
Slot slot = (Slot)drawOrder[i];
if (!slot.bone.active) {
clipper.clipEnd(slot);
continue;
}
if (!slot.bone.active) continue;
Attachment attachment = slot.attachment;
if (attachment instanceof RegionAttachment) {
RegionAttachment region = (RegionAttachment)attachment;
@ -129,8 +126,8 @@ public class SkeletonRenderer {
batch.draw(region.getRegion().getTexture(), vertices, 0, 20);
} else if (attachment instanceof ClippingAttachment) {
clipper.clipStart(slot, (ClippingAttachment)attachment);
continue;
throw new RuntimeException(batch.getClass().getSimpleName()
+ " cannot perform clipping, PolygonSpriteBatch or TwoColorPolygonBatch is required.");
} else if (attachment instanceof MeshAttachment) {
throw new RuntimeException(batch.getClass().getSimpleName()
@ -140,10 +137,7 @@ public class SkeletonRenderer {
Skeleton attachmentSkeleton = ((SkeletonAttachment)attachment).getSkeleton();
if (attachmentSkeleton != null) draw(batch, attachmentSkeleton);
}
clipper.clipEnd(slot);
}
clipper.clipEnd();
if (vertexEffect != null) vertexEffect.end();
}