mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34: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();
|
||||
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];
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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. */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user