diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 4bc3dc693..fa8dc86b4 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -61,14 +61,14 @@ f84ae17615c506bf98c575bb800d2cf3b793df4d # 2014-01-11 Updated license to version 2. d520addb9bfdf552881cb6871d70159a80e1ff6b -# 2013-10-03 9a347d5eb8ad095c5e739d959de485b6add7f0b3 -Updated license. +# 2013-10-03 Updated license. +9a347d5eb8ad095c5e739d959de485b6add7f0b3 # 2013-10-01 Minor update to the license to include education. 47ce2a40c18b8ea471e6004f7e2c6cbf5b36af76 -# 2013-09-20 e2fccf72d6541c598172a538d4d497e6d13340cc -License update. +# 2013-09-20 License update. +e2fccf72d6541c598172a538d4d497e6d13340cc # 2013 License headers. 4edc23ac2f1c00782b4f637fb2543d784bd8dda9 diff --git a/spine-c/spine-c/src/spine/Atlas.c b/spine-c/spine-c/src/spine/Atlas.c index 92efd9091..63671e18d 100644 --- a/spine-c/spine-c/src/spine/Atlas.c +++ b/spine-c/spine-c/src/spine/Atlas.c @@ -99,11 +99,11 @@ spAtlasPage *spAtlasPage_create(spAtlas *atlas, const char *name) { spAtlasPage *self = NEW(spAtlasPage); CONST_CAST(spAtlas *, self->atlas) = atlas; MALLOC_STR(self->name, name); - self->minFilter = SP_ATLAS_NEAREST; - self->magFilter = SP_ATLAS_NEAREST; - self->format = SP_ATLAS_RGBA8888; - self->uWrap = SP_ATLAS_CLAMPTOEDGE; - self->vWrap = SP_ATLAS_CLAMPTOEDGE; + self->minFilter = SP_ATLAS_NEAREST; + self->magFilter = SP_ATLAS_NEAREST; + self->format = SP_ATLAS_RGBA8888; + self->uWrap = SP_ATLAS_CLAMPTOEDGE; + self->vWrap = SP_ATLAS_CLAMPTOEDGE; return self; } diff --git a/spine-c/spine-c/src/spine/IkConstraint.c b/spine-c/spine-c/src/spine/IkConstraint.c index 5d572c457..a296f8dad 100644 --- a/spine-c/spine-c/src/spine/IkConstraint.c +++ b/spine-c/spine-c/src/spine/IkConstraint.c @@ -84,7 +84,7 @@ void spIkConstraint_apply1(spBone *bone, float targetX, float targetY, int /*boo ty = targetY - bone->worldY; break; case SP_TRANSFORMMODE_NOROTATIONORREFLECTION: { - s = ABS(pa * pd - pb * pc) / (pa * pa + pc * pc); + s = ABS(pa * pd - pb * pc) / MAX(0.0001f, pa * pa + pc * pc); sa = pa / bone->skeleton->scaleX; sc = pc / bone->skeleton->scaleY; pb = -sc * s * bone->skeleton->scaleX; @@ -94,8 +94,13 @@ void spIkConstraint_apply1(spBone *bone, float targetX, float targetY, int /*boo default: { float x = targetX - p->worldX, y = targetY - p->worldY; float d = pa * pd - pb * pc; - tx = (x * pd - y * pb) / d - bone->ax; - ty = (y * pa - x * pc) / d - bone->ay; + if (ABS(d) <= 0.0001f) { + tx = 0; + ty = 0; + } else { + tx = (x * pd - y * pb) / d - bone->ax; + ty = (y * pa - x * pc) / d - bone->ay; + } } } rotationIK += ATAN2(ty, tx) * RAD_DEG; @@ -177,7 +182,8 @@ void spIkConstraint_apply2(spBone *parent, spBone *child, float targetX, float t b = pp->b; c = pp->c; d = pp->d; - id = 1 / (a * d - b * c); + id = a * d - b * c; + id = ABS(id) <= 0.0001f ? 0 : 1 / id; x = cwx - pp->worldX; y = cwy - pp->worldY; dx = (x * d - y * b) * id - px; diff --git a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp index 8a9af567c..19b602428 100644 --- a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp @@ -51,7 +51,7 @@ void IkConstraint::apply(Bone &bone, float targetX, float targetY, bool compress ty = targetY - bone._worldY; break; case TransformMode_NoRotationOrReflection: { - float s = MathUtil::abs(pa * pd - pb * pc) / (pa * pa + pc * pc); + float s = MathUtil::abs(pa * pd - pb * pc) / MathUtil::max(0.0001f, pa * pa + pc * pc); float sa = pa / bone._skeleton.getScaleX(); float sc = pc / bone._skeleton.getScaleY(); pb = -sc * s * bone._skeleton.getScaleX(); @@ -61,8 +61,13 @@ void IkConstraint::apply(Bone &bone, float targetX, float targetY, bool compress default: float x = targetX - p->_worldX, y = targetY - p->_worldY; float d = pa * pd - pb * pc; - tx = (x * pd - y * pb) / d - bone._ax; - ty = (y * pa - x * pc) / d - bone._ay; + if (MathUtil::abs(d) <= 0.0001f) { + tx = 0; + ty = 0; + } else { + tx = (x * pd - y * pb) / d - bone._ax; + ty = (y * pa - x * pc) / d - bone._ay; + } } rotationIK += MathUtil::atan2(ty, tx) * MathUtil::Rad_Deg; if (bone._ascaleX < 0) rotationIK += 180; @@ -140,7 +145,8 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY b = pp->_b; c = pp->_c; d = pp->_d; - id = 1 / (a * d - b * c); + id = a * d - b * c; + id = MathUtil::abs(id) <= 0.0001f ? 0 : 1 / id; x = cwx - pp->_worldX; y = cwy - pp->_worldY; dx = (x * d - y * b) * id - px; diff --git a/spine-cpp/spine-cpp/src/spine/Skin.cpp b/spine-cpp/spine-cpp/src/spine/Skin.cpp index 01dcbb2d9..ea4114c23 100644 --- a/spine-cpp/spine-cpp/src/spine/Skin.cpp +++ b/spine-cpp/spine-cpp/src/spine/Skin.cpp @@ -164,7 +164,6 @@ void Skin::addSkin(Skin *other) { AttachmentMap::Entries entries = other->getAttachments(); while (entries.hasNext()) { AttachmentMap::Entry &entry = entries.next(); - entry._attachment->reference(); setAttachment(entry._slotIndex, entry._name, entry._attachment); } } diff --git a/spine-csharp/src/IkConstraint.cs b/spine-csharp/src/IkConstraint.cs index 7b1a261ce..c1a693300 100644 --- a/spine-csharp/src/IkConstraint.cs +++ b/spine-csharp/src/IkConstraint.cs @@ -172,7 +172,7 @@ namespace Spine { ty = targetY - bone.worldY; break; case TransformMode.NoRotationOrReflection: { - float s = Math.Abs(pa * pd - pb * pc) / (pa * pa + pc * pc); + float s = Math.Abs(pa * pd - pb * pc) / Math.Max(0.0001f, pa * pa + pc * pc); float sa = pa / bone.skeleton.scaleX; float sc = pc / bone.skeleton.scaleY; pb = -sc * s * bone.skeleton.scaleX; @@ -183,8 +183,13 @@ namespace Spine { default: { float x = targetX - p.worldX, y = targetY - p.worldY; float d = pa * pd - pb * pc; - tx = (x * pd - y * pb) / d - bone.ax; - ty = (y * pa - x * pc) / d - bone.ay; + if (Math.Abs(d) <= 0.0001f) { + tx = 0; + ty = 0; + } else { + tx = (x * pd - y * pb) / d - bone.ax; + ty = (y * pa - x * pc) / d - bone.ay; + } break; } } @@ -256,7 +261,8 @@ namespace Spine { b = pp.b; c = pp.c; d = pp.d; - float id = 1 / (a * d - b * c), x = cwx - pp.worldX, y = cwy - pp.worldY; + float id = a * d - b * c, x = cwx - pp.worldX, y = cwy - pp.worldY; + id = Math.Abs(id) <= 0.0001f ? 0 : 1 / id; float dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py; float l1 = (float)Math.Sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2; if (l1 < 0.0001f) { diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java index 9cfda305f..18b7f1813 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java @@ -195,7 +195,7 @@ public class IkConstraint implements Updatable { ty = targetY - bone.worldY; break; case noRotationOrReflection: - float s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc); + float s = Math.abs(pa * pd - pb * pc) / Math.max(0.0001f, pa * pa + pc * pc); float sa = pa / bone.skeleton.scaleX; float sc = pc / bone.skeleton.scaleY; pb = -sc * s * bone.skeleton.scaleX; @@ -205,8 +205,13 @@ public class IkConstraint implements Updatable { default: float x = targetX - p.worldX, y = targetY - p.worldY; float d = pa * pd - pb * pc; - tx = (x * pd - y * pb) / d - bone.ax; - ty = (y * pa - x * pc) / d - bone.ay; + if (Math.abs(d) <= 0.0001f) { + tx = 0; + ty = 0; + } else { + tx = (x * pd - y * pb) / d - bone.ax; + ty = (y * pa - x * pc) / d - bone.ay; + } } rotationIK += atan2Deg(ty, tx); if (bone.ascaleX < 0) rotationIK += 180; @@ -276,7 +281,8 @@ public class IkConstraint implements Updatable { b = pp.b; c = pp.c; d = pp.d; - float id = 1 / (a * d - b * c), x = cwx - pp.worldX, y = cwy - pp.worldY; + float id = a * d - b * c, x = cwx - pp.worldX, y = cwy - pp.worldY; + id = Math.abs(id) <= 0.0001f ? 0 : 1 / id; float dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py; float l1 = (float)Math.sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2; if (l1 < 0.0001f) { diff --git a/spine-ts/index.html b/spine-ts/index.html index 02607684a..bb13ebed6 100644 --- a/spine-ts/index.html +++ b/spine-ts/index.html @@ -18,7 +18,7 @@
  • Phaser
  • Player