Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
0.1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Aloento committed Jan 18, 2021
1 parent cddd827 commit 796d7f2
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ private boolean hasTimeline(int id) {
if (((Timeline) timelines[i]).getPropertyId() == id) return true;
return false;
}

public int getTrackIndex() {
return trackIndex;
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/esotericsoftware/SpineStandard/Bone.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void updateWorldTransform(float x, float y, float rotation, float scaleX,
Skeleton skeleton = this.skeleton;
float rotationY = rotation + 90 + shearY, sx = skeleton.scaleX, sy = skeleton.scaleY;
a = cosDeg(rotation + shearX) * scaleX * sx;
switch (RuntimesLoader.spineVersion.get()){
switch (RuntimesLoader.spineVersion.get()) {
case 38 -> {
b = cosDeg(rotationY) * scaleY * sx;
c = sinDeg(rotation + shearX) * scaleX * sy;
Expand Down Expand Up @@ -183,10 +183,11 @@ public void updateWorldTransform(float x, float y, float rotation, float scaleX,
za *= s;
zc *= s;
s = (float) Math.sqrt(za * za + zc * zc);
boolean b1 = pa * pd - pb * pc < 0;
switch (RuntimesLoader.spineVersion.get()) {
case 38, 37 -> {
if (data.transformMode == TransformMode.noScale
&& (pa * pd - pb * pc < 0) == (skeleton.scaleX < 0 == skeleton.scaleY < 0)) s = -s;
&& b1 == (skeleton.scaleX < 0 == skeleton.scaleY < 0)) s = -s;
}
}
float r = PI / 2 + atan2(zc, za);
Expand All @@ -198,7 +199,7 @@ public void updateWorldTransform(float x, float y, float rotation, float scaleX,
float ld = sinDeg(90 + shearY) * scaleY;
switch (RuntimesLoader.spineVersion.get()) {
case 36 -> {
if (data.transformMode != TransformMode.noScaleOrReflection ? pa * pd - pb * pc < 0 : skeleton.flipX != skeleton.flipY) {
if (data.transformMode != TransformMode.noScaleOrReflection ? b1 : skeleton.flipX != skeleton.flipY) {
zb = -zb;
zd = -zd;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,12 @@ static public void apply(Bone parent, Bone child, float targetX, float targetY,
else if (cos > 1) {
cos = 1;
switch (RuntimesLoader.spineVersion.get()) {
case 38 -> {if (stretch) sx *= ((float) Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;}
case 37 -> {if (stretch && l1 + l2 > 0.0001f) sx *= ((float) Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;}
case 38 -> {
if (stretch) sx *= ((float) Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
}
case 37 -> {
if (stretch && l1 + l2 > 0.0001f) sx *= ((float) Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
}
}
}
a2 = (float) Math.acos(cos) * bendDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,13 @@ private void addAfterPosition(float p, float[] temp, int i, float[] out, int o)

private void addCurvePosition(float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2,
float[] out, int o, boolean tangents) {
double atan2 = Math.atan2(cy1 - y1, cx1 - x1);
if (p < epsilon || Float.isNaN(p)) {
switch (RuntimesLoader.spineVersion.get()) {
case 38, 37 -> {
out[o] = x1;
out[o + 1] = y1;
out[o + 2] = (float) Math.atan2(cy1 - y1, cx1 - x1);
out[o + 2] = (float) atan2;
return;
}
case 36 -> p = epsilon;
Expand All @@ -406,8 +407,9 @@ private void addCurvePosition(float p, float x1, float y1, float cx1, float cy1,
out[o] = x;
out[o + 1] = y;
if (tangents) {
if (p < 0.001f) out[o + 2] = (float) Math.atan2(cy1 - y1, cx1 - x1);
else out[o + 2] = (float) Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
if (p < 0.001f) out[o + 2] = (float) atan2;
else
out[o + 2] = (float) Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,10 @@ public String readString() throws IOException {
switch (RuntimesLoader.spineVersion.get()) {
case 38, 37 -> {
if (RuntimesLoader.spineVersion.get() == 37) {
skeletonData.audioPath = input.readString();
if (skeletonData.audioPath.isEmpty()) skeletonData.audioPath = null;
}}
skeletonData.audioPath = input.readString();
if (skeletonData.audioPath.isEmpty()) skeletonData.audioPath = null;
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

public interface Updatable {
void update();

boolean isActive();
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public void draw(Batch batch, float parentAlpha) {
case 38, 37 -> {
int blendSrc = batch.getBlendSrcFunc(), blendDst = batch.getBlendDstFunc();
int blendSrcAlpha = batch.getBlendSrcFuncAlpha(), blendDstAlpha = batch.getBlendDstFuncAlpha();
if (resetBlendFunction) batch.setBlendFunctionSeparate(blendSrc, blendDst, blendSrcAlpha, blendDstAlpha);
if (resetBlendFunction)
batch.setBlendFunctionSeparate(blendSrc, blendDst, blendSrcAlpha, blendDstAlpha);
}
}
color.a = oldAlpha;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public void draw(Batch batch, float x, float y, float width, float height) {
case 38, 37 -> {
int blendSrc = batch.getBlendSrcFunc(), blendDst = batch.getBlendDstFunc();
int blendSrcAlpha = batch.getBlendSrcFuncAlpha(), blendDstAlpha = batch.getBlendDstFuncAlpha();
if (resetBlendFunction) batch.setBlendFunctionSeparate(blendSrc, blendDst, blendSrcAlpha, blendDstAlpha);
if (resetBlendFunction)
batch.setBlendFunctionSeparate(blendSrc, blendDst, blendSrcAlpha, blendDstAlpha);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public void end() {
if (vertexIndex > 0) flush();
Gdx.gl.glDepthMask(true);
switch (RuntimesLoader.spineVersion.get()) {
case 38, 37 -> {if (isBlendingEnabled()) Gdx.gl.glDisable(GL20.GL_BLEND);}
case 38, 37 -> {
if (isBlendingEnabled()) Gdx.gl.glDisable(GL20.GL_BLEND);
}
case 36 -> Gdx.gl.glDisable(GL20.GL_BLEND);
}
lastTexture = null;
Expand Down

0 comments on commit 796d7f2

Please sign in to comment.