mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[ts] Ported last minute AnimationState changes
This commit is contained in:
parent
a2b9e03d4f
commit
0b7a3339ac
263
spine-ts/build/spine-all.d.ts
vendored
263
spine-ts/build/spine-all.d.ts
vendored
@ -304,7 +304,7 @@ declare module spine {
|
||||
update(delta: number): void;
|
||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
||||
apply(skeleton: Skeleton): void;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton, alpha: number): number;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
@ -360,6 +360,7 @@ declare module spine {
|
||||
getAnimationTime(): number;
|
||||
setAnimationLast(animationLast: number): void;
|
||||
isComplete(): boolean;
|
||||
resetRotationDirections(): void;
|
||||
}
|
||||
class EventQueue {
|
||||
objects: Array<any>;
|
||||
@ -421,6 +422,135 @@ declare module spine {
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
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,
|
||||
@ -906,7 +1036,7 @@ declare module spine {
|
||||
static ensureArrayCapacity<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;
|
||||
@ -943,135 +1073,6 @@ declare module spine {
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
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.threejs {
|
||||
class AssetManager extends spine.AssetManager {
|
||||
constructor(pathPrefix?: string);
|
||||
|
||||
@ -1323,7 +1323,7 @@ var spine;
|
||||
continue;
|
||||
var mix = current.alpha;
|
||||
if (current.mixingFrom != null)
|
||||
mix = this.applyMixingFrom(current, skeleton, mix);
|
||||
mix *= this.applyMixingFrom(current, skeleton);
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
@ -1352,10 +1352,10 @@ var spine;
|
||||
}
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton, alpha) {
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton) {
|
||||
var from = entry.mixingFrom;
|
||||
if (from.mixingFrom != null)
|
||||
this.applyMixingFrom(from, skeleton, alpha);
|
||||
this.applyMixingFrom(from, skeleton);
|
||||
var mix = 0;
|
||||
if (entry.mixDuration == 0)
|
||||
mix = 1;
|
||||
@ -1363,15 +1363,14 @@ var spine;
|
||||
mix = entry.mixTime / entry.mixDuration;
|
||||
if (mix > 1)
|
||||
mix = 1;
|
||||
mix *= alpha;
|
||||
}
|
||||
var events = mix < from.eventThreshold ? this.events : null;
|
||||
var attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
||||
var animationLast = from.animationLast, animationTime = from.getAnimationTime();
|
||||
alpha = from.alpha * (1 - mix);
|
||||
var timelineCount = from.animation.timelines.length;
|
||||
var timelines = from.animation.timelines;
|
||||
var timelinesFirst = from.timelinesFirst;
|
||||
var alpha = from.alpha * entry.mixAlpha * (1 - mix);
|
||||
var firstFrame = from.timelinesRotation.length == 0;
|
||||
if (firstFrame)
|
||||
spine.Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
|
||||
@ -1516,9 +1515,8 @@ var spine;
|
||||
this.queue.interrupt(from);
|
||||
current.mixingFrom = from;
|
||||
current.mixTime = 0;
|
||||
from.timelinesRotation.length = 0;
|
||||
if (from.mixingFrom != null)
|
||||
from.alpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
}
|
||||
this.queue.start(current);
|
||||
};
|
||||
@ -1630,6 +1628,7 @@ var spine;
|
||||
entry.trackEnd = loop ? Number.MAX_VALUE : entry.animationEnd;
|
||||
entry.timeScale = 1;
|
||||
entry.alpha = 1;
|
||||
entry.mixAlpha = 1;
|
||||
entry.mixTime = 0;
|
||||
entry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);
|
||||
return entry;
|
||||
@ -1743,6 +1742,9 @@ var spine;
|
||||
TrackEntry.prototype.isComplete = function () {
|
||||
return this.trackTime >= this.animationEnd - this.animationStart;
|
||||
};
|
||||
TrackEntry.prototype.resetRotationDirections = function () {
|
||||
this.timelinesRotation.length = 0;
|
||||
};
|
||||
return TrackEntry;
|
||||
}());
|
||||
spine.TrackEntry = TrackEntry;
|
||||
@ -1942,6 +1944,421 @@ var spine;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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";
|
||||
@ -3464,8 +3881,15 @@ var spine;
|
||||
boundingBox.computeWorldVertices(slot, polygon);
|
||||
}
|
||||
}
|
||||
if (updateAabb)
|
||||
if (updateAabb) {
|
||||
this.aabbCompute();
|
||||
}
|
||||
else {
|
||||
this.minX = Number.POSITIVE_INFINITY;
|
||||
this.minY = Number.POSITIVE_INFINITY;
|
||||
this.maxX = Number.NEGATIVE_INFINITY;
|
||||
this.maxY = Number.NEGATIVE_INFINITY;
|
||||
}
|
||||
};
|
||||
SkeletonBounds.prototype.aabbCompute = function () {
|
||||
var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
||||
@ -3897,7 +4321,7 @@ var spine;
|
||||
var data = new spine.EventData(eventName);
|
||||
data.intValue = this.getValue(eventMap, "int", 0);
|
||||
data.floatValue = this.getValue(eventMap, "float", 0);
|
||||
data.stringValue = this.getValue(eventMap, "string", null);
|
||||
data.stringValue = this.getValue(eventMap, "string", "");
|
||||
skeletonData.events.push(data);
|
||||
}
|
||||
}
|
||||
@ -5035,421 +5459,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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
263
spine-ts/build/spine-canvas.d.ts
vendored
263
spine-ts/build/spine-canvas.d.ts
vendored
@ -304,7 +304,7 @@ declare module spine {
|
||||
update(delta: number): void;
|
||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
||||
apply(skeleton: Skeleton): void;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton, alpha: number): number;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
@ -360,6 +360,7 @@ declare module spine {
|
||||
getAnimationTime(): number;
|
||||
setAnimationLast(animationLast: number): void;
|
||||
isComplete(): boolean;
|
||||
resetRotationDirections(): void;
|
||||
}
|
||||
class EventQueue {
|
||||
objects: Array<any>;
|
||||
@ -421,6 +422,135 @@ declare module spine {
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
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,
|
||||
@ -906,7 +1036,7 @@ declare module spine {
|
||||
static ensureArrayCapacity<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;
|
||||
@ -943,132 +1073,3 @@ declare module spine {
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
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>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1323,7 +1323,7 @@ var spine;
|
||||
continue;
|
||||
var mix = current.alpha;
|
||||
if (current.mixingFrom != null)
|
||||
mix = this.applyMixingFrom(current, skeleton, mix);
|
||||
mix *= this.applyMixingFrom(current, skeleton);
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
@ -1352,10 +1352,10 @@ var spine;
|
||||
}
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton, alpha) {
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton) {
|
||||
var from = entry.mixingFrom;
|
||||
if (from.mixingFrom != null)
|
||||
this.applyMixingFrom(from, skeleton, alpha);
|
||||
this.applyMixingFrom(from, skeleton);
|
||||
var mix = 0;
|
||||
if (entry.mixDuration == 0)
|
||||
mix = 1;
|
||||
@ -1363,15 +1363,14 @@ var spine;
|
||||
mix = entry.mixTime / entry.mixDuration;
|
||||
if (mix > 1)
|
||||
mix = 1;
|
||||
mix *= alpha;
|
||||
}
|
||||
var events = mix < from.eventThreshold ? this.events : null;
|
||||
var attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
||||
var animationLast = from.animationLast, animationTime = from.getAnimationTime();
|
||||
alpha = from.alpha * (1 - mix);
|
||||
var timelineCount = from.animation.timelines.length;
|
||||
var timelines = from.animation.timelines;
|
||||
var timelinesFirst = from.timelinesFirst;
|
||||
var alpha = from.alpha * entry.mixAlpha * (1 - mix);
|
||||
var firstFrame = from.timelinesRotation.length == 0;
|
||||
if (firstFrame)
|
||||
spine.Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
|
||||
@ -1516,9 +1515,8 @@ var spine;
|
||||
this.queue.interrupt(from);
|
||||
current.mixingFrom = from;
|
||||
current.mixTime = 0;
|
||||
from.timelinesRotation.length = 0;
|
||||
if (from.mixingFrom != null)
|
||||
from.alpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
}
|
||||
this.queue.start(current);
|
||||
};
|
||||
@ -1630,6 +1628,7 @@ var spine;
|
||||
entry.trackEnd = loop ? Number.MAX_VALUE : entry.animationEnd;
|
||||
entry.timeScale = 1;
|
||||
entry.alpha = 1;
|
||||
entry.mixAlpha = 1;
|
||||
entry.mixTime = 0;
|
||||
entry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);
|
||||
return entry;
|
||||
@ -1743,6 +1742,9 @@ var spine;
|
||||
TrackEntry.prototype.isComplete = function () {
|
||||
return this.trackTime >= this.animationEnd - this.animationStart;
|
||||
};
|
||||
TrackEntry.prototype.resetRotationDirections = function () {
|
||||
this.timelinesRotation.length = 0;
|
||||
};
|
||||
return TrackEntry;
|
||||
}());
|
||||
spine.TrackEntry = TrackEntry;
|
||||
@ -1942,6 +1944,421 @@ var spine;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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";
|
||||
@ -3464,8 +3881,15 @@ var spine;
|
||||
boundingBox.computeWorldVertices(slot, polygon);
|
||||
}
|
||||
}
|
||||
if (updateAabb)
|
||||
if (updateAabb) {
|
||||
this.aabbCompute();
|
||||
}
|
||||
else {
|
||||
this.minX = Number.POSITIVE_INFINITY;
|
||||
this.minY = Number.POSITIVE_INFINITY;
|
||||
this.maxX = Number.NEGATIVE_INFINITY;
|
||||
this.maxY = Number.NEGATIVE_INFINITY;
|
||||
}
|
||||
};
|
||||
SkeletonBounds.prototype.aabbCompute = function () {
|
||||
var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
||||
@ -3897,7 +4321,7 @@ var spine;
|
||||
var data = new spine.EventData(eventName);
|
||||
data.intValue = this.getValue(eventMap, "int", 0);
|
||||
data.floatValue = this.getValue(eventMap, "float", 0);
|
||||
data.stringValue = this.getValue(eventMap, "string", null);
|
||||
data.stringValue = this.getValue(eventMap, "string", "");
|
||||
skeletonData.events.push(data);
|
||||
}
|
||||
}
|
||||
@ -5034,419 +5458,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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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-canvas.js.map
|
||||
File diff suppressed because one or more lines are too long
263
spine-ts/build/spine-core.d.ts
vendored
263
spine-ts/build/spine-core.d.ts
vendored
@ -216,7 +216,7 @@ declare module spine {
|
||||
update(delta: number): void;
|
||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
||||
apply(skeleton: Skeleton): void;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton, alpha: number): number;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
@ -272,6 +272,7 @@ declare module spine {
|
||||
getAnimationTime(): number;
|
||||
setAnimationLast(animationLast: number): void;
|
||||
isComplete(): boolean;
|
||||
resetRotationDirections(): void;
|
||||
}
|
||||
class EventQueue {
|
||||
objects: Array<any>;
|
||||
@ -355,6 +356,135 @@ declare module spine {
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
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,
|
||||
@ -880,7 +1010,7 @@ declare module spine {
|
||||
static ensureArrayCapacity<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;
|
||||
@ -917,132 +1047,3 @@ declare module spine {
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
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>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -976,7 +976,7 @@ var spine;
|
||||
continue;
|
||||
var mix = current.alpha;
|
||||
if (current.mixingFrom != null)
|
||||
mix = this.applyMixingFrom(current, skeleton, mix);
|
||||
mix *= this.applyMixingFrom(current, skeleton);
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
@ -1005,10 +1005,10 @@ var spine;
|
||||
}
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton, alpha) {
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton) {
|
||||
var from = entry.mixingFrom;
|
||||
if (from.mixingFrom != null)
|
||||
this.applyMixingFrom(from, skeleton, alpha);
|
||||
this.applyMixingFrom(from, skeleton);
|
||||
var mix = 0;
|
||||
if (entry.mixDuration == 0)
|
||||
mix = 1;
|
||||
@ -1016,15 +1016,14 @@ var spine;
|
||||
mix = entry.mixTime / entry.mixDuration;
|
||||
if (mix > 1)
|
||||
mix = 1;
|
||||
mix *= alpha;
|
||||
}
|
||||
var events = mix < from.eventThreshold ? this.events : null;
|
||||
var attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
||||
var animationLast = from.animationLast, animationTime = from.getAnimationTime();
|
||||
alpha = from.alpha * (1 - mix);
|
||||
var timelineCount = from.animation.timelines.length;
|
||||
var timelines = from.animation.timelines;
|
||||
var timelinesFirst = from.timelinesFirst;
|
||||
var alpha = from.alpha * entry.mixAlpha * (1 - mix);
|
||||
var firstFrame = from.timelinesRotation.length == 0;
|
||||
if (firstFrame)
|
||||
spine.Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
|
||||
@ -1169,9 +1168,8 @@ var spine;
|
||||
this.queue.interrupt(from);
|
||||
current.mixingFrom = from;
|
||||
current.mixTime = 0;
|
||||
from.timelinesRotation.length = 0;
|
||||
if (from.mixingFrom != null)
|
||||
from.alpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
}
|
||||
this.queue.start(current);
|
||||
};
|
||||
@ -1283,6 +1281,7 @@ var spine;
|
||||
entry.trackEnd = loop ? Number.MAX_VALUE : entry.animationEnd;
|
||||
entry.timeScale = 1;
|
||||
entry.alpha = 1;
|
||||
entry.mixAlpha = 1;
|
||||
entry.mixTime = 0;
|
||||
entry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);
|
||||
return entry;
|
||||
@ -1396,6 +1395,9 @@ var spine;
|
||||
TrackEntry.prototype.isComplete = function () {
|
||||
return this.trackTime >= this.animationEnd - this.animationStart;
|
||||
};
|
||||
TrackEntry.prototype.resetRotationDirections = function () {
|
||||
this.timelinesRotation.length = 0;
|
||||
};
|
||||
return TrackEntry;
|
||||
}());
|
||||
spine.TrackEntry = TrackEntry;
|
||||
@ -1699,6 +1701,421 @@ var spine;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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";
|
||||
@ -3221,8 +3638,15 @@ var spine;
|
||||
boundingBox.computeWorldVertices(slot, polygon);
|
||||
}
|
||||
}
|
||||
if (updateAabb)
|
||||
if (updateAabb) {
|
||||
this.aabbCompute();
|
||||
}
|
||||
else {
|
||||
this.minX = Number.POSITIVE_INFINITY;
|
||||
this.minY = Number.POSITIVE_INFINITY;
|
||||
this.maxX = Number.NEGATIVE_INFINITY;
|
||||
this.maxY = Number.NEGATIVE_INFINITY;
|
||||
}
|
||||
};
|
||||
SkeletonBounds.prototype.aabbCompute = function () {
|
||||
var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
||||
@ -3654,7 +4078,7 @@ var spine;
|
||||
var data = new spine.EventData(eventName);
|
||||
data.intValue = this.getValue(eventMap, "int", 0);
|
||||
data.floatValue = this.getValue(eventMap, "float", 0);
|
||||
data.stringValue = this.getValue(eventMap, "string", null);
|
||||
data.stringValue = this.getValue(eventMap, "string", "");
|
||||
skeletonData.events.push(data);
|
||||
}
|
||||
}
|
||||
@ -4857,419 +5281,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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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
263
spine-ts/build/spine-threejs.d.ts
vendored
263
spine-ts/build/spine-threejs.d.ts
vendored
@ -216,7 +216,7 @@ declare module spine {
|
||||
update(delta: number): void;
|
||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
||||
apply(skeleton: Skeleton): void;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton, alpha: number): number;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
@ -272,6 +272,7 @@ declare module spine {
|
||||
getAnimationTime(): number;
|
||||
setAnimationLast(animationLast: number): void;
|
||||
isComplete(): boolean;
|
||||
resetRotationDirections(): void;
|
||||
}
|
||||
class EventQueue {
|
||||
objects: Array<any>;
|
||||
@ -355,6 +356,135 @@ declare module spine {
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
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,
|
||||
@ -880,7 +1010,7 @@ declare module spine {
|
||||
static ensureArrayCapacity<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;
|
||||
@ -917,135 +1047,6 @@ declare module spine {
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
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.threejs {
|
||||
class AssetManager extends spine.AssetManager {
|
||||
constructor(pathPrefix?: string);
|
||||
|
||||
@ -976,7 +976,7 @@ var spine;
|
||||
continue;
|
||||
var mix = current.alpha;
|
||||
if (current.mixingFrom != null)
|
||||
mix = this.applyMixingFrom(current, skeleton, mix);
|
||||
mix *= this.applyMixingFrom(current, skeleton);
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
@ -1005,10 +1005,10 @@ var spine;
|
||||
}
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton, alpha) {
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton) {
|
||||
var from = entry.mixingFrom;
|
||||
if (from.mixingFrom != null)
|
||||
this.applyMixingFrom(from, skeleton, alpha);
|
||||
this.applyMixingFrom(from, skeleton);
|
||||
var mix = 0;
|
||||
if (entry.mixDuration == 0)
|
||||
mix = 1;
|
||||
@ -1016,15 +1016,14 @@ var spine;
|
||||
mix = entry.mixTime / entry.mixDuration;
|
||||
if (mix > 1)
|
||||
mix = 1;
|
||||
mix *= alpha;
|
||||
}
|
||||
var events = mix < from.eventThreshold ? this.events : null;
|
||||
var attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
||||
var animationLast = from.animationLast, animationTime = from.getAnimationTime();
|
||||
alpha = from.alpha * (1 - mix);
|
||||
var timelineCount = from.animation.timelines.length;
|
||||
var timelines = from.animation.timelines;
|
||||
var timelinesFirst = from.timelinesFirst;
|
||||
var alpha = from.alpha * entry.mixAlpha * (1 - mix);
|
||||
var firstFrame = from.timelinesRotation.length == 0;
|
||||
if (firstFrame)
|
||||
spine.Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
|
||||
@ -1169,9 +1168,8 @@ var spine;
|
||||
this.queue.interrupt(from);
|
||||
current.mixingFrom = from;
|
||||
current.mixTime = 0;
|
||||
from.timelinesRotation.length = 0;
|
||||
if (from.mixingFrom != null)
|
||||
from.alpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
}
|
||||
this.queue.start(current);
|
||||
};
|
||||
@ -1283,6 +1281,7 @@ var spine;
|
||||
entry.trackEnd = loop ? Number.MAX_VALUE : entry.animationEnd;
|
||||
entry.timeScale = 1;
|
||||
entry.alpha = 1;
|
||||
entry.mixAlpha = 1;
|
||||
entry.mixTime = 0;
|
||||
entry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);
|
||||
return entry;
|
||||
@ -1396,6 +1395,9 @@ var spine;
|
||||
TrackEntry.prototype.isComplete = function () {
|
||||
return this.trackTime >= this.animationEnd - this.animationStart;
|
||||
};
|
||||
TrackEntry.prototype.resetRotationDirections = function () {
|
||||
this.timelinesRotation.length = 0;
|
||||
};
|
||||
return TrackEntry;
|
||||
}());
|
||||
spine.TrackEntry = TrackEntry;
|
||||
@ -1699,6 +1701,421 @@ var spine;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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";
|
||||
@ -3221,8 +3638,15 @@ var spine;
|
||||
boundingBox.computeWorldVertices(slot, polygon);
|
||||
}
|
||||
}
|
||||
if (updateAabb)
|
||||
if (updateAabb) {
|
||||
this.aabbCompute();
|
||||
}
|
||||
else {
|
||||
this.minX = Number.POSITIVE_INFINITY;
|
||||
this.minY = Number.POSITIVE_INFINITY;
|
||||
this.maxX = Number.NEGATIVE_INFINITY;
|
||||
this.maxY = Number.NEGATIVE_INFINITY;
|
||||
}
|
||||
};
|
||||
SkeletonBounds.prototype.aabbCompute = function () {
|
||||
var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
||||
@ -3654,7 +4078,7 @@ var spine;
|
||||
var data = new spine.EventData(eventName);
|
||||
data.intValue = this.getValue(eventMap, "int", 0);
|
||||
data.floatValue = this.getValue(eventMap, "float", 0);
|
||||
data.stringValue = this.getValue(eventMap, "string", null);
|
||||
data.stringValue = this.getValue(eventMap, "string", "");
|
||||
skeletonData.events.push(data);
|
||||
}
|
||||
}
|
||||
@ -4858,421 +5282,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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
263
spine-ts/build/spine-webgl.d.ts
vendored
263
spine-ts/build/spine-webgl.d.ts
vendored
@ -216,7 +216,7 @@ declare module spine {
|
||||
update(delta: number): void;
|
||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
||||
apply(skeleton: Skeleton): void;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton, alpha: number): number;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
@ -272,6 +272,7 @@ declare module spine {
|
||||
getAnimationTime(): number;
|
||||
setAnimationLast(animationLast: number): void;
|
||||
isComplete(): boolean;
|
||||
resetRotationDirections(): void;
|
||||
}
|
||||
class EventQueue {
|
||||
objects: Array<any>;
|
||||
@ -355,6 +356,135 @@ declare module spine {
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
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,
|
||||
@ -880,7 +1010,7 @@ declare module spine {
|
||||
static ensureArrayCapacity<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;
|
||||
@ -917,135 +1047,6 @@ declare module spine {
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
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.webgl {
|
||||
class AssetManager extends spine.AssetManager {
|
||||
constructor(gl: WebGLRenderingContext, pathPrefix?: string);
|
||||
|
||||
@ -976,7 +976,7 @@ var spine;
|
||||
continue;
|
||||
var mix = current.alpha;
|
||||
if (current.mixingFrom != null)
|
||||
mix = this.applyMixingFrom(current, skeleton, mix);
|
||||
mix *= this.applyMixingFrom(current, skeleton);
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
@ -1005,10 +1005,10 @@ var spine;
|
||||
}
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton, alpha) {
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton) {
|
||||
var from = entry.mixingFrom;
|
||||
if (from.mixingFrom != null)
|
||||
this.applyMixingFrom(from, skeleton, alpha);
|
||||
this.applyMixingFrom(from, skeleton);
|
||||
var mix = 0;
|
||||
if (entry.mixDuration == 0)
|
||||
mix = 1;
|
||||
@ -1016,15 +1016,14 @@ var spine;
|
||||
mix = entry.mixTime / entry.mixDuration;
|
||||
if (mix > 1)
|
||||
mix = 1;
|
||||
mix *= alpha;
|
||||
}
|
||||
var events = mix < from.eventThreshold ? this.events : null;
|
||||
var attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
||||
var animationLast = from.animationLast, animationTime = from.getAnimationTime();
|
||||
alpha = from.alpha * (1 - mix);
|
||||
var timelineCount = from.animation.timelines.length;
|
||||
var timelines = from.animation.timelines;
|
||||
var timelinesFirst = from.timelinesFirst;
|
||||
var alpha = from.alpha * entry.mixAlpha * (1 - mix);
|
||||
var firstFrame = from.timelinesRotation.length == 0;
|
||||
if (firstFrame)
|
||||
spine.Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
|
||||
@ -1169,9 +1168,8 @@ var spine;
|
||||
this.queue.interrupt(from);
|
||||
current.mixingFrom = from;
|
||||
current.mixTime = 0;
|
||||
from.timelinesRotation.length = 0;
|
||||
if (from.mixingFrom != null)
|
||||
from.alpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
}
|
||||
this.queue.start(current);
|
||||
};
|
||||
@ -1283,6 +1281,7 @@ var spine;
|
||||
entry.trackEnd = loop ? Number.MAX_VALUE : entry.animationEnd;
|
||||
entry.timeScale = 1;
|
||||
entry.alpha = 1;
|
||||
entry.mixAlpha = 1;
|
||||
entry.mixTime = 0;
|
||||
entry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);
|
||||
return entry;
|
||||
@ -1396,6 +1395,9 @@ var spine;
|
||||
TrackEntry.prototype.isComplete = function () {
|
||||
return this.trackTime >= this.animationEnd - this.animationStart;
|
||||
};
|
||||
TrackEntry.prototype.resetRotationDirections = function () {
|
||||
this.timelinesRotation.length = 0;
|
||||
};
|
||||
return TrackEntry;
|
||||
}());
|
||||
spine.TrackEntry = TrackEntry;
|
||||
@ -1699,6 +1701,421 @@ var spine;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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";
|
||||
@ -3221,8 +3638,15 @@ var spine;
|
||||
boundingBox.computeWorldVertices(slot, polygon);
|
||||
}
|
||||
}
|
||||
if (updateAabb)
|
||||
if (updateAabb) {
|
||||
this.aabbCompute();
|
||||
}
|
||||
else {
|
||||
this.minX = Number.POSITIVE_INFINITY;
|
||||
this.minY = Number.POSITIVE_INFINITY;
|
||||
this.maxX = Number.NEGATIVE_INFINITY;
|
||||
this.maxY = Number.NEGATIVE_INFINITY;
|
||||
}
|
||||
};
|
||||
SkeletonBounds.prototype.aabbCompute = function () {
|
||||
var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
||||
@ -3654,7 +4078,7 @@ var spine;
|
||||
var data = new spine.EventData(eventName);
|
||||
data.intValue = this.getValue(eventMap, "int", 0);
|
||||
data.floatValue = this.getValue(eventMap, "float", 0);
|
||||
data.stringValue = this.getValue(eventMap, "string", null);
|
||||
data.stringValue = this.getValue(eventMap, "string", "");
|
||||
skeletonData.events.push(data);
|
||||
}
|
||||
}
|
||||
@ -4858,421 +5282,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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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
263
spine-ts/build/spine-widget.d.ts
vendored
263
spine-ts/build/spine-widget.d.ts
vendored
@ -216,7 +216,7 @@ declare module spine {
|
||||
update(delta: number): void;
|
||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
||||
apply(skeleton: Skeleton): void;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton, alpha: number): number;
|
||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
@ -272,6 +272,7 @@ declare module spine {
|
||||
getAnimationTime(): number;
|
||||
setAnimationLast(animationLast: number): void;
|
||||
isComplete(): boolean;
|
||||
resetRotationDirections(): void;
|
||||
}
|
||||
class EventQueue {
|
||||
objects: Array<any>;
|
||||
@ -355,6 +356,135 @@ declare module spine {
|
||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||
}
|
||||
}
|
||||
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,
|
||||
@ -880,7 +1010,7 @@ declare module spine {
|
||||
static ensureArrayCapacity<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;
|
||||
@ -917,135 +1047,6 @@ declare module spine {
|
||||
[n: number]: T;
|
||||
}
|
||||
}
|
||||
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.webgl {
|
||||
class AssetManager extends spine.AssetManager {
|
||||
constructor(gl: WebGLRenderingContext, pathPrefix?: string);
|
||||
|
||||
@ -976,7 +976,7 @@ var spine;
|
||||
continue;
|
||||
var mix = current.alpha;
|
||||
if (current.mixingFrom != null)
|
||||
mix = this.applyMixingFrom(current, skeleton, mix);
|
||||
mix *= this.applyMixingFrom(current, skeleton);
|
||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
var timelineCount = current.animation.timelines.length;
|
||||
var timelines = current.animation.timelines;
|
||||
@ -1005,10 +1005,10 @@ var spine;
|
||||
}
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton, alpha) {
|
||||
AnimationState.prototype.applyMixingFrom = function (entry, skeleton) {
|
||||
var from = entry.mixingFrom;
|
||||
if (from.mixingFrom != null)
|
||||
this.applyMixingFrom(from, skeleton, alpha);
|
||||
this.applyMixingFrom(from, skeleton);
|
||||
var mix = 0;
|
||||
if (entry.mixDuration == 0)
|
||||
mix = 1;
|
||||
@ -1016,15 +1016,14 @@ var spine;
|
||||
mix = entry.mixTime / entry.mixDuration;
|
||||
if (mix > 1)
|
||||
mix = 1;
|
||||
mix *= alpha;
|
||||
}
|
||||
var events = mix < from.eventThreshold ? this.events : null;
|
||||
var attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
||||
var animationLast = from.animationLast, animationTime = from.getAnimationTime();
|
||||
alpha = from.alpha * (1 - mix);
|
||||
var timelineCount = from.animation.timelines.length;
|
||||
var timelines = from.animation.timelines;
|
||||
var timelinesFirst = from.timelinesFirst;
|
||||
var alpha = from.alpha * entry.mixAlpha * (1 - mix);
|
||||
var firstFrame = from.timelinesRotation.length == 0;
|
||||
if (firstFrame)
|
||||
spine.Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
|
||||
@ -1169,9 +1168,8 @@ var spine;
|
||||
this.queue.interrupt(from);
|
||||
current.mixingFrom = from;
|
||||
current.mixTime = 0;
|
||||
from.timelinesRotation.length = 0;
|
||||
if (from.mixingFrom != null)
|
||||
from.alpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
}
|
||||
this.queue.start(current);
|
||||
};
|
||||
@ -1283,6 +1281,7 @@ var spine;
|
||||
entry.trackEnd = loop ? Number.MAX_VALUE : entry.animationEnd;
|
||||
entry.timeScale = 1;
|
||||
entry.alpha = 1;
|
||||
entry.mixAlpha = 1;
|
||||
entry.mixTime = 0;
|
||||
entry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);
|
||||
return entry;
|
||||
@ -1396,6 +1395,9 @@ var spine;
|
||||
TrackEntry.prototype.isComplete = function () {
|
||||
return this.trackTime >= this.animationEnd - this.animationStart;
|
||||
};
|
||||
TrackEntry.prototype.resetRotationDirections = function () {
|
||||
this.timelinesRotation.length = 0;
|
||||
};
|
||||
return TrackEntry;
|
||||
}());
|
||||
spine.TrackEntry = TrackEntry;
|
||||
@ -1699,6 +1701,421 @@ var spine;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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";
|
||||
@ -3221,8 +3638,15 @@ var spine;
|
||||
boundingBox.computeWorldVertices(slot, polygon);
|
||||
}
|
||||
}
|
||||
if (updateAabb)
|
||||
if (updateAabb) {
|
||||
this.aabbCompute();
|
||||
}
|
||||
else {
|
||||
this.minX = Number.POSITIVE_INFINITY;
|
||||
this.minY = Number.POSITIVE_INFINITY;
|
||||
this.maxX = Number.NEGATIVE_INFINITY;
|
||||
this.maxY = Number.NEGATIVE_INFINITY;
|
||||
}
|
||||
};
|
||||
SkeletonBounds.prototype.aabbCompute = function () {
|
||||
var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
||||
@ -3654,7 +4078,7 @@ var spine;
|
||||
var data = new spine.EventData(eventName);
|
||||
data.intValue = this.getValue(eventMap, "int", 0);
|
||||
data.floatValue = this.getValue(eventMap, "float", 0);
|
||||
data.stringValue = this.getValue(eventMap, "string", null);
|
||||
data.stringValue = this.getValue(eventMap, "string", "");
|
||||
skeletonData.events.push(data);
|
||||
}
|
||||
}
|
||||
@ -4858,421 +5282,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 deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 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;
|
||||
var x = bone.worldX;
|
||||
var 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 = 0, wy = 0;
|
||||
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 = 0, wy = 0;
|
||||
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 = bone.worldX, 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
@ -135,7 +135,7 @@ module spine {
|
||||
|
||||
// Apply mixing from entries first.
|
||||
let mix = current.alpha;
|
||||
if (current.mixingFrom != null) mix = this.applyMixingFrom(current, skeleton, mix);
|
||||
if (current.mixingFrom != null) mix *= this.applyMixingFrom(current, skeleton);
|
||||
|
||||
// Apply current entry.
|
||||
let animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||
@ -167,26 +167,25 @@ module spine {
|
||||
this.queue.drain();
|
||||
}
|
||||
|
||||
applyMixingFrom (entry: TrackEntry, skeleton: Skeleton, alpha: number) {
|
||||
applyMixingFrom (entry: TrackEntry, skeleton: Skeleton) {
|
||||
let from = entry.mixingFrom;
|
||||
if (from.mixingFrom != null) this.applyMixingFrom(from, skeleton, alpha);
|
||||
if (from.mixingFrom != null) this.applyMixingFrom(from, skeleton);
|
||||
|
||||
let mix = 0;
|
||||
if (entry.mixDuration == 0) // Single frame mix to undo mixingFrom changes.
|
||||
mix = 1;
|
||||
else {
|
||||
mix = entry.mixTime / entry.mixDuration;
|
||||
if (mix > 1) mix = 1;
|
||||
mix *= alpha;
|
||||
if (mix > 1) mix = 1;
|
||||
}
|
||||
|
||||
let events = mix < from.eventThreshold ? this.events : null;
|
||||
let attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
||||
let animationLast = from.animationLast, animationTime = from.getAnimationTime();
|
||||
alpha = from.alpha * (1 - mix);
|
||||
let animationLast = from.animationLast, animationTime = from.getAnimationTime();
|
||||
let timelineCount = from.animation.timelines.length;
|
||||
let timelines = from.animation.timelines;
|
||||
let timelinesFirst = from.timelinesFirst;
|
||||
let alpha = from.alpha * entry.mixAlpha * (1 - mix);
|
||||
|
||||
let firstFrame = from.timelinesRotation.length == 0;
|
||||
if (firstFrame) Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
|
||||
@ -347,12 +346,10 @@ module spine {
|
||||
if (from != null) {
|
||||
this.queue.interrupt(from);
|
||||
current.mixingFrom = from;
|
||||
current.mixTime = 0;
|
||||
current.mixTime = 0;
|
||||
|
||||
from.timelinesRotation.length = 0;
|
||||
|
||||
// If not completely mixed in, set alpha so mixing out happens from current mix to zero.
|
||||
if (from.mixingFrom != null) from.alpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
// If not completely mixed in, set mixAlpha so mixing out happens from current mix to zero.
|
||||
if (from.mixingFrom != null) current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||
}
|
||||
|
||||
this.queue.start(current);
|
||||
@ -474,6 +471,7 @@ module spine {
|
||||
entry.timeScale = 1;
|
||||
|
||||
entry.alpha = 1;
|
||||
entry.mixAlpha = 1;
|
||||
entry.mixTime = 0;
|
||||
entry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);
|
||||
return entry;
|
||||
@ -603,6 +601,10 @@ module spine {
|
||||
isComplete () {
|
||||
return this.trackTime >= this.animationEnd - this.animationStart;
|
||||
}
|
||||
|
||||
resetRotationDirections () {
|
||||
this.timelinesRotation.length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
export class EventQueue {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user