Minor updates.

This commit is contained in:
NathanSweet 2013-09-20 18:56:21 +02:00
parent e1fe518261
commit 1db0e71257
3 changed files with 1012 additions and 6 deletions

View File

@ -34,7 +34,7 @@ namespace Spine {
: base(name) { : base(name) {
} }
/** @param worldVertices Must have at least the same as this attachment's vertices. */ /** @param worldVertices Must have at least the same length as this attachment's vertices. */
public void ComputeWorldVertices (float x, float y, Bone bone, float[] worldVertices) { public void ComputeWorldVertices (float x, float y, Bone bone, float[] worldVertices) {
x += bone.WorldX; x += bone.WorldX;
y += bone.WorldY; y += bone.WorldY;

View File

@ -107,9 +107,8 @@ namespace Spine {
float x = skeleton.X, y = skeleton.Y; float x = skeleton.X, y = skeleton.Y;
boundingBoxes.Clear(); boundingBoxes.Clear();
foreach (Polygon polygon in polygons) { foreach (Polygon polygon in polygons)
polygonPool.Add(polygon); polygonPool.Add(polygon);
}
polygons.Clear(); polygons.Clear();
for (int i = 0; i < slotCount; i++) { for (int i = 0; i < slotCount; i++) {
@ -127,7 +126,7 @@ namespace Spine {
polygon = new Polygon(); polygon = new Polygon();
polygons.Add(polygon); polygons.Add(polygon);
polygon.Count = boundingBox.Vertices.Length; polygon.Count = boundingBox.Vertices.Length;
if (polygon.Vertices == null || polygon.Vertices.Length < polygon.Count) polygon.Vertices = new float[polygon.Count]; if (polygon.Vertices.Length < polygon.Count) polygon.Vertices = new float[polygon.Count];
boundingBox.ComputeWorldVertices(x, y, slot.Bone, polygon.Vertices); boundingBox.ComputeWorldVertices(x, y, slot.Bone, polygon.Vertices);
} }
} }
@ -262,7 +261,6 @@ namespace Spine {
} }
x3 = x4; x3 = x4;
y3 = y4; y3 = y4;
} }
return false; return false;
} }
@ -272,4 +270,8 @@ namespace Spine {
public class Polygon { public class Polygon {
public float[] Vertices { get; set; } public float[] Vertices { get; set; }
public int Count { get; set; } public int Count { get; set; }
public Polygon () {
Vertices = new float[16];
}
} }

File diff suppressed because one or more lines are too long