mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +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 ClippingAttachment clipAttachment;
|
||||||
private Array<FloatArray> clippingPolygons;
|
private Array<FloatArray> clippingPolygons;
|
||||||
|
|
||||||
public int clipStart (Slot slot, ClippingAttachment clip) {
|
public void clipStart (Slot slot, ClippingAttachment clip) {
|
||||||
if (clipAttachment != null) return 0;
|
if (clipAttachment != null) return;
|
||||||
int n = clip.getWorldVerticesLength();
|
int n = clip.getWorldVerticesLength();
|
||||||
if (n < 6) return 0;
|
if (n < 6) return;
|
||||||
clipAttachment = clip;
|
clipAttachment = clip;
|
||||||
|
|
||||||
float[] vertices = clippingPolygon.setSize(n);
|
float[] vertices = clippingPolygon.setSize(n);
|
||||||
@ -63,7 +63,6 @@ public class SkeletonClipping {
|
|||||||
polygon.add(polygon.items[0]);
|
polygon.add(polygon.items[0]);
|
||||||
polygon.add(polygon.items[1]);
|
polygon.add(polygon.items[1]);
|
||||||
}
|
}
|
||||||
return clippingPolygons.size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clipEnd (Slot slot) {
|
public void clipEnd (Slot slot) {
|
||||||
|
|||||||
@ -179,11 +179,9 @@ class Triangulator {
|
|||||||
if (polygon.size > 0) {
|
if (polygon.size > 0) {
|
||||||
convexPolygons.add(polygon);
|
convexPolygons.add(polygon);
|
||||||
convexPolygonsIndices.add(polygonIndices);
|
convexPolygonsIndices.add(polygonIndices);
|
||||||
} else {
|
polygon = polygonPool.obtain();
|
||||||
polygonPool.free(polygon);
|
polygonIndices = polygonIndicesPool.obtain();
|
||||||
polygonIndicesPool.free(polygonIndices);
|
|
||||||
}
|
}
|
||||||
polygon = polygonPool.obtain();
|
|
||||||
polygon.clear();
|
polygon.clear();
|
||||||
polygon.add(x1);
|
polygon.add(x1);
|
||||||
polygon.add(y1);
|
polygon.add(y1);
|
||||||
@ -191,7 +189,6 @@ class Triangulator {
|
|||||||
polygon.add(y2);
|
polygon.add(y2);
|
||||||
polygon.add(x3);
|
polygon.add(x3);
|
||||||
polygon.add(y3);
|
polygon.add(y3);
|
||||||
polygonIndices = polygonIndicesPool.obtain();
|
|
||||||
polygonIndices.clear();
|
polygonIndices.clear();
|
||||||
polygonIndices.add(t1);
|
polygonIndices.add(t1);
|
||||||
polygonIndices.add(t2);
|
polygonIndices.add(t2);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user