Merge branch '3.7' into 3.8-beta

This commit is contained in:
badlogic 2019-02-12 14:25:12 +01:00
commit 833f8551f4
21 changed files with 307 additions and 215 deletions

View File

@ -300,12 +300,19 @@ package spine.animation {
var rotateTimeline : RotateTimeline = RotateTimeline(timeline);
var frames : Vector.<Number> = rotateTimeline.frames;
var bone : Bone = skeleton.bones[rotateTimeline.boneIndex];
var r1 : Number, r2 : Number;
if (time < frames[0]) {
if (blend == MixBlend.setup) bone.rotation = bone.data.rotation;
switch (blend) {
case MixBlend.setup:
bone.rotation = bone.data.rotation;
default:
return;
case MixBlend.first:
r1 = bone.rotation;
r2 = bone.data.rotation;
}
var r2 : Number;
} else {
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
if (time >= frames[frames.length - RotateTimeline.ENTRIES]) // Time is after last frame.
r2 = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION];
else {
@ -320,9 +327,9 @@ package spine.animation {
r2 = prevRotation + r2 * percent + bone.data.rotation;
r2 -= (16384 - int((16384.499999999996 - r2 / 360))) * 360;
}
}
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
var r1 : Number = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
var total : Number, diff : Number = r2 - r1;
diff -= (16384 - int((16384.499999999996 - diff / 360))) * 360;
if (diff == 0) {

View File

@ -538,12 +538,17 @@ void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline*
frames = rotateTimeline->frames;
bone = skeleton->bones[rotateTimeline->boneIndex];
if (time < frames[0]) {
if (blend == SP_MIX_BLEND_SETUP) {
switch (blend) {
case SP_MIX_BLEND_SETUP:
bone->rotation = bone->data->rotation;
default:
return;
case SP_MIX_BLEND_FIRST:
r1 = bone->rotation;
r2 = bone->data->rotation;
}
return; /* Time is before first frame. */
}
} else {
r1 = blend == SP_MIX_BLEND_SETUP ? bone->data->rotation : bone->rotation;
if (time >= frames[rotateTimeline->framesCount - ROTATE_ENTRIES]) /* Time is after last frame. */
r2 = bone->data->rotation + frames[rotateTimeline->framesCount + ROTATE_PREV_ROTATION];
else {
@ -552,16 +557,17 @@ void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline*
prevRotation = frames[frame + ROTATE_PREV_ROTATION];
frameTime = frames[frame];
percent = spCurveTimeline_getCurvePercent(SUPER(rotateTimeline), (frame >> 1) - 1,
1 - (time - frameTime) / (frames[frame + ROTATE_PREV_TIME] - frameTime));
1 - (time - frameTime) /
(frames[frame + ROTATE_PREV_TIME] - frameTime));
r2 = frames[frame + ROTATE_ROTATION] - prevRotation;
r2 -= (16384 - (int) (16384.499999999996 - r2 / 360)) * 360;
r2 = prevRotation + r2 * percent + bone->data->rotation;
r2 -= (16384 - (int) (16384.499999999996 - r2 / 360)) * 360;
}
}
/* Mix between rotations using the direction of the shortest route on the first frame while detecting crosses. */
r1 = blend == SP_MIX_BLEND_SETUP ? bone->data->rotation : bone->rotation;
diff = r2 - r1;
diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360;
if (diff == 0) {

View File

@ -642,14 +642,19 @@ void AnimationState::applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleto
Bone *bone = skeleton._bones[rotateTimeline->_boneIndex];
Vector<float>& frames = rotateTimeline->_frames;
float r1, r2;
if (time < frames[0]) {
if (blend == MixBlend_Setup) {
switch (blend) {
case MixBlend_Setup:
bone->_rotation = bone->_data._rotation;
}
default:
return;
case MixBlend_First:
r1 = bone->_rotation;
r2 = bone->_data._rotation;
}
float r2;
} else {
r1 = blend == MixBlend_Setup ? bone->_data._rotation : bone->_rotation;
if (time >= frames[frames.size() - RotateTimeline::ENTRIES]) {
// Time is after last frame.
r2 = bone->_data._rotation + frames[frames.size() + RotateTimeline::PREV_ROTATION];
@ -667,9 +672,9 @@ void AnimationState::applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleto
r2 = prevRotation + r2 * percent + bone->_data._rotation;
r2 -= (16384 - (int) (16384.499999999996 - r2 / 360)) * 360;
}
}
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
float r1 = blend == MixBlend_Setup ? bone->_data._rotation : bone->_rotation;
float total, diff = r2 - r1;
diff -= (16384 - (int) (16384.499999999996 - diff / 360)) * 360;
if (diff == 0) {

View File

@ -342,12 +342,20 @@ public class AnimationState {
RotateTimeline rotateTimeline = (RotateTimeline)timeline;
Bone bone = skeleton.bones.get(rotateTimeline.boneIndex);
float[] frames = rotateTimeline.frames;
float r1, r2;
if (time < frames[0]) { // Time is before first frame.
if (blend == MixBlend.setup) bone.rotation = bone.data.rotation;
switch (blend) {
case setup:
bone.rotation = bone.data.rotation;
// Fall through.
default:
return;
case first:
r1 = bone.rotation;
r2 = bone.data.rotation;
}
float r2;
} else {
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
if (time >= frames[frames.length - ENTRIES]) // Time is after last frame.
r2 = bone.data.rotation + frames[frames.length + PREV_ROTATION];
else {
@ -363,9 +371,9 @@ public class AnimationState {
r2 = prevRotation + r2 * percent + bone.data.rotation;
r2 -= (16384 - (int)(16384.499999999996 - r2 / 360)) * 360;
}
}
// Mix between rotations using the direction of the shortest route on the first frame.
float r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
float total, diff = r2 - r1;
diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360;
if (diff == 0)

View File

@ -475,12 +475,24 @@ function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, bl
local rotateTimeline = timeline
local frames = rotateTimeline.frames
local bone = skeleton.bones[rotateTimeline.boneIndex]
local r1 = 0
local r2 = 0
if time < frames[0] then
if blend == MixBlend.setup then bone.rotation = bone.data.rotation end
if blend == MixBlend.setup then
bone.rotation = bone.data.rotation
return
elseif blend == MixBlend.first then
r1 = bone.rotation
r2 = bone.data.rotation
else
return
end
local r2 = 0
else
if blend == MixBlend.setup then
r1 = bone.data.rotation
else
r1 = bone.rotation
end
if time >= frames[zlen(frames) - Animation.RotateTimeline.ENTRIES] then -- Time is after last frame.
r2 = bone.data.rotation + frames[zlen(frames) + Animation.RotateTimeline.PREV_ROTATION]
else
@ -496,10 +508,9 @@ function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, bl
r2 = prevRotation + r2 * percent + bone.data.rotation
r2 = r2 - (16384 - math_floor(16384.499999999996 - r2 / 360)) * 360
end
end
-- Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
local r1 = bone.rotation
if blend == MixBlend.setup then r1 = bone.data.rotation end
local total = 0
local diff = r2 - r1
diff = diff - (16384 - math_floor(16384.499999999996 - diff / 360)) * 360

View File

@ -1532,12 +1532,20 @@ var spine;
var rotateTimeline = timeline;
var frames = rotateTimeline.frames;
var bone = skeleton.bones[rotateTimeline.boneIndex];
var r1 = 0, r2 = 0;
if (time < frames[0]) {
if (blend == spine.MixBlend.setup)
switch (blend) {
case spine.MixBlend.setup:
bone.rotation = bone.data.rotation;
default:
return;
case spine.MixBlend.first:
r1 = bone.rotation;
r2 = bone.data.rotation;
}
var r2 = 0;
}
else {
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
else {
@ -1550,7 +1558,7 @@ var spine;
r2 = prevRotation + r2 * percent + bone.data.rotation;
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
}
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
}
var total = 0, diff = r2 - r1;
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
if (diff == 0) {

File diff suppressed because one or more lines are too long

View File

@ -1532,12 +1532,20 @@ var spine;
var rotateTimeline = timeline;
var frames = rotateTimeline.frames;
var bone = skeleton.bones[rotateTimeline.boneIndex];
var r1 = 0, r2 = 0;
if (time < frames[0]) {
if (blend == spine.MixBlend.setup)
switch (blend) {
case spine.MixBlend.setup:
bone.rotation = bone.data.rotation;
default:
return;
case spine.MixBlend.first:
r1 = bone.rotation;
r2 = bone.data.rotation;
}
var r2 = 0;
}
else {
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
else {
@ -1550,7 +1558,7 @@ var spine;
r2 = prevRotation + r2 * percent + bone.data.rotation;
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
}
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
}
var total = 0, diff = r2 - r1;
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
if (diff == 0) {

File diff suppressed because one or more lines are too long

View File

@ -1532,12 +1532,20 @@ var spine;
var rotateTimeline = timeline;
var frames = rotateTimeline.frames;
var bone = skeleton.bones[rotateTimeline.boneIndex];
var r1 = 0, r2 = 0;
if (time < frames[0]) {
if (blend == spine.MixBlend.setup)
switch (blend) {
case spine.MixBlend.setup:
bone.rotation = bone.data.rotation;
default:
return;
case spine.MixBlend.first:
r1 = bone.rotation;
r2 = bone.data.rotation;
}
var r2 = 0;
}
else {
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
else {
@ -1550,7 +1558,7 @@ var spine;
r2 = prevRotation + r2 * percent + bone.data.rotation;
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
}
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
}
var total = 0, diff = r2 - r1;
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
if (diff == 0) {

File diff suppressed because one or more lines are too long

View File

@ -1532,12 +1532,20 @@ var spine;
var rotateTimeline = timeline;
var frames = rotateTimeline.frames;
var bone = skeleton.bones[rotateTimeline.boneIndex];
var r1 = 0, r2 = 0;
if (time < frames[0]) {
if (blend == spine.MixBlend.setup)
switch (blend) {
case spine.MixBlend.setup:
bone.rotation = bone.data.rotation;
default:
return;
case spine.MixBlend.first:
r1 = bone.rotation;
r2 = bone.data.rotation;
}
var r2 = 0;
}
else {
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
else {
@ -1550,7 +1558,7 @@ var spine;
r2 = prevRotation + r2 * percent + bone.data.rotation;
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
}
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
}
var total = 0, diff = r2 - r1;
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
if (diff == 0) {

File diff suppressed because one or more lines are too long

View File

@ -1532,12 +1532,20 @@ var spine;
var rotateTimeline = timeline;
var frames = rotateTimeline.frames;
var bone = skeleton.bones[rotateTimeline.boneIndex];
var r1 = 0, r2 = 0;
if (time < frames[0]) {
if (blend == spine.MixBlend.setup)
switch (blend) {
case spine.MixBlend.setup:
bone.rotation = bone.data.rotation;
default:
return;
case spine.MixBlend.first:
r1 = bone.rotation;
r2 = bone.data.rotation;
}
var r2 = 0;
}
else {
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
else {
@ -1550,7 +1558,7 @@ var spine;
r2 = prevRotation + r2 * percent + bone.data.rotation;
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
}
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
}
var total = 0, diff = r2 - r1;
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
if (diff == 0) {

File diff suppressed because one or more lines are too long

View File

@ -1532,12 +1532,20 @@ var spine;
var rotateTimeline = timeline;
var frames = rotateTimeline.frames;
var bone = skeleton.bones[rotateTimeline.boneIndex];
var r1 = 0, r2 = 0;
if (time < frames[0]) {
if (blend == spine.MixBlend.setup)
switch (blend) {
case spine.MixBlend.setup:
bone.rotation = bone.data.rotation;
default:
return;
case spine.MixBlend.first:
r1 = bone.rotation;
r2 = bone.data.rotation;
}
var r2 = 0;
}
else {
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
else {
@ -1550,7 +1558,7 @@ var spine;
r2 = prevRotation + r2 * percent + bone.data.rotation;
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
}
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
}
var total = 0, diff = r2 - r1;
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
if (diff == 0) {

File diff suppressed because one or more lines are too long

View File

@ -288,12 +288,19 @@ module spine {
let rotateTimeline = timeline as RotateTimeline;
let frames = rotateTimeline.frames;
let bone = skeleton.bones[rotateTimeline.boneIndex];
let r1 = 0, r2 = 0;
if (time < frames[0]) {
if (blend == MixBlend.setup) bone.rotation = bone.data.rotation;
switch (blend) {
case MixBlend.setup:
bone.rotation = bone.data.rotation;
default:
return;
case MixBlend.first:
r1 = bone.rotation;
r2 = bone.data.rotation;
}
let r2 = 0;
} else {
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
if (time >= frames[frames.length - RotateTimeline.ENTRIES]) // Time is after last frame.
r2 = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION];
else {
@ -309,9 +316,9 @@ module spine {
r2 = prevRotation + r2 * percent + bone.data.rotation;
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
}
}
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
let r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
let total = 0, diff = r2 - r1;
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
if (diff == 0) {