[runtimes] Closes #971

This commit is contained in:
badlogic 2017-08-24 11:34:00 +02:00
parent 4abea9e4ad
commit eca798931b
25 changed files with 122 additions and 22 deletions

View File

@ -132,7 +132,8 @@ package spine.animation {
// Require mixTime > 0 to ensure the mixing from entry was applied at least once.
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
if (from.totalAlpha == 0) {
// Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
if (from.totalAlpha == 0 || to.mixDuration == 0) {
to.mixingFrom = from.mixingFrom;
to.interruptAlpha = from.interruptAlpha;
queue.end(from);

View File

@ -312,7 +312,8 @@ int /*boolean*/ _spAnimationState_updateMixingFrom (spAnimationState* self, spTr
/* Require mixTime > 0 to ensure the mixing from entry was applied at least once. */
if (to->mixTime > 0 && (to->mixTime >= to->mixDuration || to->timeScale == 0)) {
if (from->totalAlpha == 0) {
/* Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame). */
if (from->totalAlpha == 0 || to->mixDuration == 0) {
to->mixingFrom = from->mixingFrom;
to->interruptAlpha = from->interruptAlpha;
_spEventQueue_end(internal->queue, from);

View File

@ -346,7 +346,8 @@ function AnimationState:updateMixingFrom (to, delta)
-- Require mixTime > 0 to ensure the mixing from entry was applied at least once.
if (to.mixTime > 0 and (to.mixTime >= to.mixDuration or to.timeScale == 0)) then
if (from.totalAlpha == 0) then
-- Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
if (from.totalAlpha == 0 or to.mixDuration == 0) then
to.mixingFrom = from.mixingFrom
to.interruptAlpha = from.interruptAlpha
self.queue:_end(from)

View File

@ -585,6 +585,9 @@ declare module spine {
ChainScale = 2,
}
}
interface Math {
fround(n: number): number;
}
declare module spine {
class SharedAssetManager implements Disposable {
private pathPrefix;
@ -987,6 +990,7 @@ declare module spine {
static newFloatArray(size: number): ArrayLike<number>;
static newShortArray(size: number): ArrayLike<number>;
static toFloatArray(array: Array<number>): number[] | Float32Array;
static toSinglePrecision(value: number): number;
}
class DebugUtils {
static logBones(skeleton: Skeleton): void;

View File

@ -1216,7 +1216,7 @@ var spine;
return true;
var finished = this.updateMixingFrom(from, delta);
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
if (from.totalAlpha == 0) {
if (from.totalAlpha == 0 || to.mixDuration == 0) {
to.mixingFrom = from.mixingFrom;
to.interruptAlpha = from.interruptAlpha;
this.queue.end(from);
@ -2974,6 +2974,15 @@ var spine;
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
})(spine || (spine = {}));
(function () {
if (!Math.fround) {
Math.fround = (function (array) {
return function (x) {
return array[0] = x, array[0];
};
})(new Float32Array(1));
}
})();
var spine;
(function (spine) {
var Assets = (function () {
@ -4745,7 +4754,7 @@ var spine;
var eventData = skeletonData.findEvent(eventMap.name);
if (eventData == null)
throw new Error("Event not found: " + eventMap.name);
var event_5 = new spine.Event(eventMap.time, eventData);
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
@ -5879,6 +5888,9 @@ var spine;
Utils.toFloatArray = function (array) {
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
};
Utils.toSinglePrecision = function (value) {
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
};
return Utils;
}());
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";

File diff suppressed because one or more lines are too long

View File

@ -585,6 +585,9 @@ declare module spine {
ChainScale = 2,
}
}
interface Math {
fround(n: number): number;
}
declare module spine {
class SharedAssetManager implements Disposable {
private pathPrefix;
@ -987,6 +990,7 @@ declare module spine {
static newFloatArray(size: number): ArrayLike<number>;
static newShortArray(size: number): ArrayLike<number>;
static toFloatArray(array: Array<number>): number[] | Float32Array;
static toSinglePrecision(value: number): number;
}
class DebugUtils {
static logBones(skeleton: Skeleton): void;

View File

@ -1216,7 +1216,7 @@ var spine;
return true;
var finished = this.updateMixingFrom(from, delta);
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
if (from.totalAlpha == 0) {
if (from.totalAlpha == 0 || to.mixDuration == 0) {
to.mixingFrom = from.mixingFrom;
to.interruptAlpha = from.interruptAlpha;
this.queue.end(from);
@ -2974,6 +2974,15 @@ var spine;
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
})(spine || (spine = {}));
(function () {
if (!Math.fround) {
Math.fround = (function (array) {
return function (x) {
return array[0] = x, array[0];
};
})(new Float32Array(1));
}
})();
var spine;
(function (spine) {
var Assets = (function () {
@ -4745,7 +4754,7 @@ var spine;
var eventData = skeletonData.findEvent(eventMap.name);
if (eventData == null)
throw new Error("Event not found: " + eventMap.name);
var event_5 = new spine.Event(eventMap.time, eventData);
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
@ -5879,6 +5888,9 @@ var spine;
Utils.toFloatArray = function (array) {
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
};
Utils.toSinglePrecision = function (value) {
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
};
return Utils;
}());
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";

File diff suppressed because one or more lines are too long

View File

@ -585,6 +585,9 @@ declare module spine {
ChainScale = 2,
}
}
interface Math {
fround(n: number): number;
}
declare module spine {
class SharedAssetManager implements Disposable {
private pathPrefix;
@ -987,6 +990,7 @@ declare module spine {
static newFloatArray(size: number): ArrayLike<number>;
static newShortArray(size: number): ArrayLike<number>;
static toFloatArray(array: Array<number>): number[] | Float32Array;
static toSinglePrecision(value: number): number;
}
class DebugUtils {
static logBones(skeleton: Skeleton): void;

View File

@ -1216,7 +1216,7 @@ var spine;
return true;
var finished = this.updateMixingFrom(from, delta);
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
if (from.totalAlpha == 0) {
if (from.totalAlpha == 0 || to.mixDuration == 0) {
to.mixingFrom = from.mixingFrom;
to.interruptAlpha = from.interruptAlpha;
this.queue.end(from);
@ -2974,6 +2974,15 @@ var spine;
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
})(spine || (spine = {}));
(function () {
if (!Math.fround) {
Math.fround = (function (array) {
return function (x) {
return array[0] = x, array[0];
};
})(new Float32Array(1));
}
})();
var spine;
(function (spine) {
var Assets = (function () {
@ -4745,7 +4754,7 @@ var spine;
var eventData = skeletonData.findEvent(eventMap.name);
if (eventData == null)
throw new Error("Event not found: " + eventMap.name);
var event_5 = new spine.Event(eventMap.time, eventData);
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
@ -5879,6 +5888,9 @@ var spine;
Utils.toFloatArray = function (array) {
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
};
Utils.toSinglePrecision = function (value) {
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
};
return Utils;
}());
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";

File diff suppressed because one or more lines are too long

View File

@ -585,6 +585,9 @@ declare module spine {
ChainScale = 2,
}
}
interface Math {
fround(n: number): number;
}
declare module spine {
class SharedAssetManager implements Disposable {
private pathPrefix;
@ -987,6 +990,7 @@ declare module spine {
static newFloatArray(size: number): ArrayLike<number>;
static newShortArray(size: number): ArrayLike<number>;
static toFloatArray(array: Array<number>): number[] | Float32Array;
static toSinglePrecision(value: number): number;
}
class DebugUtils {
static logBones(skeleton: Skeleton): void;

View File

@ -1216,7 +1216,7 @@ var spine;
return true;
var finished = this.updateMixingFrom(from, delta);
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
if (from.totalAlpha == 0) {
if (from.totalAlpha == 0 || to.mixDuration == 0) {
to.mixingFrom = from.mixingFrom;
to.interruptAlpha = from.interruptAlpha;
this.queue.end(from);
@ -2974,6 +2974,15 @@ var spine;
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
})(spine || (spine = {}));
(function () {
if (!Math.fround) {
Math.fround = (function (array) {
return function (x) {
return array[0] = x, array[0];
};
})(new Float32Array(1));
}
})();
var spine;
(function (spine) {
var Assets = (function () {
@ -4745,7 +4754,7 @@ var spine;
var eventData = skeletonData.findEvent(eventMap.name);
if (eventData == null)
throw new Error("Event not found: " + eventMap.name);
var event_5 = new spine.Event(eventMap.time, eventData);
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
@ -5879,6 +5888,9 @@ var spine;
Utils.toFloatArray = function (array) {
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
};
Utils.toSinglePrecision = function (value) {
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
};
return Utils;
}());
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";

File diff suppressed because one or more lines are too long

View File

@ -585,6 +585,9 @@ declare module spine {
ChainScale = 2,
}
}
interface Math {
fround(n: number): number;
}
declare module spine {
class SharedAssetManager implements Disposable {
private pathPrefix;
@ -987,6 +990,7 @@ declare module spine {
static newFloatArray(size: number): ArrayLike<number>;
static newShortArray(size: number): ArrayLike<number>;
static toFloatArray(array: Array<number>): number[] | Float32Array;
static toSinglePrecision(value: number): number;
}
class DebugUtils {
static logBones(skeleton: Skeleton): void;

View File

@ -1216,7 +1216,7 @@ var spine;
return true;
var finished = this.updateMixingFrom(from, delta);
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
if (from.totalAlpha == 0) {
if (from.totalAlpha == 0 || to.mixDuration == 0) {
to.mixingFrom = from.mixingFrom;
to.interruptAlpha = from.interruptAlpha;
this.queue.end(from);
@ -2974,6 +2974,15 @@ var spine;
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
})(spine || (spine = {}));
(function () {
if (!Math.fround) {
Math.fround = (function (array) {
return function (x) {
return array[0] = x, array[0];
};
})(new Float32Array(1));
}
})();
var spine;
(function (spine) {
var Assets = (function () {
@ -4745,7 +4754,7 @@ var spine;
var eventData = skeletonData.findEvent(eventMap.name);
if (eventData == null)
throw new Error("Event not found: " + eventMap.name);
var event_5 = new spine.Event(eventMap.time, eventData);
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
@ -5879,6 +5888,9 @@ var spine;
Utils.toFloatArray = function (array) {
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
};
Utils.toSinglePrecision = function (value) {
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
};
return Utils;
}());
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";

File diff suppressed because one or more lines are too long

View File

@ -585,6 +585,9 @@ declare module spine {
ChainScale = 2,
}
}
interface Math {
fround(n: number): number;
}
declare module spine {
class SharedAssetManager implements Disposable {
private pathPrefix;
@ -987,6 +990,7 @@ declare module spine {
static newFloatArray(size: number): ArrayLike<number>;
static newShortArray(size: number): ArrayLike<number>;
static toFloatArray(array: Array<number>): number[] | Float32Array;
static toSinglePrecision(value: number): number;
}
class DebugUtils {
static logBones(skeleton: Skeleton): void;

View File

@ -1216,7 +1216,7 @@ var spine;
return true;
var finished = this.updateMixingFrom(from, delta);
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
if (from.totalAlpha == 0) {
if (from.totalAlpha == 0 || to.mixDuration == 0) {
to.mixingFrom = from.mixingFrom;
to.interruptAlpha = from.interruptAlpha;
this.queue.end(from);
@ -2974,6 +2974,15 @@ var spine;
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
})(spine || (spine = {}));
(function () {
if (!Math.fround) {
Math.fround = (function (array) {
return function (x) {
return array[0] = x, array[0];
};
})(new Float32Array(1));
}
})();
var spine;
(function (spine) {
var Assets = (function () {
@ -4745,7 +4754,7 @@ var spine;
var eventData = skeletonData.findEvent(eventMap.name);
if (eventData == null)
throw new Error("Event not found: " + eventMap.name);
var event_5 = new spine.Event(eventMap.time, eventData);
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
@ -5879,6 +5888,9 @@ var spine;
Utils.toFloatArray = function (array) {
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
};
Utils.toSinglePrecision = function (value) {
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
};
return Utils;
}());
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";

File diff suppressed because one or more lines are too long

View File

@ -116,7 +116,8 @@ module spine {
// Require mixTime > 0 to ensure the mixing from entry was applied at least once.
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
if (from.totalAlpha == 0) {
// Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
if (from.totalAlpha == 0 || to.mixDuration == 0) {
to.mixingFrom = from.mixingFrom;
to.interruptAlpha = from.interruptAlpha;
this.queue.end(from);