mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
[ts] Fix for NaN bounds
This is a temporary fix. Customer send reproduction sample. A slot has a mesh and corresponding deform. The number of vertices in the mesh is != the number of vertices in the deform, resulting in NaNs, which propagate to the bounds calculation of the web player. It is unclear how the mesh and deform can have a different number of vertices.
This commit is contained in:
parent
3fdbf9a061
commit
748a03c7d7
2
spine-ts/build/spine-all.d.ts
vendored
2
spine-ts/build/spine-all.d.ts
vendored
@ -1402,7 +1402,7 @@ declare module spine.webgl {
|
||||
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
|
||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear;
|
||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
update(useMipMaps: boolean): void;
|
||||
restore(): void;
|
||||
|
||||
@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -4101,11 +4103,17 @@ var spine;
|
||||
var mesh = attachment;
|
||||
verticesLength = mesh.worldVerticesLength;
|
||||
vertices = spine.Utils.setArraySize(temp, verticesLength, 0);
|
||||
if (i == 43) {
|
||||
console.log("WTF");
|
||||
}
|
||||
mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
|
||||
}
|
||||
if (vertices != null) {
|
||||
for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) {
|
||||
var x = vertices[ii], y = vertices[ii + 1];
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
console.log("WTF");
|
||||
}
|
||||
minX = Math.min(minX, x);
|
||||
minY = Math.min(minY, y);
|
||||
maxX = Math.max(maxX, x);
|
||||
@ -12450,10 +12458,15 @@ var spine;
|
||||
this.animationState.apply(this.skeleton);
|
||||
this.skeleton.updateWorldTransform();
|
||||
this.skeleton.getBounds(offset, size);
|
||||
minX = Math.min(offset.x, minX);
|
||||
maxX = Math.max(offset.x + size.x, maxX);
|
||||
minY = Math.min(offset.y, minY);
|
||||
maxY = Math.max(offset.y + size.y, maxY);
|
||||
if (!isNaN(offset.x) && !isNaN(offset.y) && !isNaN(size.x) && !isNaN(size.y)) {
|
||||
minX = Math.min(offset.x, minX);
|
||||
maxX = Math.max(offset.x + size.x, maxX);
|
||||
minY = Math.min(offset.y, minY);
|
||||
maxY = Math.max(offset.y + size.y, maxY);
|
||||
}
|
||||
else {
|
||||
console.log("Bounds of animation " + animationName + " are NaN");
|
||||
}
|
||||
}
|
||||
offset.x = minX;
|
||||
offset.y = minY;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -4101,11 +4103,17 @@ var spine;
|
||||
var mesh = attachment;
|
||||
verticesLength = mesh.worldVerticesLength;
|
||||
vertices = spine.Utils.setArraySize(temp, verticesLength, 0);
|
||||
if (i == 43) {
|
||||
console.log("WTF");
|
||||
}
|
||||
mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
|
||||
}
|
||||
if (vertices != null) {
|
||||
for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) {
|
||||
var x = vertices[ii], y = vertices[ii + 1];
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
console.log("WTF");
|
||||
}
|
||||
minX = Math.min(minX, x);
|
||||
minY = Math.min(minY, y);
|
||||
maxX = Math.max(maxX, x);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -4101,11 +4103,17 @@ var spine;
|
||||
var mesh = attachment;
|
||||
verticesLength = mesh.worldVerticesLength;
|
||||
vertices = spine.Utils.setArraySize(temp, verticesLength, 0);
|
||||
if (i == 43) {
|
||||
console.log("WTF");
|
||||
}
|
||||
mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
|
||||
}
|
||||
if (vertices != null) {
|
||||
for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) {
|
||||
var x = vertices[ii], y = vertices[ii + 1];
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
console.log("WTF");
|
||||
}
|
||||
minX = Math.min(minX, x);
|
||||
minY = Math.min(minY, y);
|
||||
maxX = Math.max(maxX, x);
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-player.d.ts
vendored
2
spine-ts/build/spine-player.d.ts
vendored
@ -1371,7 +1371,7 @@ declare module spine.webgl {
|
||||
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
|
||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear;
|
||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
update(useMipMaps: boolean): void;
|
||||
restore(): void;
|
||||
|
||||
@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -4101,11 +4103,17 @@ var spine;
|
||||
var mesh = attachment;
|
||||
verticesLength = mesh.worldVerticesLength;
|
||||
vertices = spine.Utils.setArraySize(temp, verticesLength, 0);
|
||||
if (i == 43) {
|
||||
console.log("WTF");
|
||||
}
|
||||
mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
|
||||
}
|
||||
if (vertices != null) {
|
||||
for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) {
|
||||
var x = vertices[ii], y = vertices[ii + 1];
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
console.log("WTF");
|
||||
}
|
||||
minX = Math.min(minX, x);
|
||||
minY = Math.min(minY, y);
|
||||
maxX = Math.max(maxX, x);
|
||||
@ -11761,10 +11769,15 @@ var spine;
|
||||
this.animationState.apply(this.skeleton);
|
||||
this.skeleton.updateWorldTransform();
|
||||
this.skeleton.getBounds(offset, size);
|
||||
minX = Math.min(offset.x, minX);
|
||||
maxX = Math.max(offset.x + size.x, maxX);
|
||||
minY = Math.min(offset.y, minY);
|
||||
maxY = Math.max(offset.y + size.y, maxY);
|
||||
if (!isNaN(offset.x) && !isNaN(offset.y) && !isNaN(size.x) && !isNaN(size.y)) {
|
||||
minX = Math.min(offset.x, minX);
|
||||
maxX = Math.max(offset.x + size.x, maxX);
|
||||
minY = Math.min(offset.y, minY);
|
||||
maxY = Math.max(offset.y + size.y, maxY);
|
||||
}
|
||||
else {
|
||||
console.log("Bounds of animation " + animationName + " are NaN");
|
||||
}
|
||||
}
|
||||
offset.x = minX;
|
||||
offset.y = minY;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -4101,11 +4103,17 @@ var spine;
|
||||
var mesh = attachment;
|
||||
verticesLength = mesh.worldVerticesLength;
|
||||
vertices = spine.Utils.setArraySize(temp, verticesLength, 0);
|
||||
if (i == 43) {
|
||||
console.log("WTF");
|
||||
}
|
||||
mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
|
||||
}
|
||||
if (vertices != null) {
|
||||
for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) {
|
||||
var x = vertices[ii], y = vertices[ii + 1];
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
console.log("WTF");
|
||||
}
|
||||
minX = Math.min(minX, x);
|
||||
minY = Math.min(minY, y);
|
||||
maxX = Math.max(maxX, x);
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-webgl.d.ts
vendored
2
spine-ts/build/spine-webgl.d.ts
vendored
@ -1371,7 +1371,7 @@ declare module spine.webgl {
|
||||
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
|
||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear;
|
||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
update(useMipMaps: boolean): void;
|
||||
restore(): void;
|
||||
|
||||
@ -6,6 +6,8 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -4101,11 +4103,17 @@ var spine;
|
||||
var mesh = attachment;
|
||||
verticesLength = mesh.worldVerticesLength;
|
||||
vertices = spine.Utils.setArraySize(temp, verticesLength, 0);
|
||||
if (i == 43) {
|
||||
console.log("WTF");
|
||||
}
|
||||
mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
|
||||
}
|
||||
if (vertices != null) {
|
||||
for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) {
|
||||
var x = vertices[ii], y = vertices[ii + 1];
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
console.log("WTF");
|
||||
}
|
||||
minX = Math.min(minX, x);
|
||||
minY = Math.min(minY, y);
|
||||
maxX = Math.max(maxX, x);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1216,10 +1216,14 @@ module spine {
|
||||
this.skeleton.updateWorldTransform();
|
||||
this.skeleton.getBounds(offset, size);
|
||||
|
||||
minX = Math.min(offset.x, minX);
|
||||
maxX = Math.max(offset.x + size.x, maxX);
|
||||
minY = Math.min(offset.y, minY);
|
||||
maxY = Math.max(offset.y + size.y, maxY);
|
||||
if (!isNaN(offset.x) && !isNaN(offset.y) && !isNaN(size.x) && !isNaN(size.y)) {
|
||||
minX = Math.min(offset.x, minX);
|
||||
maxX = Math.max(offset.x + size.x, maxX);
|
||||
minY = Math.min(offset.y, minY);
|
||||
maxY = Math.max(offset.y + size.y, maxY);
|
||||
} else {
|
||||
console.log("Bounds of animation " + animationName + " are NaN");
|
||||
}
|
||||
}
|
||||
|
||||
offset.x = minX;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user