mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[libgdx] Fixed some timelines not applying additively.
This commit is contained in:
parent
ab46181a0d
commit
8c9d3b70f1
@ -430,14 +430,11 @@ public class Animation {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
float value = getCurveValue(time);
|
float value = getCurveValue(time);
|
||||||
switch (blend) {
|
return switch (blend) {
|
||||||
case setup:
|
case setup -> setup + value * alpha;
|
||||||
return setup + value * alpha;
|
case first, replace -> current + (value + setup - current) * alpha;
|
||||||
case first:
|
case add -> current + value * alpha;
|
||||||
case replace:
|
};
|
||||||
value += setup - current;
|
|
||||||
}
|
|
||||||
return current + value * alpha;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getAbsoluteValue (float time, float alpha, MixBlend blend, float current, float setup) {
|
public float getAbsoluteValue (float time, float alpha, MixBlend blend, float current, float setup) {
|
||||||
@ -449,8 +446,11 @@ public class Animation {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
float value = getCurveValue(time);
|
float value = getCurveValue(time);
|
||||||
if (blend == MixBlend.setup) return setup + (value - setup) * alpha;
|
return switch (blend) {
|
||||||
return current + (value - current) * alpha;
|
case setup -> setup + (value - setup) * alpha;
|
||||||
|
case first, replace -> current + (value - current) * alpha;
|
||||||
|
case add -> current + value * alpha;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getAbsoluteValue (float time, float alpha, MixBlend blend, float current, float setup, float value) {
|
public float getAbsoluteValue (float time, float alpha, MixBlend blend, float current, float setup, float value) {
|
||||||
@ -461,8 +461,11 @@ public class Animation {
|
|||||||
default -> current;
|
default -> current;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (blend == MixBlend.setup) return setup + (value - setup) * alpha;
|
return switch (blend) {
|
||||||
return current + (value - current) * alpha;
|
case setup -> setup + (value - setup) * alpha;
|
||||||
|
case first, replace -> current + (value - current) * alpha;
|
||||||
|
case add -> current + value * alpha;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getScaleValue (float time, float alpha, MixBlend blend, MixDirection direction, float current, float setup) {
|
public float getScaleValue (float time, float alpha, MixBlend blend, MixDirection direction, float current, float setup) {
|
||||||
@ -1979,7 +1982,8 @@ public class Animation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blend == MixBlend.setup) {
|
switch (blend) {
|
||||||
|
case setup -> {
|
||||||
IkConstraintPose setup = constraint.data.setup;
|
IkConstraintPose setup = constraint.data.setup;
|
||||||
pose.mix = setup.mix + (mix - setup.mix) * alpha;
|
pose.mix = setup.mix + (mix - setup.mix) * alpha;
|
||||||
pose.softness = setup.softness + (softness - setup.softness) * alpha;
|
pose.softness = setup.softness + (softness - setup.softness) * alpha;
|
||||||
@ -1987,20 +1991,23 @@ public class Animation {
|
|||||||
pose.bendDirection = setup.bendDirection;
|
pose.bendDirection = setup.bendDirection;
|
||||||
pose.compress = setup.compress;
|
pose.compress = setup.compress;
|
||||||
pose.stretch = setup.stretch;
|
pose.stretch = setup.stretch;
|
||||||
} else {
|
return;
|
||||||
pose.bendDirection = (int)frames[i + BEND_DIRECTION];
|
|
||||||
pose.compress = frames[i + COMPRESS] != 0;
|
|
||||||
pose.stretch = frames[i + STRETCH] != 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pose.mix += (mix - pose.mix) * alpha;
|
|
||||||
pose.softness += (softness - pose.softness) * alpha;
|
|
||||||
if (direction == in) {
|
|
||||||
pose.bendDirection = (int)frames[i + BEND_DIRECTION];
|
|
||||||
pose.compress = frames[i + COMPRESS] != 0;
|
|
||||||
pose.stretch = frames[i + STRETCH] != 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case first, replace -> {
|
||||||
|
pose.mix += (mix - pose.mix) * alpha;
|
||||||
|
pose.softness += (softness - pose.softness) * alpha;
|
||||||
|
if (direction == out) return;
|
||||||
|
}
|
||||||
|
case add -> {
|
||||||
|
pose.mix += mix * alpha;
|
||||||
|
pose.softness += softness * alpha;
|
||||||
|
if (direction == out) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pose.bendDirection = (int)frames[i + BEND_DIRECTION];
|
||||||
|
pose.compress = frames[i + COMPRESS] != 0;
|
||||||
|
pose.stretch = frames[i + STRETCH] != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2109,7 +2116,8 @@ public class Animation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blend == setup) {
|
switch (blend) {
|
||||||
|
case setup -> {
|
||||||
TransformConstraintPose setup = constraint.data.setup;
|
TransformConstraintPose setup = constraint.data.setup;
|
||||||
pose.mixRotate = setup.mixRotate + (rotate - setup.mixRotate) * alpha;
|
pose.mixRotate = setup.mixRotate + (rotate - setup.mixRotate) * alpha;
|
||||||
pose.mixX = setup.mixX + (x - setup.mixX) * alpha;
|
pose.mixX = setup.mixX + (x - setup.mixX) * alpha;
|
||||||
@ -2117,7 +2125,8 @@ public class Animation {
|
|||||||
pose.mixScaleX = setup.mixScaleX + (scaleX - setup.mixScaleX) * alpha;
|
pose.mixScaleX = setup.mixScaleX + (scaleX - setup.mixScaleX) * alpha;
|
||||||
pose.mixScaleY = setup.mixScaleY + (scaleY - setup.mixScaleY) * alpha;
|
pose.mixScaleY = setup.mixScaleY + (scaleY - setup.mixScaleY) * alpha;
|
||||||
pose.mixShearY = setup.mixShearY + (shearY - setup.mixShearY) * alpha;
|
pose.mixShearY = setup.mixShearY + (shearY - setup.mixShearY) * alpha;
|
||||||
} else {
|
}
|
||||||
|
case first, replace -> {
|
||||||
pose.mixRotate += (rotate - pose.mixRotate) * alpha;
|
pose.mixRotate += (rotate - pose.mixRotate) * alpha;
|
||||||
pose.mixX += (x - pose.mixX) * alpha;
|
pose.mixX += (x - pose.mixX) * alpha;
|
||||||
pose.mixY += (y - pose.mixY) * alpha;
|
pose.mixY += (y - pose.mixY) * alpha;
|
||||||
@ -2125,6 +2134,15 @@ public class Animation {
|
|||||||
pose.mixScaleY += (scaleY - pose.mixScaleY) * alpha;
|
pose.mixScaleY += (scaleY - pose.mixScaleY) * alpha;
|
||||||
pose.mixShearY += (shearY - pose.mixShearY) * alpha;
|
pose.mixShearY += (shearY - pose.mixShearY) * alpha;
|
||||||
}
|
}
|
||||||
|
case add -> {
|
||||||
|
pose.mixRotate += rotate * alpha;
|
||||||
|
pose.mixX += x * alpha;
|
||||||
|
pose.mixY += y * alpha;
|
||||||
|
pose.mixScaleX += scaleX * alpha;
|
||||||
|
pose.mixScaleY += scaleY * alpha;
|
||||||
|
pose.mixShearY += shearY * alpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2257,16 +2275,24 @@ public class Animation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blend == setup) {
|
switch (blend) {
|
||||||
|
case setup -> {
|
||||||
PathConstraintPose setup = constraint.data.setup;
|
PathConstraintPose setup = constraint.data.setup;
|
||||||
pose.mixRotate = setup.mixRotate + (rotate - setup.mixRotate) * alpha;
|
pose.mixRotate = setup.mixRotate + (rotate - setup.mixRotate) * alpha;
|
||||||
pose.mixX = setup.mixX + (x - setup.mixX) * alpha;
|
pose.mixX = setup.mixX + (x - setup.mixX) * alpha;
|
||||||
pose.mixY = setup.mixY + (y - setup.mixY) * alpha;
|
pose.mixY = setup.mixY + (y - setup.mixY) * alpha;
|
||||||
} else {
|
}
|
||||||
|
case first, replace -> {
|
||||||
pose.mixRotate += (rotate - pose.mixRotate) * alpha;
|
pose.mixRotate += (rotate - pose.mixRotate) * alpha;
|
||||||
pose.mixX += (x - pose.mixX) * alpha;
|
pose.mixX += (x - pose.mixX) * alpha;
|
||||||
pose.mixY += (y - pose.mixY) * alpha;
|
pose.mixY += (y - pose.mixY) * alpha;
|
||||||
}
|
}
|
||||||
|
case add -> {
|
||||||
|
pose.mixRotate += rotate * alpha;
|
||||||
|
pose.mixX += x * alpha;
|
||||||
|
pose.mixY += y * alpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2282,7 +2308,6 @@ public class Animation {
|
|||||||
|
|
||||||
if (constraintIndex == -1) {
|
if (constraintIndex == -1) {
|
||||||
float value = time >= frames[0] ? getCurveValue(time) : 0;
|
float value = time >= frames[0] ? getCurveValue(time) : 0;
|
||||||
|
|
||||||
PhysicsConstraint[] constraints = skeleton.physics.items;
|
PhysicsConstraint[] constraints = skeleton.physics.items;
|
||||||
for (int i = 0, n = skeleton.physics.size; i < n; i++) {
|
for (int i = 0, n = skeleton.physics.size; i < n; i++) {
|
||||||
PhysicsConstraint constraint = constraints[i];
|
PhysicsConstraint constraint = constraints[i];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user