From 5a7cbf0a41b027fffc4387a1efe8884c9aebd0d3 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Sat, 13 Aug 2016 20:08:07 +0200 Subject: [PATCH] Removed world sign. Doesn't make sense to compute a value that the runtime no longer uses and is unlikely for application code to need. If application code does need it, it's trivial to walk up the bone hierarchy and calculate it. --- .../src/com/esotericsoftware/spine/Bone.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java index 8a47c74b8..9ee925a6d 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java @@ -49,7 +49,6 @@ public class Bone implements Updatable { float a, b, worldX; float c, d, worldY; - float worldSignX, worldSignY; boolean sorted; @@ -124,16 +123,12 @@ public class Bone implements Updatable { d = ld; worldX = x; worldY = y; - worldSignX = Math.signum(scaleX); - worldSignY = Math.signum(scaleY); 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.signum(scaleX); - worldSignY = parent.worldSignY * Math.signum(scaleY); if (data.inheritRotation && data.inheritScale) { a = pa * la + pb * lc; @@ -367,14 +362,6 @@ public class Bone implements Updatable { return worldY; } - public float getWorldSignX () { - return worldSignX; - } - - public float getWorldSignY () { - return worldSignY; - } - public float getWorldRotationX () { return atan2(c, a) * radDeg; } @@ -383,12 +370,14 @@ public class Bone implements Updatable { return atan2(d, b) * radDeg; } + /** Returns the magnitude (always positive) of the world scale X. */ public float getWorldScaleX () { - return (float)Math.sqrt(a * a + b * b) * worldSignX; + return (float)Math.sqrt(a * a + b * b); } + /** Returns the magnitude (always positive) of the world scale Y. */ public float getWorldScaleY () { - return (float)Math.sqrt(c * c + d * d) * worldSignY; + return (float)Math.sqrt(c * c + d * d); } public float worldToLocalRotationX () {