mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[ts] Closes #713, the latest TS 2.0.3 version of ArrayLike makes both the length and indexer read-only. Added our own ArrayLike to utils, works as intended
This commit is contained in:
parent
726543960b
commit
0d85cfeaaf
262
spine-ts/build/spine-all.d.ts
vendored
262
spine-ts/build/spine-all.d.ts
vendored
@ -322,6 +322,135 @@ declare module spine {
|
||||
getMix(from: Animation, to: Animation): number;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum BlendMode {
|
||||
Normal = 0,
|
||||
@ -783,7 +912,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -815,134 +944,9 @@ declare module spine {
|
||||
private frameTime;
|
||||
update(): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
declare module spine.threejs {
|
||||
|
||||
@ -1339,6 +1339,423 @@ var spine;
|
||||
spine.AnimationStateData = AnimationStateData;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (BlendMode) {
|
||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||
@ -4344,423 +4761,6 @@ var spine;
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var threejs;
|
||||
(function (threejs) {
|
||||
@ -4978,8 +4978,6 @@ var spine;
|
||||
return THREE.LinearFilter;
|
||||
else if (filter === spine.TextureFilter.MipMap)
|
||||
return THREE.LinearMipMapLinearFilter;
|
||||
else if (filter === spine.TextureFilter.MipMapLinearLinear)
|
||||
return THREE.LinearMipMapLinearFilter;
|
||||
else if (filter === spine.TextureFilter.MipMapLinearNearest)
|
||||
return THREE.LinearMipMapNearestFilter;
|
||||
else if (filter === spine.TextureFilter.MipMapNearestLinear)
|
||||
|
||||
File diff suppressed because one or more lines are too long
262
spine-ts/build/spine-core.d.ts
vendored
262
spine-ts/build/spine-core.d.ts
vendored
@ -256,6 +256,135 @@ declare module spine {
|
||||
getErrors(): Map<string>;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum BlendMode {
|
||||
Normal = 0,
|
||||
@ -757,7 +886,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -789,133 +918,8 @@ declare module spine {
|
||||
private frameTime;
|
||||
update(): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1096,6 +1096,423 @@ var spine;
|
||||
spine.AssetManager = AssetManager;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (BlendMode) {
|
||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||
@ -4166,421 +4583,4 @@ var spine;
|
||||
}());
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
//# sourceMappingURL=spine-core.js.map
|
||||
File diff suppressed because one or more lines are too long
262
spine-ts/build/spine-threejs.d.ts
vendored
262
spine-ts/build/spine-threejs.d.ts
vendored
@ -256,6 +256,135 @@ declare module spine {
|
||||
getErrors(): Map<string>;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum BlendMode {
|
||||
Normal = 0,
|
||||
@ -757,7 +886,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -789,134 +918,9 @@ declare module spine {
|
||||
private frameTime;
|
||||
update(): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
declare module spine.threejs {
|
||||
|
||||
@ -1096,6 +1096,423 @@ var spine;
|
||||
spine.AssetManager = AssetManager;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (BlendMode) {
|
||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||
@ -4167,423 +4584,6 @@ var spine;
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var threejs;
|
||||
(function (threejs) {
|
||||
@ -4801,8 +4801,6 @@ var spine;
|
||||
return THREE.LinearFilter;
|
||||
else if (filter === spine.TextureFilter.MipMap)
|
||||
return THREE.LinearMipMapLinearFilter;
|
||||
else if (filter === spine.TextureFilter.MipMapLinearLinear)
|
||||
return THREE.LinearMipMapLinearFilter;
|
||||
else if (filter === spine.TextureFilter.MipMapLinearNearest)
|
||||
return THREE.LinearMipMapNearestFilter;
|
||||
else if (filter === spine.TextureFilter.MipMapNearestLinear)
|
||||
|
||||
File diff suppressed because one or more lines are too long
262
spine-ts/build/spine-webgl.d.ts
vendored
262
spine-ts/build/spine-webgl.d.ts
vendored
@ -256,6 +256,135 @@ declare module spine {
|
||||
getErrors(): Map<string>;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum BlendMode {
|
||||
Normal = 0,
|
||||
@ -757,7 +886,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -789,134 +918,9 @@ declare module spine {
|
||||
private frameTime;
|
||||
update(): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
declare module spine.webgl {
|
||||
|
||||
@ -1096,6 +1096,423 @@ var spine;
|
||||
spine.AssetManager = AssetManager;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (BlendMode) {
|
||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||
@ -4167,423 +4584,6 @@ var spine;
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var webgl;
|
||||
(function (webgl) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
262
spine-ts/build/spine-widget.d.ts
vendored
262
spine-ts/build/spine-widget.d.ts
vendored
@ -256,6 +256,135 @@ declare module spine {
|
||||
getErrors(): Map<string>;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum BlendMode {
|
||||
Normal = 0,
|
||||
@ -757,7 +886,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -789,134 +918,9 @@ declare module spine {
|
||||
private frameTime;
|
||||
update(): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
bones: Array<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
worldVerticesLength: number;
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
interface AttachmentLoader {
|
||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
enum AttachmentType {
|
||||
Region = 0,
|
||||
BoundingBox = 1,
|
||||
Mesh = 2,
|
||||
LinkedMesh = 3,
|
||||
Path = 4,
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class MeshAttachment extends VertexAttachment {
|
||||
region: TextureRegion;
|
||||
path: string;
|
||||
regionUVs: ArrayLike<number>;
|
||||
worldVertices: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
hullLength: number;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
updateUVs(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class PathAttachment extends VertexAttachment {
|
||||
lengths: Array<number>;
|
||||
closed: boolean;
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class RegionAttachment extends Attachment {
|
||||
static OX1: number;
|
||||
static OY1: number;
|
||||
static OX2: number;
|
||||
static OY2: number;
|
||||
static OX3: number;
|
||||
static OY3: number;
|
||||
static OX4: number;
|
||||
static OY4: number;
|
||||
static X1: number;
|
||||
static Y1: number;
|
||||
static C1R: number;
|
||||
static C1G: number;
|
||||
static C1B: number;
|
||||
static C1A: number;
|
||||
static U1: number;
|
||||
static V1: number;
|
||||
static X2: number;
|
||||
static Y2: number;
|
||||
static C2R: number;
|
||||
static C2G: number;
|
||||
static C2B: number;
|
||||
static C2A: number;
|
||||
static U2: number;
|
||||
static V2: number;
|
||||
static X3: number;
|
||||
static Y3: number;
|
||||
static C3R: number;
|
||||
static C3G: number;
|
||||
static C3B: number;
|
||||
static C3A: number;
|
||||
static U3: number;
|
||||
static V3: number;
|
||||
static X4: number;
|
||||
static Y4: number;
|
||||
static C4R: number;
|
||||
static C4G: number;
|
||||
static C4B: number;
|
||||
static C4A: number;
|
||||
static U4: number;
|
||||
static V4: number;
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
path: string;
|
||||
rendererObject: any;
|
||||
region: TextureRegion;
|
||||
offset: ArrayLike<number>;
|
||||
vertices: ArrayLike<number>;
|
||||
tempColor: Color;
|
||||
constructor(name: string);
|
||||
setRegion(region: TextureRegion): void;
|
||||
updateOffset(): void;
|
||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
declare module spine.webgl {
|
||||
|
||||
@ -1096,6 +1096,423 @@ var spine;
|
||||
spine.AssetManager = AssetManager;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (BlendMode) {
|
||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||
@ -4167,423 +4584,6 @@ var spine;
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var webgl;
|
||||
(function (webgl) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -261,4 +261,9 @@ module spine {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,8 +56,7 @@ module spine.threejs {
|
||||
|
||||
static toThreeJsTextureFilter(filter: TextureFilter) {
|
||||
if (filter === TextureFilter.Linear) return THREE.LinearFilter;
|
||||
else if (filter === TextureFilter.MipMap) return THREE.LinearMipMapLinearFilter;
|
||||
else if (filter === TextureFilter.MipMapLinearLinear) return THREE.LinearMipMapLinearFilter;
|
||||
else if (filter === TextureFilter.MipMap) return THREE.LinearMipMapLinearFilter; // also includes TextureFilter.MipMapLinearLinear
|
||||
else if (filter === TextureFilter.MipMapLinearNearest) return THREE.LinearMipMapNearestFilter;
|
||||
else if (filter === TextureFilter.MipMapNearestLinear) return THREE.NearestMipMapLinearFilter;
|
||||
else if (filter === TextureFilter.MipMapNearestNearest) return THREE.NearestMipMapNearestFilter;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user