Clean up.

This commit is contained in:
NathanSweet 2014-09-30 01:27:41 +02:00
parent 69a611fbf2
commit 57f24ff8cc
7 changed files with 14 additions and 19 deletions

View File

@ -637,10 +637,6 @@ namespace Spine {
frames = new float[frameCount * 3];
}
public float[] getFrames () {
return frames;
}
/** Sets the time, mix and bend direction of the specified keyframe. */
public void setFrame (int frameIndex, float time, float mix, int bendDirection) {
frameIndex *= 3;

View File

@ -134,8 +134,8 @@ namespace Spine {
float m00 = this.m00, m10 = this.m10, m01 = this.m01, m11 = this.m11;
Skeleton skeleton = this.skeleton;
if (skeleton.flipX != (skeleton.flipY != yDown)) {
m00 *= -1;
m11 *= -1;
m00 = -m00;
m11 = -m11;
}
float invDet = 1 / (m00 * m11 - m01 * m10);
localX = (dx * m00 * invDet - dy * m01 * invDet);

View File

@ -38,8 +38,8 @@ namespace Spine {
internal IkConstraintData data;
internal List<Bone> bones = new List<Bone>();
internal Bone target;
internal int bendDirection = 1;
internal float mix = 1;
internal int bendDirection;
internal float mix;
public IkConstraintData Data { get { return data; } }
public List<Bone> Bones { get { return bones; } }
@ -48,6 +48,8 @@ namespace Spine {
public float Mix { get { return mix; } set { mix = value; } }
public IkConstraint (IkConstraintData data, Skeleton skeleton) {
if (data == null) throw new ArgumentNullException("data cannot be null.");
if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
this.data = data;
mix = data.mix;
bendDirection = data.bendDirection;

View File

@ -37,7 +37,7 @@ namespace Spine {
internal List<Bone> bones;
internal List<Slot> slots;
internal List<Slot> drawOrder;
internal List<IkConstraint> ikConstraints = new List<IkConstraint>();
internal List<IkConstraint> ikConstraints;
private List<List<Bone>> boneCache = new List<List<Bone>>();
internal Skin skin;
internal float r = 1, g = 1, b = 1, a = 1;
@ -74,12 +74,9 @@ namespace Spine {
bones = new List<Bone>(data.bones.Count);
foreach (BoneData boneData in data.bones) {
Bone parent = boneData.parent == null ? null : bones[data.bones.IndexOf(boneData.parent)];
bones.Add(new Bone(boneData, this, parent));
}
foreach(Bone b in bones){
if(b.Parent != null)
b.Parent.children.Add(b);
Bone bone = new Bone(boneData, this, parent);
if (parent != null) parent.children.Add(bone);
bones.Add(bone);
}
slots = new List<Slot>(data.slots.Count);

View File

@ -136,7 +136,7 @@ namespace Spine {
return null;
}
// --- IK
// --- IK constraints.
/// <returns>May be null.</returns>
public IkConstraintData FindIkConstraint (String ikConstraintName) {

View File

@ -96,7 +96,7 @@ namespace Spine {
skeletonData.hash = (String)skeletonMap["hash"];
skeletonData.version = (String)skeletonMap["spine"];
skeletonData.width = GetFloat(skeletonMap, "width", 0);
skeletonData.height = GetFloat(skeletonMap, "width", 1);
skeletonData.height = GetFloat(skeletonMap, "height", 0);
}
// Bones.

View File

@ -264,8 +264,8 @@ public class Bone {
float m00 = this.m00, m10 = this.m10, m01 = this.m01, m11 = this.m11;
Skeleton skeleton = this.skeleton;
if (skeleton.flipX != skeleton.flipY) {
m00 *= -1;
m11 *= -1;
m00 = -m00;
m11 = -m11;
}
float invDet = 1 / (m00 * m11 - m01 * m10);
world.x = (x * m00 * invDet - y * m01 * invDet);