Merged with origin

This commit is contained in:
badlogic 2017-03-31 11:23:11 +02:00
commit 241c7980f8
3 changed files with 12 additions and 6 deletions

View File

@ -411,9 +411,12 @@ public class SkeletonJson {
ClippingAttachment clip = attachmentLoader.newClippingAttachment(skin, name);
if (clip == null) return null;
SlotData slot = skeletonData.findSlot(map.getString("end"));
if (slot == null) throw new SerializationException("Slot not found: " + map.getString("end"));
clip.setEndSlot(slot.index);
String end = map.getString("end", null);
if (end != null) {
SlotData slot = skeletonData.findSlot(end);
if (slot == null) throw new SerializationException("Slot not found: " + end);
clip.setEndSlot(slot.index);
}
readVertices(map, clip, map.getInt("vertexCount") << 1);

View File

@ -52,7 +52,6 @@ public class SkeletonRenderer implements Disposable {
private boolean premultipliedAlpha;
private final FloatArray vertices = new FloatArray(32);
private ImmediateModeRenderer renderer;
private final SkeletonClipping clipper = new SkeletonClipping();
@ -122,6 +121,7 @@ public class SkeletonRenderer implements Disposable {
if (clipper.isClipping() && clipper.getClippingAttachment().getEndSlot() == i) clipper.clipEnd();
}
if (clipper.isClipping()) clipper.clipEnd();
}
@SuppressWarnings("null")
@ -223,6 +223,7 @@ public class SkeletonRenderer implements Disposable {
if (clipper.isClipping() && clipper.getClippingAttachment().getEndSlot() == i) clipper.clipEnd();
}
if (clipper.isClipping()) clipper.clipEnd();
}
@SuppressWarnings("null")
@ -331,6 +332,7 @@ public class SkeletonRenderer implements Disposable {
if (clipper.isClipping() && clipper.getClippingAttachment().getEndSlot() == i) clipper.clipEnd();
}
if (clipper.isClipping()) clipper.clipEnd();
}
public void setPremultipliedAlpha (boolean premultipliedAlpha) {

View File

@ -34,7 +34,7 @@ import com.badlogic.gdx.graphics.Color;
/** An attachment with vertices that make up a polygon used for clipping the rendering of other attachments. */
public class ClippingAttachment extends VertexAttachment {
int endSlot;
int endSlot = -1;
// Nonessential.
final Color color = new Color(0.2275f, 0.2275f, 0.8078f, 1); // ce3a3aff
@ -43,7 +43,8 @@ public class ClippingAttachment extends VertexAttachment {
super(name);
}
/** Clipping is performed between the clipping polygon's slot and the end slot. */
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns -1 if clipping is done until the end of
* the skeleton's rendering. */
public int getEndSlot () {
return endSlot;
}