mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Merge branch '4.1' into 4.2-beta
This commit is contained in:
commit
954ab69bce
@ -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
|
||||
|
||||
@ -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,10 +94,15 @@ 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;
|
||||
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;
|
||||
|
||||
if (bone->ascaleX < 0) rotationIK += 180;
|
||||
@ -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;
|
||||
|
||||
@ -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,9 +61,14 @@ 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;
|
||||
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;
|
||||
if (rotationIK > 180) rotationIK -= 360;
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
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) {
|
||||
|
||||
@ -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,9 +205,14 @@ public class IkConstraint implements Updatable {
|
||||
default:
|
||||
float x = targetX - p.worldX, y = targetY - p.worldY;
|
||||
float d = pa * pd - pb * pc;
|
||||
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;
|
||||
if (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) {
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
</ul>
|
||||
<li>Phaser</li>
|
||||
<ul>
|
||||
<li><a href="/spine-phaser/example/index.html">Example</a></li>
|
||||
<li><a href="/spine-phaser/example/index.html">Examples</a></li>
|
||||
</ul>
|
||||
<li>Player</li>
|
||||
<ul>
|
||||
|
||||
@ -117,7 +117,7 @@ export class IkConstraint implements Updatable {
|
||||
ty = targetY - bone.worldY;
|
||||
break;
|
||||
case TransformMode.NoRotationOrReflection:
|
||||
let s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
||||
let s = Math.abs(pa * pd - pb * pc) / Math.max(0.0001, pa * pa + pc * pc);
|
||||
let sa = pa / bone.skeleton.scaleX;
|
||||
let sc = pc / bone.skeleton.scaleY;
|
||||
pb = -sc * s * bone.skeleton.scaleX;
|
||||
@ -127,9 +127,14 @@ export class IkConstraint implements Updatable {
|
||||
default:
|
||||
let x = targetX - p.worldX, y = targetY - p.worldY;
|
||||
let d = pa * pd - pb * pc;
|
||||
if (Math.abs(d) <= 0.0001) {
|
||||
tx = 0;
|
||||
ty = 0;
|
||||
} else {
|
||||
tx = (x * pd - y * pb) / d - bone.ax;
|
||||
ty = (y * pa - x * pc) / d - bone.ay;
|
||||
}
|
||||
}
|
||||
rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
|
||||
if (bone.ascaleX < 0) rotationIK += 180;
|
||||
if (rotationIK > 180)
|
||||
@ -194,7 +199,8 @@ export class IkConstraint implements Updatable {
|
||||
b = pp.b;
|
||||
c = pp.c;
|
||||
d = pp.d;
|
||||
let id = 1 / (a * d - b * c), x = cwx - pp.worldX, y = cwy - pp.worldY;
|
||||
let id = a * d - b * c, x = cwx - pp.worldX, y = cwy - pp.worldY;
|
||||
id = Math.abs(id) <= 0.0001 ? 0 : 1 / id;
|
||||
let dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;
|
||||
let l1 = Math.sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2;
|
||||
if (l1 < 0.0001) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user