mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-22 01:36:42 +08:00
[libgdx] Minor clipping improvements.
* Don't return clipping polygon count (editor no longer needs it). * Avoid returning to the pool, then immediately getting it out again.
This commit is contained in:
parent
02f87a0f9f
commit
9795ef1a1d
@ -47,10 +47,10 @@ public class SkeletonClipping {
|
||||
private ClippingAttachment clipAttachment;
|
||||
private Array<FloatArray> clippingPolygons;
|
||||
|
||||
public int clipStart (Slot slot, ClippingAttachment clip) {
|
||||
if (clipAttachment != null) return 0;
|
||||
public void clipStart (Slot slot, ClippingAttachment clip) {
|
||||
if (clipAttachment != null) return;
|
||||
int n = clip.getWorldVerticesLength();
|
||||
if (n < 6) return 0;
|
||||
if (n < 6) return;
|
||||
clipAttachment = clip;
|
||||
|
||||
float[] vertices = clippingPolygon.setSize(n);
|
||||
@ -63,7 +63,6 @@ public class SkeletonClipping {
|
||||
polygon.add(polygon.items[0]);
|
||||
polygon.add(polygon.items[1]);
|
||||
}
|
||||
return clippingPolygons.size;
|
||||
}
|
||||
|
||||
public void clipEnd (Slot slot) {
|
||||
|
||||
@ -179,11 +179,9 @@ class Triangulator {
|
||||
if (polygon.size > 0) {
|
||||
convexPolygons.add(polygon);
|
||||
convexPolygonsIndices.add(polygonIndices);
|
||||
} else {
|
||||
polygonPool.free(polygon);
|
||||
polygonIndicesPool.free(polygonIndices);
|
||||
polygon = polygonPool.obtain();
|
||||
polygonIndices = polygonIndicesPool.obtain();
|
||||
}
|
||||
polygon = polygonPool.obtain();
|
||||
polygon.clear();
|
||||
polygon.add(x1);
|
||||
polygon.add(y1);
|
||||
@ -191,7 +189,6 @@ class Triangulator {
|
||||
polygon.add(y2);
|
||||
polygon.add(x3);
|
||||
polygon.add(y3);
|
||||
polygonIndices = polygonIndicesPool.obtain();
|
||||
polygonIndices.clear();
|
||||
polygonIndices.add(t1);
|
||||
polygonIndices.add(t2);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user