mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-06 10:46:53 +08:00
Back to constant speed.
It's better.
This commit is contained in:
parent
021dfe288b
commit
534ffc8d1d
@ -148,7 +148,7 @@ public class PathConstraint implements Updatable {
|
|||||||
boolean closed = path.getClosed();
|
boolean closed = path.getClosed();
|
||||||
int verticesLength = path.getWorldVerticesLength(), curveCount = verticesLength / 6, prevCurve = NONE;
|
int verticesLength = path.getWorldVerticesLength(), curveCount = verticesLength / 6, prevCurve = NONE;
|
||||||
|
|
||||||
if (!path.getAccurate()) {
|
if (!path.getConstantSpeed()) {
|
||||||
float[] lengths = path.getLengths();
|
float[] lengths = path.getLengths();
|
||||||
curveCount -= closed ? 1 : 2;
|
curveCount -= closed ? 1 : 2;
|
||||||
float pathLength = lengths[curveCount];
|
float pathLength = lengths[curveCount];
|
||||||
|
|||||||
@ -431,7 +431,7 @@ public class SkeletonBinary {
|
|||||||
}
|
}
|
||||||
case path: {
|
case path: {
|
||||||
boolean closed = input.readBoolean();
|
boolean closed = input.readBoolean();
|
||||||
boolean accurate = input.readBoolean();
|
boolean constantSpeed = input.readBoolean();
|
||||||
int vertexCount = input.readInt(true);
|
int vertexCount = input.readInt(true);
|
||||||
Vertices vertices = readVertices(input, vertexCount);
|
Vertices vertices = readVertices(input, vertexCount);
|
||||||
float[] lengths = new float[vertexCount / 3];
|
float[] lengths = new float[vertexCount / 3];
|
||||||
@ -442,7 +442,7 @@ public class SkeletonBinary {
|
|||||||
PathAttachment path = attachmentLoader.newPathAttachment(skin, name);
|
PathAttachment path = attachmentLoader.newPathAttachment(skin, name);
|
||||||
if (path == null) return null;
|
if (path == null) return null;
|
||||||
path.setClosed(closed);
|
path.setClosed(closed);
|
||||||
path.setAccurate(accurate);
|
path.setConstantSpeed(constantSpeed);
|
||||||
path.setWorldVerticesLength(vertexCount << 1);
|
path.setWorldVerticesLength(vertexCount << 1);
|
||||||
path.setVertices(vertices.vertices);
|
path.setVertices(vertices.vertices);
|
||||||
path.setBones(vertices.bones);
|
path.setBones(vertices.bones);
|
||||||
|
|||||||
@ -357,7 +357,7 @@ public class SkeletonJson {
|
|||||||
PathAttachment path = attachmentLoader.newPathAttachment(skin, name);
|
PathAttachment path = attachmentLoader.newPathAttachment(skin, name);
|
||||||
if (path == null) return null;
|
if (path == null) return null;
|
||||||
path.setClosed(map.getBoolean("closed", false));
|
path.setClosed(map.getBoolean("closed", false));
|
||||||
path.setAccurate(map.getBoolean("accurate", true));
|
path.setConstantSpeed(map.getBoolean("constantSpeed", true));
|
||||||
|
|
||||||
int vertexCount = map.getInt("vertexCount");
|
int vertexCount = map.getInt("vertexCount");
|
||||||
readVertices(map, path, vertexCount << 1);
|
readVertices(map, path, vertexCount << 1);
|
||||||
|
|||||||
@ -36,7 +36,7 @@ import com.esotericsoftware.spine.Slot;
|
|||||||
|
|
||||||
public class PathAttachment extends VertexAttachment {
|
public class PathAttachment extends VertexAttachment {
|
||||||
float[] lengths;
|
float[] lengths;
|
||||||
boolean closed, accurate;
|
boolean closed, constantSpeed;
|
||||||
|
|
||||||
// Nonessential.
|
// Nonessential.
|
||||||
final Color color = new Color(1, 0.5f, 0, 1);
|
final Color color = new Color(1, 0.5f, 0, 1);
|
||||||
@ -61,12 +61,12 @@ public class PathAttachment extends VertexAttachment {
|
|||||||
this.closed = closed;
|
this.closed = closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getAccurate () {
|
public boolean getConstantSpeed () {
|
||||||
return accurate;
|
return constantSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccurate (boolean accurate) {
|
public void setConstantSpeed (boolean constantSpeed) {
|
||||||
this.accurate = accurate;
|
this.constantSpeed = constantSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the length in the setup pose from the start of the path to the end of each curve. */
|
/** Returns the length in the setup pose from the start of the path to the end of each curve. */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user