Skip to content

Commit

Permalink
Minor updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSweet committed Sep 20, 2013
1 parent e1fe518 commit 1db0e71
Show file tree
Hide file tree
Showing 3 changed files with 1,012 additions and 6 deletions.
2 changes: 1 addition & 1 deletion spine-csharp/src/Attachments/BoundingBoxAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public BoundingBoxAttachment (string 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) {
x += bone.WorldX;
y += bone.WorldY;
Expand Down
10 changes: 6 additions & 4 deletions spine-csharp/src/SkeletonBounds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ public void Update (Skeleton skeleton) {
float x = skeleton.X, y = skeleton.Y;

boundingBoxes.Clear();
foreach (Polygon polygon in polygons) {
foreach (Polygon polygon in polygons)
polygonPool.Add(polygon);
}
polygons.Clear();

for (int i = 0; i < slotCount; i++) {
Expand All @@ -127,7 +126,7 @@ public void Update (Skeleton skeleton) {
polygon = new Polygon();
polygons.Add(polygon);
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);
}
}
Expand Down Expand Up @@ -262,7 +261,6 @@ public bool IntersectsSegment (int index, float x1, float y1, float x2, float y2
}
x3 = x4;
y3 = y4;

}
return false;
}
Expand All @@ -272,4 +270,8 @@ public bool IntersectsSegment (int index, float x1, float y1, float x2, float y2
public class Polygon {
public float[] Vertices { get; set; }
public int Count { get; set; }

public Polygon () {
Vertices = new float[16];
}
}
Loading

0 comments on commit 1db0e71

Please sign in to comment.