Removed appliedScaleX/Y.

These existed because TransformConstraint used to manipulate the local transform. Now that it manipulates the world transform, they aren't used.
This commit is contained in:
NathanSweet 2016-06-05 00:57:49 +02:00
parent 7e7aaad550
commit 3d8b674444
2 changed files with 7 additions and 16 deletions

View File

@ -44,7 +44,7 @@ public class Bone implements Updatable {
final Bone parent;
final Array<Bone> children = new Array();
float x, y, rotation, scaleX, scaleY, shearX, shearY;
float appliedRotation, appliedScaleX, appliedScaleY;
float appliedRotation;
float a, b, worldX;
float c, d, worldY;
@ -92,8 +92,6 @@ public class Bone implements Updatable {
/** Computes the world transform using the parent bone and the specified local transform. */
public void updateWorldTransform (float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY) {
appliedRotation = rotation;
appliedScaleX = scaleX;
appliedScaleY = scaleY;
float rotationY = rotation + 90 + shearY;
float la = cosDeg(rotation + shearX) * scaleX, lb = cosDeg(rotationY) * scaleY;
@ -163,7 +161,7 @@ public class Bone implements Updatable {
pd = 1;
do {
float cos = cosDeg(parent.appliedRotation), sin = sinDeg(parent.appliedRotation);
float psx = parent.appliedScaleX, psy = parent.appliedScaleY;
float psx = parent.scaleX, psy = parent.scaleY;
float za = cos * psx, zb = sin * psy, zc = sin * psx, zd = cos * psy;
float temp = pa * za + pb * zc;
pb = pb * zd - pa * zb;
@ -418,8 +416,6 @@ public class Bone implements Updatable {
rotation = 90 - atan2(rd, rb) * radDeg;
}
appliedRotation = rotation;
appliedScaleX = scaleX;
appliedScaleY = scaleY;
}
public Matrix3 getWorldTransform (Matrix3 worldTransform) {

View File

@ -135,12 +135,8 @@ public class IkConstraint implements Updatable {
if (rotationIK > 180)
rotationIK -= 360;
else if (rotationIK < -180) rotationIK += 360;
bone.updateWorldTransform(bone.x, bone.y, bone.rotation + (rotationIK - bone.rotation) * alpha, bone.appliedScaleX,
bone.appliedScaleY, bone.shearX, bone.shearY);
/*
* parents of this thing this thing (bone) ik constraint
*/
bone.updateWorldTransform(bone.x, bone.y, bone.rotation + (rotationIK - bone.rotation) * alpha, bone.scaleX, bone.scaleY,
bone.shearX, bone.shearY);
}
/** Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as possible. The
@ -148,7 +144,7 @@ public class IkConstraint implements Updatable {
* @param child A direct descendant of the parent bone. */
static public void apply (Bone parent, Bone child, float targetX, float targetY, int bendDir, float alpha) {
if (alpha == 0) return;
float px = parent.x, py = parent.y, psx = parent.appliedScaleX, psy = parent.appliedScaleY, csx = child.appliedScaleX;
float px = parent.x, py = parent.y, psx = parent.scaleX, psy = parent.scaleY, csx = child.scaleX;
int os1, os2, s2;
if (psx < 0) {
psx = -psx;
@ -266,13 +262,12 @@ public class IkConstraint implements Updatable {
if (a1 > 180)
a1 -= 360;
else if (a1 < -180) a1 += 360;
parent.updateWorldTransform(px, py, rotation + a1 * alpha, parent.appliedScaleX, parent.appliedScaleY, 0, 0);
parent.updateWorldTransform(px, py, rotation + a1 * alpha, parent.scaleX, parent.scaleY, 0, 0);
rotation = child.rotation;
a2 = ((a2 + os) * radDeg - child.shearX) * s2 + os2 - rotation;
if (a2 > 180)
a2 -= 360;
else if (a2 < -180) a2 += 360;
child.updateWorldTransform(cx, cy, rotation + a2 * alpha, child.appliedScaleX, child.appliedScaleY, child.shearX,
child.shearY);
child.updateWorldTransform(cx, cy, rotation + a2 * alpha, child.scaleX, child.scaleY, child.shearX, child.shearY);
}
}