Back to constant speed.

It's better.
This commit is contained in:
NathanSweet 2016-06-12 03:55:59 +02:00
parent 021dfe288b
commit 534ffc8d1d
4 changed files with 9 additions and 9 deletions

View File

@ -148,7 +148,7 @@ public class PathConstraint implements Updatable {
boolean closed = path.getClosed();
int verticesLength = path.getWorldVerticesLength(), curveCount = verticesLength / 6, prevCurve = NONE;
if (!path.getAccurate()) {
if (!path.getConstantSpeed()) {
float[] lengths = path.getLengths();
curveCount -= closed ? 1 : 2;
float pathLength = lengths[curveCount];

View File

@ -431,7 +431,7 @@ public class SkeletonBinary {
}
case path: {
boolean closed = input.readBoolean();
boolean accurate = input.readBoolean();
boolean constantSpeed = input.readBoolean();
int vertexCount = input.readInt(true);
Vertices vertices = readVertices(input, vertexCount);
float[] lengths = new float[vertexCount / 3];
@ -442,7 +442,7 @@ public class SkeletonBinary {
PathAttachment path = attachmentLoader.newPathAttachment(skin, name);
if (path == null) return null;
path.setClosed(closed);
path.setAccurate(accurate);
path.setConstantSpeed(constantSpeed);
path.setWorldVerticesLength(vertexCount << 1);
path.setVertices(vertices.vertices);
path.setBones(vertices.bones);

View File

@ -357,7 +357,7 @@ public class SkeletonJson {
PathAttachment path = attachmentLoader.newPathAttachment(skin, name);
if (path == null) return null;
path.setClosed(map.getBoolean("closed", false));
path.setAccurate(map.getBoolean("accurate", true));
path.setConstantSpeed(map.getBoolean("constantSpeed", true));
int vertexCount = map.getInt("vertexCount");
readVertices(map, path, vertexCount << 1);

View File

@ -36,7 +36,7 @@ import com.esotericsoftware.spine.Slot;
public class PathAttachment extends VertexAttachment {
float[] lengths;
boolean closed, accurate;
boolean closed, constantSpeed;
// Nonessential.
final Color color = new Color(1, 0.5f, 0, 1);
@ -61,12 +61,12 @@ public class PathAttachment extends VertexAttachment {
this.closed = closed;
}
public boolean getAccurate () {
return accurate;
public boolean getConstantSpeed () {
return constantSpeed;
}
public void setAccurate (boolean accurate) {
this.accurate = accurate;
public void setConstantSpeed (boolean constantSpeed) {
this.constantSpeed = constantSpeed;
}
/** Returns the length in the setup pose from the start of the path to the end of each curve. */