mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Fixed flipping to use world axes, fixed disable inherit scale and rotation when flipped.
This commit is contained in:
parent
4283d6fce3
commit
ac2721c553
@ -103,16 +103,14 @@ namespace Spine {
|
|||||||
if (parent == null) { // Root bone.
|
if (parent == null) { // Root bone.
|
||||||
Skeleton skeleton = this.skeleton;
|
Skeleton skeleton = this.skeleton;
|
||||||
if (skeleton.flipX) {
|
if (skeleton.flipX) {
|
||||||
la = -la;
|
|
||||||
lc = -lc;
|
|
||||||
scaleX = -scaleX;
|
|
||||||
x = -x;
|
x = -x;
|
||||||
|
la = -la;
|
||||||
|
lb = -lb;
|
||||||
}
|
}
|
||||||
if (skeleton.flipY != yDown) {
|
if (skeleton.flipY != yDown) {
|
||||||
lb = -lb;
|
|
||||||
ld = -ld;
|
|
||||||
scaleY = -scaleY;
|
|
||||||
y = -y;
|
y = -y;
|
||||||
|
lc = -lc;
|
||||||
|
ld = -ld;
|
||||||
}
|
}
|
||||||
a = la;
|
a = la;
|
||||||
b = lb;
|
b = lb;
|
||||||
@ -145,24 +143,32 @@ namespace Spine {
|
|||||||
while (p != null) {
|
while (p != null) {
|
||||||
cos = MathUtils.CosDeg(p.appliedRotation);
|
cos = MathUtils.CosDeg(p.appliedRotation);
|
||||||
sin = MathUtils.SinDeg(p.appliedRotation);
|
sin = MathUtils.SinDeg(p.appliedRotation);
|
||||||
float a = pa * cos + pb * sin;
|
float ta = pa * cos + pb * sin;
|
||||||
float b = pa * -sin + pb * cos;
|
float tb = pa * -sin + pb * cos;
|
||||||
float c = pc * cos + pd * sin;
|
float tc = pc * cos + pd * sin;
|
||||||
float d = pc * -sin + pd * cos;
|
float td = pc * -sin + pd * cos;
|
||||||
pa = a;
|
pa = ta;
|
||||||
pb = b;
|
pb = tb;
|
||||||
pc = c;
|
pc = tc;
|
||||||
pd = d;
|
pd = td;
|
||||||
p = p.parent;
|
p = p.parent;
|
||||||
}
|
}
|
||||||
if (yDown) {
|
if (yDown) {
|
||||||
pb = -pb;
|
pb = -pb;
|
||||||
pd = -pd;
|
pd = -pd;
|
||||||
}
|
}
|
||||||
this.a = pa * la + pb * lc;
|
a = pa * la + pb * lc;
|
||||||
this.b = pa * lb + pb * ld;
|
b = pa * lb + pb * ld;
|
||||||
this.c = pc * la + pd * lc;
|
c = pc * la + pd * lc;
|
||||||
this.d = pc * lb + pd * ld;
|
d = pc * lb + pd * ld;
|
||||||
|
if (skeleton.flipX) {
|
||||||
|
a = -a;
|
||||||
|
b = -b;
|
||||||
|
}
|
||||||
|
if (skeleton.flipY) {
|
||||||
|
c = -c;
|
||||||
|
d = -d;
|
||||||
|
}
|
||||||
} else if (data.inheritScale) { // No rotation inheritance.
|
} else if (data.inheritScale) { // No rotation inheritance.
|
||||||
Bone p = parent;
|
Bone p = parent;
|
||||||
pa = 1;
|
pa = 1;
|
||||||
@ -202,6 +208,14 @@ namespace Spine {
|
|||||||
b = pa * lb + pb * ld;
|
b = pa * lb + pb * ld;
|
||||||
c = pc * la + pd * lc;
|
c = pc * la + pd * lc;
|
||||||
d = pc * lb + pd * ld;
|
d = pc * lb + pd * ld;
|
||||||
|
if (skeleton.flipX) {
|
||||||
|
a = -a;
|
||||||
|
b = -b;
|
||||||
|
}
|
||||||
|
if (skeleton.flipY) {
|
||||||
|
c = -c;
|
||||||
|
d = -d;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
a = la;
|
a = la;
|
||||||
b = lb;
|
b = lb;
|
||||||
|
|||||||
@ -95,16 +95,14 @@ public class Bone implements Updatable {
|
|||||||
if (parent == null) { // Root bone.
|
if (parent == null) { // Root bone.
|
||||||
Skeleton skeleton = this.skeleton;
|
Skeleton skeleton = this.skeleton;
|
||||||
if (skeleton.flipX) {
|
if (skeleton.flipX) {
|
||||||
la = -la;
|
|
||||||
lc = -lc;
|
|
||||||
scaleX = -scaleX;
|
|
||||||
x = -x;
|
x = -x;
|
||||||
|
la = -la;
|
||||||
|
lb = -lb;
|
||||||
}
|
}
|
||||||
if (skeleton.flipY) {
|
if (skeleton.flipY) {
|
||||||
lb = -lb;
|
|
||||||
ld = -ld;
|
|
||||||
scaleY = -scaleY;
|
|
||||||
y = -y;
|
y = -y;
|
||||||
|
lc = -lc;
|
||||||
|
ld = -ld;
|
||||||
}
|
}
|
||||||
a = la;
|
a = la;
|
||||||
b = lb;
|
b = lb;
|
||||||
@ -151,6 +149,14 @@ public class Bone implements Updatable {
|
|||||||
b = pa * lb + pb * ld;
|
b = pa * lb + pb * ld;
|
||||||
c = pc * la + pd * lc;
|
c = pc * la + pd * lc;
|
||||||
d = pc * lb + pd * ld;
|
d = pc * lb + pd * ld;
|
||||||
|
if (skeleton.flipX) {
|
||||||
|
a = -a;
|
||||||
|
b = -b;
|
||||||
|
}
|
||||||
|
if (skeleton.flipY) {
|
||||||
|
c = -c;
|
||||||
|
d = -d;
|
||||||
|
}
|
||||||
} else if (data.inheritScale) { // No rotation inheritance.
|
} else if (data.inheritScale) { // No rotation inheritance.
|
||||||
Bone p = parent;
|
Bone p = parent;
|
||||||
pa = 1;
|
pa = 1;
|
||||||
@ -186,6 +192,14 @@ public class Bone implements Updatable {
|
|||||||
b = pa * lb + pb * ld;
|
b = pa * lb + pb * ld;
|
||||||
c = pc * la + pd * lc;
|
c = pc * la + pd * lc;
|
||||||
d = pc * lb + pd * ld;
|
d = pc * lb + pd * ld;
|
||||||
|
if (skeleton.flipX) {
|
||||||
|
a = -a;
|
||||||
|
b = -b;
|
||||||
|
}
|
||||||
|
if (skeleton.flipY) {
|
||||||
|
c = -c;
|
||||||
|
d = -d;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
a = la;
|
a = la;
|
||||||
b = lb;
|
b = lb;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user