Fixed whitespace.

C# has such bad tools. :(
This commit is contained in:
NathanSweet 2016-02-15 21:03:49 +01:00
parent 337e6c284f
commit 03606717a7
6 changed files with 124 additions and 124 deletions

View File

@ -452,7 +452,7 @@ namespace Spine {
String attachmentName = attachmentNames[frameIndex];
skeleton.slots.Items[slotIndex].Attachment =
attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName);
}
}

View File

@ -33,7 +33,7 @@ using System;
using System.Collections.Generic;
namespace Spine {
/// <summary>Attachment that displays a texture region using a mesh which can be deformed by bones.</summary>
/// <summary>Attachment that displays a texture region using a mesh which can be deformed by bones.</summary>
public class WeightedMeshAttachment : Attachment {
internal int[] bones;
internal float[] weights, uvs, regionUVs;

View File

@ -33,7 +33,7 @@ using System;
using System.Collections.Generic;
namespace Spine {
public class Bone : IUpdatable {
public class Bone : IUpdatable {
static public bool yDown;
internal BoneData data;
@ -123,44 +123,44 @@ namespace Spine {
return;
}
float pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
worldX = pa * x + pb * y + parent.worldX;
worldY = pc * x + pd * y + parent.worldY;
worldSignX = parent.worldSignX * Math.Sign(scaleX);
worldSignY = parent.worldSignY * Math.Sign(scaleY);
float pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
worldX = pa * x + pb * y + parent.worldX;
worldY = pc * x + pd * y + parent.worldY;
worldSignX = parent.worldSignX * Math.Sign(scaleX);
worldSignY = parent.worldSignY * Math.Sign(scaleY);
if (data.inheritRotation && data.inheritScale) {
a = pa * la + pb * lc;
b = pa * lb + pb * ld;
c = pc * la + pd * lc;
d = pc * lb + pd * ld;
} else if (data.inheritRotation) { // No scale inheritance.
Bone p = parent;
pa = 1;
pb = 0;
pc = 0;
pd = 1;
while (p != null) {
cos = MathUtils.CosDeg(p.appliedRotation);
sin = MathUtils.SinDeg(p.appliedRotation);
float ta = pa * cos + pb * sin;
float tb = pa * -sin + pb * cos;
float tc = pc * cos + pd * sin;
float td = pc * -sin + pd * cos;
pa = ta;
pb = tb;
pc = tc;
pd = td;
p = p.parent;
}
if (data.inheritRotation && data.inheritScale) {
a = pa * la + pb * lc;
b = pa * lb + pb * ld;
c = pc * la + pd * lc;
d = pc * lb + pd * ld;
} else if (data.inheritRotation) { // No scale inheritance.
Bone p = parent;
pa = 1;
pb = 0;
pc = 0;
pd = 1;
while (p != null) {
cos = MathUtils.CosDeg(p.appliedRotation);
sin = MathUtils.SinDeg(p.appliedRotation);
float ta = pa * cos + pb * sin;
float tb = pa * -sin + pb * cos;
float tc = pc * cos + pd * sin;
float td = pc * -sin + pd * cos;
pa = ta;
pb = tb;
pc = tc;
pd = td;
p = p.parent;
}
if (yDown) {
pb = -pb;
pd = -pd;
}
a = pa * la + pb * lc;
b = pa * lb + pb * ld;
c = pc * la + pd * lc;
d = pc * lb + pd * ld;
a = pa * la + pb * lc;
b = pa * lb + pb * ld;
c = pc * la + pd * lc;
d = pc * lb + pd * ld;
if (skeleton.flipX) {
a = -a;
b = -b;
@ -169,45 +169,45 @@ namespace Spine {
c = -c;
d = -d;
}
} else if (data.inheritScale) { // No rotation inheritance.
Bone p = parent;
pa = 1;
pb = 0;
pc = 0;
pd = 1;
while (p != null) {
float r = p.rotation;
cos = MathUtils.CosDeg(r);
sin = MathUtils.SinDeg(r);
float psx = p.appliedScaleX, psy = p.appliedScaleY;
float za = cos * psx, zb = -sin * psy, zc = sin * psx, zd = cos * psy;
float temp = pa * za + pb * zc;
pb = pa * zb + pb * zd;
pa = temp;
temp = pc * za + pd * zc;
pd = pc * zb + pd * zd;
pc = temp;
} else if (data.inheritScale) { // No rotation inheritance.
Bone p = parent;
pa = 1;
pb = 0;
pc = 0;
pd = 1;
while (p != null) {
float r = p.rotation;
cos = MathUtils.CosDeg(r);
sin = MathUtils.SinDeg(r);
float psx = p.appliedScaleX, psy = p.appliedScaleY;
float za = cos * psx, zb = -sin * psy, zc = sin * psx, zd = cos * psy;
float temp = pa * za + pb * zc;
pb = pa * zb + pb * zd;
pa = temp;
temp = pc * za + pd * zc;
pd = pc * zb + pd * zd;
pc = temp;
if (psx < 0) r = -r;
cos = MathUtils.CosDeg(-r);
sin = MathUtils.SinDeg(-r);
temp = pa * cos + pb * sin;
pb = pa * -sin + pb * cos;
pa = temp;
temp = pc * cos + pd * sin;
pd = pc * -sin + pd * cos;
pc = temp;
if (psx < 0) r = -r;
cos = MathUtils.CosDeg(-r);
sin = MathUtils.SinDeg(-r);
temp = pa * cos + pb * sin;
pb = pa * -sin + pb * cos;
pa = temp;
temp = pc * cos + pd * sin;
pd = pc * -sin + pd * cos;
pc = temp;
p = p.parent;
}
p = p.parent;
}
if (yDown) {
pb = -pb;
pd = -pd;
}
a = pa * la + pb * lc;
b = pa * lb + pb * ld;
c = pc * la + pd * lc;
d = pc * lb + pd * ld;
a = pa * la + pb * lc;
b = pa * lb + pb * ld;
c = pc * la + pd * lc;
d = pc * lb + pd * ld;
if (skeleton.flipX) {
a = -a;
b = -b;
@ -216,39 +216,39 @@ namespace Spine {
c = -c;
d = -d;
}
} else {
a = la;
b = lb;
c = lc;
d = ld;
}
}
} else {
a = la;
b = lb;
c = lc;
d = ld;
}
}
public void Update () {
UpdateWorldTransform(x, y, rotation, scaleX, scaleY);
}
public void Update () {
UpdateWorldTransform(x, y, rotation, scaleX, scaleY);
}
public void SetToSetupPose () {
BoneData data = this.data;
x = data.x;
y = data.y;
rotation = data.rotation;
scaleX = data.scaleX;
scaleY = data.scaleY;
BoneData data = this.data;
x = data.x;
y = data.y;
rotation = data.rotation;
scaleX = data.scaleX;
scaleY = data.scaleY;
}
public void WorldToLocal (float worldX, float worldY, out float localX, out float localY) {
float x = worldX - this.worldX, y = worldY - this.worldY;
float a = this.a, b = this.b, c = this.c, d = this.d;
float invDet = 1 / (a * d - b * c);
localX = (x * a * invDet - y * b * invDet);
localY = (y * d * invDet - x * c * invDet);
float x = worldX - this.worldX, y = worldY - this.worldY;
float a = this.a, b = this.b, c = this.c, d = this.d;
float invDet = 1 / (a * d - b * c);
localX = (x * a * invDet - y * b * invDet);
localY = (y * d * invDet - x * c * invDet);
}
public void LocalToWorld (float localX, float localY, out float worldX, out float worldY) {
float x = localX, y = localY;
worldX = x * a + y * b + this.worldX;
worldY = x * c + y * d + this.worldY;
float x = localX, y = localY;
worldX = x * a + y * b + this.worldX;
worldY = x * c + y * d + this.worldY;
}
override public String ToString () {

View File

@ -37,41 +37,41 @@ namespace Spine {
public const float radDeg = 180f / PI;
public const float degRad = PI / 180;
const int SIN_BITS = 14; // 16KB. Adjust for accuracy.
const int SIN_BITS = 14; // 16KB. Adjust for accuracy.
const int SIN_MASK = ~(-1 << SIN_BITS);
const int SIN_COUNT = SIN_MASK + 1;
const float radFull = PI * 2;
const float degFull = 360;
const float radToIndex = SIN_COUNT / radFull;
const float degToIndex = SIN_COUNT / degFull;
static float[] sin = new float[SIN_COUNT];
static float[] sin = new float[SIN_COUNT];
static MathUtils () {
static MathUtils () {
for (int i = 0; i < SIN_COUNT; i++)
sin[i] = (float)Math.Sin((i + 0.5f) / SIN_COUNT * radFull);
sin[i] = (float)Math.Sin((i + 0.5f) / SIN_COUNT * radFull);
for (int i = 0; i < 360; i += 90)
sin[(int)(i * degToIndex) & SIN_MASK] = (float)Math.Sin(i * degRad);
}
sin[(int)(i * degToIndex) & SIN_MASK] = (float)Math.Sin(i * degRad);
}
/** Returns the sine in radians from a lookup table. */
static public float Sin (float radians) {
return sin[(int)(radians * radToIndex) & SIN_MASK];
}
/** Returns the sine in radians from a lookup table. */
static public float Sin (float radians) {
return sin[(int)(radians * radToIndex) & SIN_MASK];
}
/** Returns the cosine in radians from a lookup table. */
static public float Cos (float radians) {
return sin[(int)((radians + PI / 2) * radToIndex) & SIN_MASK];
}
/** Returns the cosine in radians from a lookup table. */
static public float Cos (float radians) {
return sin[(int)((radians + PI / 2) * radToIndex) & SIN_MASK];
}
/** Returns the sine in radians from a lookup table. */
static public float SinDeg (float degrees) {
return sin[(int)(degrees * degToIndex) & SIN_MASK];
}
/** Returns the sine in radians from a lookup table. */
static public float SinDeg (float degrees) {
return sin[(int)(degrees * degToIndex) & SIN_MASK];
}
/** Returns the cosine in radians from a lookup table. */
static public float CosDeg (float degrees) {
return sin[(int)((degrees + 90) * degToIndex) & SIN_MASK];
}
/** Returns the cosine in radians from a lookup table. */
static public float CosDeg (float degrees) {
return sin[(int)((degrees + 90) * degToIndex) & SIN_MASK];
}
/// <summary>Returns atan2 in radians, faster but less accurate than Math.Atan2. Average error of 0.00231 radians (0.1323
/// degrees), largest error of 0.00488 radians (0.2796 degrees).</summary>

View File

@ -39,8 +39,8 @@ namespace Spine {
internal ExposedList<Slot> slots;
internal ExposedList<Slot> drawOrder;
internal ExposedList<IkConstraint> ikConstraints;
internal ExposedList<TransformConstraint> transformConstraints;
private ExposedList<IUpdatable> updateCache = new ExposedList<IUpdatable>();
internal ExposedList<TransformConstraint> transformConstraints;
private ExposedList<IUpdatable> updateCache = new ExposedList<IUpdatable>();
internal Skin skin;
internal float r = 1, g = 1, b = 1, a = 1;
internal float time;
@ -90,13 +90,13 @@ namespace Spine {
drawOrder.Add(slot);
}
ikConstraints = new ExposedList<IkConstraint>(data.ikConstraints.Count);
foreach (IkConstraintData ikConstraintData in data.ikConstraints)
ikConstraints.Add(new IkConstraint(ikConstraintData, this));
ikConstraints = new ExposedList<IkConstraint>(data.ikConstraints.Count);
foreach (IkConstraintData ikConstraintData in data.ikConstraints)
ikConstraints.Add(new IkConstraint(ikConstraintData, this));
transformConstraints = new ExposedList<TransformConstraint>(data.transformConstraints.Count);
foreach (TransformConstraintData transformConstraintData in data.transformConstraints)
transformConstraints.Add(new TransformConstraint(transformConstraintData, this));
transformConstraints = new ExposedList<TransformConstraint>(data.transformConstraints.Count);
foreach (TransformConstraintData transformConstraintData in data.transformConstraints)
transformConstraints.Add(new TransformConstraint(transformConstraintData, this));
UpdateCache();
UpdateWorldTransform();

View File

@ -42,7 +42,7 @@ namespace Spine {
internal ExposedList<EventData> events = new ExposedList<EventData>();
internal ExposedList<Animation> animations = new ExposedList<Animation>();
internal ExposedList<IkConstraintData> ikConstraints = new ExposedList<IkConstraintData>();
internal ExposedList<TransformConstraintData> transformConstraints = new ExposedList<TransformConstraintData>();
internal ExposedList<TransformConstraintData> transformConstraints = new ExposedList<TransformConstraintData>();
internal float width, height;
internal String version, hash, imagesPath;