mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-05 23:05:01 +08:00
Changed skeleton x,y to be propagated using the root bone world x,y.
Can't remember any good reason not to do this.
This commit is contained in:
parent
5c9b41a748
commit
5edcd916cc
@ -121,8 +121,8 @@ public class Bone implements Updatable {
|
||||
b = lb;
|
||||
c = lc;
|
||||
d = ld;
|
||||
worldX = x;
|
||||
worldY = y;
|
||||
worldX = x + skeleton.x;
|
||||
worldY = y + skeleton.y;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -90,14 +90,12 @@ public class PathConstraint implements Constraint {
|
||||
|
||||
float[] positions = computeWorldPositions((PathAttachment)attachment, spacesCount, tangents,
|
||||
data.positionMode == PositionMode.percent, spacingMode == SpacingMode.percent);
|
||||
Skeleton skeleton = target.getSkeleton();
|
||||
float skeletonX = skeleton.x, skeletonY = skeleton.y;
|
||||
float boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;
|
||||
boolean tip = rotateMode == RotateMode.chain && offsetRotation == 0;
|
||||
for (int i = 0, p = 3; i < boneCount; i++, p += 3) {
|
||||
Bone bone = (Bone)bones[i];
|
||||
bone.worldX += (boneX - skeletonX - bone.worldX) * translateMix;
|
||||
bone.worldY += (boneY - skeletonY - bone.worldY) * translateMix;
|
||||
bone.worldX += (boneX - bone.worldX) * translateMix;
|
||||
bone.worldY += (boneY - bone.worldY) * translateMix;
|
||||
float x = positions[p], y = positions[p + 1], dx = x - boneX, dy = y - boneY;
|
||||
if (scale) {
|
||||
float length = lengths[i];
|
||||
|
||||
@ -74,7 +74,7 @@ public class SkeletonMeshRenderer extends SkeletonRenderer<PolygonSpriteBatch> {
|
||||
float oldScaleX = rootBone.getScaleX();
|
||||
float oldScaleY = rootBone.getScaleY();
|
||||
float oldRotation = rootBone.getRotation();
|
||||
attachmentSkeleton.setPosition(skeleton.getX() + bone.getWorldX(), skeleton.getY() + bone.getWorldY());
|
||||
attachmentSkeleton.setPosition(bone.getWorldX(), bone.getWorldY());
|
||||
// rootBone.setScaleX(1 + bone.getWorldScaleX() - oldScaleX);
|
||||
// rootBone.setScaleY(1 + bone.getWorldScaleY() - oldScaleY);
|
||||
// Set shear.
|
||||
|
||||
@ -70,7 +70,7 @@ public class SkeletonRenderer<T extends Batch> {
|
||||
float oldScaleX = rootBone.getScaleX();
|
||||
float oldScaleY = rootBone.getScaleY();
|
||||
float oldRotation = rootBone.getRotation();
|
||||
attachmentSkeleton.setPosition(skeleton.getX() + bone.getWorldX(), skeleton.getY() + bone.getWorldY());
|
||||
attachmentSkeleton.setPosition(bone.getWorldX(), bone.getWorldY());
|
||||
// rootBone.setScaleX(1 + bone.getWorldScaleX() - oldScaleX);
|
||||
// rootBone.setScaleY(1 + bone.getWorldScaleY() - oldScaleY);
|
||||
// Set shear.
|
||||
|
||||
@ -110,7 +110,6 @@ public class MeshAttachment extends VertexAttachment {
|
||||
| ((int)(skeletonColor.g * slotColor.g * meshColor.g * multiplier) << 8) //
|
||||
| (int)(skeletonColor.r * slotColor.r * meshColor.r * multiplier));
|
||||
|
||||
float x = skeleton.getX(), y = skeleton.getY();
|
||||
FloatArray deformArray = slot.getAttachmentVertices();
|
||||
float[] vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
int[] bones = this.bones;
|
||||
@ -118,8 +117,7 @@ public class MeshAttachment extends VertexAttachment {
|
||||
int verticesLength = vertices.length;
|
||||
if (deformArray.size > 0) vertices = deformArray.items;
|
||||
Bone bone = slot.getBone();
|
||||
x += bone.getWorldX();
|
||||
y += bone.getWorldY();
|
||||
float x = bone.getWorldX(), y = bone.getWorldY();
|
||||
float a = bone.getA(), b = bone.getB(), c = bone.getC(), d = bone.getD();
|
||||
for (int v = 0, w = 0; v < verticesLength; v += 2, w += 5) {
|
||||
float vx = vertices[v], vy = vertices[v + 1];
|
||||
@ -132,7 +130,7 @@ public class MeshAttachment extends VertexAttachment {
|
||||
Object[] skeletonBones = skeleton.getBones().items;
|
||||
if (deformArray.size == 0) {
|
||||
for (int w = 0, v = 0, b = 0, n = bones.length; v < n; w += 5) {
|
||||
float wx = x, wy = y;
|
||||
float wx = 0, wy = 0;
|
||||
int nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
Bone bone = (Bone)skeletonBones[bones[v]];
|
||||
@ -147,7 +145,7 @@ public class MeshAttachment extends VertexAttachment {
|
||||
} else {
|
||||
float[] deform = deformArray.items;
|
||||
for (int w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 5) {
|
||||
float wx = x, wy = y;
|
||||
float wx = 0, wy = 0;
|
||||
int nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
Bone bone = (Bone)skeletonBones[bones[v]];
|
||||
|
||||
@ -163,7 +163,7 @@ public class RegionAttachment extends Attachment {
|
||||
float[] vertices = this.vertices;
|
||||
float[] offset = this.offset;
|
||||
Bone bone = slot.getBone();
|
||||
float x = skeleton.getX() + bone.getWorldX(), y = skeleton.getY() + bone.getWorldY();
|
||||
float x = bone.getWorldX(), y = bone.getWorldY();
|
||||
float a = bone.getA(), b = bone.getB(), c = bone.getC(), d = bone.getD();
|
||||
float offsetX, offsetY;
|
||||
|
||||
|
||||
@ -58,15 +58,13 @@ public class VertexAttachment extends Attachment {
|
||||
protected void computeWorldVertices (Slot slot, int start, int count, float[] worldVertices, int offset) {
|
||||
count += offset;
|
||||
Skeleton skeleton = slot.getSkeleton();
|
||||
float x = skeleton.getX(), y = skeleton.getY();
|
||||
FloatArray deformArray = slot.getAttachmentVertices();
|
||||
float[] vertices = this.vertices;
|
||||
int[] bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.size > 0) vertices = deformArray.items;
|
||||
Bone bone = slot.getBone();
|
||||
x += bone.getWorldX();
|
||||
y += bone.getWorldY();
|
||||
float x = bone.getWorldX(), y = bone.getWorldY();
|
||||
float a = bone.getA(), b = bone.getB(), c = bone.getC(), d = bone.getD();
|
||||
for (int v = start, w = offset; w < count; v += 2, w += 2) {
|
||||
float vx = vertices[v], vy = vertices[v + 1];
|
||||
@ -84,7 +82,7 @@ public class VertexAttachment extends Attachment {
|
||||
Object[] skeletonBones = skeleton.getBones().items;
|
||||
if (deformArray.size == 0) {
|
||||
for (int w = offset, b = skip * 3; w < count; w += 2) {
|
||||
float wx = x, wy = y;
|
||||
float wx = 0, wy = 0;
|
||||
int n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
@ -99,7 +97,7 @@ public class VertexAttachment extends Attachment {
|
||||
} else {
|
||||
float[] deform = deformArray.items;
|
||||
for (int w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
float wx = x, wy = y;
|
||||
float wx = 0, wy = 0;
|
||||
int n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user