mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-19 08:16:41 +08:00
Renamed TextureAtlasAttachmentLoader to AtlasAttachmentLoader, matching the other runtimes.
This commit is contained in:
parent
f63561085a
commit
6cdcdbdb40
@ -19,7 +19,7 @@ function loadSkeleton(atlasFile, jsonFile, x, y, scale, animation, skin)
|
||||
local atlas = spine.TextureAtlas.new(spine.utils.readFile("data/" .. atlasFile), imageLoader)
|
||||
|
||||
-- load the JSON and create a Skeleton from it
|
||||
local json = spine.SkeletonJson.new(spine.TextureAtlasAttachmentLoader.new(atlas))
|
||||
local json = spine.SkeletonJson.new(spine.AtlasAttachmentLoader.new(atlas))
|
||||
json.scale = scale
|
||||
local skeletonData = json:readSkeletonDataFile("data/" .. jsonFile)
|
||||
local skeleton = spine.Skeleton.new(skeletonData)
|
||||
|
||||
@ -59,7 +59,7 @@ spine.BlendMode = require "spine-lua.BlendMode"
|
||||
spine.TextureAtlas = require "spine-lua.TextureAtlas"
|
||||
spine.TextureRegion = require "spine-lua.TextureRegion"
|
||||
spine.TextureAtlasRegion = require "spine-lua.TextureAtlasRegion"
|
||||
spine.TextureAtlasAttachmentLoader = require "spine-lua.TextureAtlasAttachmentLoader"
|
||||
spine.AtlasAttachmentLoader = require "spine-lua.AtlasAttachmentLoader"
|
||||
spine.Color = require "spine-lua.Color"
|
||||
|
||||
spine.utils.readFile = function (fileName, base)
|
||||
|
||||
@ -37,7 +37,7 @@ function loadSkeleton (jsonFile, atlasFile, animation, skin, scale, x, y)
|
||||
local loader = function (path) return love.graphics.newImage("data/" .. path) end
|
||||
local atlas = spine.TextureAtlas.new(spine.utils.readFile("data/" .. atlasFile .. ".atlas"), loader)
|
||||
|
||||
local json = spine.SkeletonJson.new(spine.TextureAtlasAttachmentLoader.new(atlas))
|
||||
local json = spine.SkeletonJson.new(spine.AtlasAttachmentLoader.new(atlas))
|
||||
json.scale = scale
|
||||
local skeletonData = json:readSkeletonDataFile("data/" .. jsonFile .. ".json")
|
||||
local skeleton = spine.Skeleton.new(skeletonData)
|
||||
|
||||
@ -61,7 +61,7 @@ spine.BlendMode = require "spine-lua.BlendMode"
|
||||
spine.TextureAtlas = require "spine-lua.TextureAtlas"
|
||||
spine.TextureRegion = require "spine-lua.TextureRegion"
|
||||
spine.TextureAtlasRegion = require "spine-lua.TextureAtlasRegion"
|
||||
spine.TextureAtlasAttachmentLoader = require "spine-lua.TextureAtlasAttachmentLoader"
|
||||
spine.AtlasAttachmentLoader = require "spine-lua.AtlasAttachmentLoader"
|
||||
spine.Color = require "spine-lua.Color"
|
||||
|
||||
spine.utils.readFile = function (fileName, base)
|
||||
|
||||
@ -1,82 +1,82 @@
|
||||
-------------------------------------------------------------------------------
|
||||
-- Spine Runtimes Software License v2.5
|
||||
--
|
||||
-- Copyright (c) 2013-2016, Esoteric Software
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- You are granted a perpetual, non-exclusive, non-sublicensable, and
|
||||
-- non-transferable license to use, install, execute, and perform the Spine
|
||||
-- Runtimes software and derivative works solely for personal or internal
|
||||
-- use. Without the written permission of Esoteric Software (see Section 2 of
|
||||
-- the Spine Software License Agreement), you may not (a) modify, translate,
|
||||
-- adapt, or develop new applications using the Spine Runtimes or otherwise
|
||||
-- create derivative works or improvements of the Spine Runtimes or (b) remove,
|
||||
-- delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
||||
-- or other intellectual property or proprietary rights notices on or in the
|
||||
-- Software, including any copy thereof. Redistributions in binary or source
|
||||
-- form must include this license and terms.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
-- EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
|
||||
-- USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
-- IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
-- POSSIBILITY OF SUCH DAMAGE.
|
||||
-------------------------------------------------------------------------------
|
||||
-- Spine Runtimes Software License v2.5
|
||||
--
|
||||
-- Copyright (c) 2013-2016, Esoteric Software
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- You are granted a perpetual, non-exclusive, non-sublicensable, and
|
||||
-- non-transferable license to use, install, execute, and perform the Spine
|
||||
-- Runtimes software and derivative works solely for personal or internal
|
||||
-- use. Without the written permission of Esoteric Software (see Section 2 of
|
||||
-- the Spine Software License Agreement), you may not (a) modify, translate,
|
||||
-- adapt, or develop new applications using the Spine Runtimes or otherwise
|
||||
-- create derivative works or improvements of the Spine Runtimes or (b) remove,
|
||||
-- delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
||||
-- or other intellectual property or proprietary rights notices on or in the
|
||||
-- Software, including any copy thereof. Redistributions in binary or source
|
||||
-- form must include this license and terms.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
-- EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
|
||||
-- USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
-- IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
-- POSSIBILITY OF SUCH DAMAGE.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local setmetatable = setmetatable
|
||||
|
||||
local AttachmentType = require "spine-lua.attachments.AttachmentType"
|
||||
local RegionAttachment = require "spine-lua.attachments.RegionAttachment"
|
||||
local BoundingBoxAttachment = require "spine-lua.attachments.BoundingBoxAttachment"
|
||||
local MeshAttachment = require "spine-lua.attachments.MeshAttachment"
|
||||
local PathAttachment = require "spine-lua.attachments.PathAttachment"
|
||||
local TextureAtlas = require "spine-lua.TextureAtlas"
|
||||
|
||||
local TextureAtlasAttachmentLoader = {}
|
||||
TextureAtlasAttachmentLoader.__index = TextureAtlasAttachmentLoader
|
||||
|
||||
function TextureAtlasAttachmentLoader.new (atlas)
|
||||
local self = {
|
||||
atlas = atlas
|
||||
}
|
||||
setmetatable(self, TextureAtlasAttachmentLoader)
|
||||
return self
|
||||
end
|
||||
|
||||
function TextureAtlasAttachmentLoader:newRegionAttachment (skin, name, path)
|
||||
local region = self.atlas:findRegion(path)
|
||||
if not region then error("Region not found in atlas: " .. path .. " (region attachment: " .. name .. ")") end
|
||||
region.renderObject = region
|
||||
local attachment = RegionAttachment.new(name)
|
||||
attachment:setRegion(region)
|
||||
attachment.region = region
|
||||
return attachment
|
||||
end
|
||||
|
||||
function TextureAtlasAttachmentLoader:newMeshAttachment (skin, name, path)
|
||||
local region = self.atlas:findRegion(path)
|
||||
if not region then error("Region not found in atlas: " .. path .. " (mesh attachment: " .. name .. ")") end
|
||||
region.renderObject = region
|
||||
local attachment = MeshAttachment.new(name)
|
||||
attachment.region = region
|
||||
return attachment
|
||||
end
|
||||
|
||||
function TextureAtlasAttachmentLoader:newSkinningMeshAttachment (skin, name, path)
|
||||
return SkinningMeshAttachment.new(name)
|
||||
end
|
||||
|
||||
function TextureAtlasAttachmentLoader:newBoundingBoxAttachment (skin, name)
|
||||
return BoundingBoxAttachment.new(name)
|
||||
end
|
||||
|
||||
function TextureAtlasAttachmentLoader:newPathAttachment(skin, name)
|
||||
return PathAttachment.new(name)
|
||||
end
|
||||
|
||||
return TextureAtlasAttachmentLoader
|
||||
local setmetatable = setmetatable
|
||||
|
||||
local AttachmentType = require "spine-lua.attachments.AttachmentType"
|
||||
local RegionAttachment = require "spine-lua.attachments.RegionAttachment"
|
||||
local BoundingBoxAttachment = require "spine-lua.attachments.BoundingBoxAttachment"
|
||||
local MeshAttachment = require "spine-lua.attachments.MeshAttachment"
|
||||
local PathAttachment = require "spine-lua.attachments.PathAttachment"
|
||||
local TextureAtlas = require "spine-lua.TextureAtlas"
|
||||
|
||||
local AtlasAttachmentLoader = {}
|
||||
AtlasAttachmentLoader.__index = AtlasAttachmentLoader
|
||||
|
||||
function AtlasAttachmentLoader.new (atlas)
|
||||
local self = {
|
||||
atlas = atlas
|
||||
}
|
||||
setmetatable(self, AtlasAttachmentLoader)
|
||||
return self
|
||||
end
|
||||
|
||||
function AtlasAttachmentLoader:newRegionAttachment (skin, name, path)
|
||||
local region = self.atlas:findRegion(path)
|
||||
if not region then error("Region not found in atlas: " .. path .. " (region attachment: " .. name .. ")") end
|
||||
region.renderObject = region
|
||||
local attachment = RegionAttachment.new(name)
|
||||
attachment:setRegion(region)
|
||||
attachment.region = region
|
||||
return attachment
|
||||
end
|
||||
|
||||
function AtlasAttachmentLoader:newMeshAttachment (skin, name, path)
|
||||
local region = self.atlas:findRegion(path)
|
||||
if not region then error("Region not found in atlas: " .. path .. " (mesh attachment: " .. name .. ")") end
|
||||
region.renderObject = region
|
||||
local attachment = MeshAttachment.new(name)
|
||||
attachment.region = region
|
||||
return attachment
|
||||
end
|
||||
|
||||
function AtlasAttachmentLoader:newSkinningMeshAttachment (skin, name, path)
|
||||
return SkinningMeshAttachment.new(name)
|
||||
end
|
||||
|
||||
function AtlasAttachmentLoader:newBoundingBoxAttachment (skin, name)
|
||||
return BoundingBoxAttachment.new(name)
|
||||
end
|
||||
|
||||
function AtlasAttachmentLoader:newPathAttachment(skin, name)
|
||||
return PathAttachment.new(name)
|
||||
end
|
||||
|
||||
return AtlasAttachmentLoader
|
||||
266
spine-ts/build/spine-all.d.ts
vendored
266
spine-ts/build/spine-all.d.ts
vendored
@ -323,134 +323,15 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
class AtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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,
|
||||
@ -820,16 +701,6 @@ declare module spine {
|
||||
texture: Texture;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class TextureAtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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 {
|
||||
class TransformConstraint implements Updatable {
|
||||
data: TransformConstraintData;
|
||||
@ -912,7 +783,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -949,6 +820,135 @@ 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);
|
||||
|
||||
@ -1340,420 +1340,37 @@ var spine;
|
||||
})(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;
|
||||
var AtlasAttachmentLoader = (function () {
|
||||
function AtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
return Attachment;
|
||||
AtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return AtlasAttachmentLoader;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
@ -4384,40 +4001,6 @@ var spine;
|
||||
spine.TextureAtlasRegion = TextureAtlasRegion;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlasAttachmentLoader = (function () {
|
||||
function TextureAtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
TextureAtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return TextureAtlasAttachmentLoader;
|
||||
}());
|
||||
spine.TextureAtlasAttachmentLoader = TextureAtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TransformConstraint = (function () {
|
||||
function TransformConstraint(data, skeleton) {
|
||||
@ -4765,6 +4348,423 @@ var spine;
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var threejs;
|
||||
(function (threejs) {
|
||||
@ -7193,7 +7193,7 @@ var spine;
|
||||
var texture = assetManager.get(imagesPath + path);
|
||||
return texture;
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
skeletonJson.scale = config.scale;
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(config.json));
|
||||
|
||||
File diff suppressed because one or more lines are too long
266
spine-ts/build/spine-canvas.d.ts
vendored
266
spine-ts/build/spine-canvas.d.ts
vendored
@ -323,134 +323,15 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
class AtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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,
|
||||
@ -820,16 +701,6 @@ declare module spine {
|
||||
texture: Texture;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class TextureAtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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 {
|
||||
class TransformConstraint implements Updatable {
|
||||
data: TransformConstraintData;
|
||||
@ -912,7 +783,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -949,3 +820,132 @@ 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>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1340,420 +1340,37 @@ var spine;
|
||||
})(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;
|
||||
var AtlasAttachmentLoader = (function () {
|
||||
function AtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
return Attachment;
|
||||
AtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return AtlasAttachmentLoader;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
@ -4384,40 +4001,6 @@ var spine;
|
||||
spine.TextureAtlasRegion = TextureAtlasRegion;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlasAttachmentLoader = (function () {
|
||||
function TextureAtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
TextureAtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return TextureAtlasAttachmentLoader;
|
||||
}());
|
||||
spine.TextureAtlasAttachmentLoader = TextureAtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TransformConstraint = (function () {
|
||||
function TransformConstraint(data, skeleton) {
|
||||
@ -4764,4 +4347,421 @@ var spine;
|
||||
}());
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
//# sourceMappingURL=spine-canvas.js.map
|
||||
File diff suppressed because one or more lines are too long
266
spine-ts/build/spine-core.d.ts
vendored
266
spine-ts/build/spine-core.d.ts
vendored
@ -257,134 +257,15 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
class AtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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,
|
||||
@ -794,16 +675,6 @@ declare module spine {
|
||||
texture: Texture;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class TextureAtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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 {
|
||||
class TransformConstraint implements Updatable {
|
||||
data: TransformConstraintData;
|
||||
@ -886,7 +757,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -923,3 +794,132 @@ 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>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1097,420 +1097,37 @@ var spine;
|
||||
})(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;
|
||||
var AtlasAttachmentLoader = (function () {
|
||||
function AtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
return Attachment;
|
||||
AtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return AtlasAttachmentLoader;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
@ -4207,40 +3824,6 @@ var spine;
|
||||
spine.TextureAtlasRegion = TextureAtlasRegion;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlasAttachmentLoader = (function () {
|
||||
function TextureAtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
TextureAtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return TextureAtlasAttachmentLoader;
|
||||
}());
|
||||
spine.TextureAtlasAttachmentLoader = TextureAtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TransformConstraint = (function () {
|
||||
function TransformConstraint(data, skeleton) {
|
||||
@ -4587,4 +4170,421 @@ var spine;
|
||||
}());
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
//# sourceMappingURL=spine-core.js.map
|
||||
File diff suppressed because one or more lines are too long
266
spine-ts/build/spine-threejs.d.ts
vendored
266
spine-ts/build/spine-threejs.d.ts
vendored
@ -257,134 +257,15 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
class AtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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,
|
||||
@ -794,16 +675,6 @@ declare module spine {
|
||||
texture: Texture;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class TextureAtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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 {
|
||||
class TransformConstraint implements Updatable {
|
||||
data: TransformConstraintData;
|
||||
@ -886,7 +757,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -923,6 +794,135 @@ 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);
|
||||
|
||||
@ -1097,420 +1097,37 @@ var spine;
|
||||
})(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;
|
||||
var AtlasAttachmentLoader = (function () {
|
||||
function AtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
return Attachment;
|
||||
AtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return AtlasAttachmentLoader;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
@ -4207,40 +3824,6 @@ var spine;
|
||||
spine.TextureAtlasRegion = TextureAtlasRegion;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlasAttachmentLoader = (function () {
|
||||
function TextureAtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
TextureAtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return TextureAtlasAttachmentLoader;
|
||||
}());
|
||||
spine.TextureAtlasAttachmentLoader = TextureAtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TransformConstraint = (function () {
|
||||
function TransformConstraint(data, skeleton) {
|
||||
@ -4588,6 +4171,423 @@ var spine;
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var threejs;
|
||||
(function (threejs) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
266
spine-ts/build/spine-webgl.d.ts
vendored
266
spine-ts/build/spine-webgl.d.ts
vendored
@ -257,134 +257,15 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
class AtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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,
|
||||
@ -794,16 +675,6 @@ declare module spine {
|
||||
texture: Texture;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class TextureAtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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 {
|
||||
class TransformConstraint implements Updatable {
|
||||
data: TransformConstraintData;
|
||||
@ -886,7 +757,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -923,6 +794,135 @@ 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);
|
||||
|
||||
@ -1097,420 +1097,37 @@ var spine;
|
||||
})(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;
|
||||
var AtlasAttachmentLoader = (function () {
|
||||
function AtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
return Attachment;
|
||||
AtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return AtlasAttachmentLoader;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
@ -4207,40 +3824,6 @@ var spine;
|
||||
spine.TextureAtlasRegion = TextureAtlasRegion;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlasAttachmentLoader = (function () {
|
||||
function TextureAtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
TextureAtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return TextureAtlasAttachmentLoader;
|
||||
}());
|
||||
spine.TextureAtlasAttachmentLoader = TextureAtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TransformConstraint = (function () {
|
||||
function TransformConstraint(data, skeleton) {
|
||||
@ -4588,6 +4171,423 @@ var spine;
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var webgl;
|
||||
(function (webgl) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
266
spine-ts/build/spine-widget.d.ts
vendored
266
spine-ts/build/spine-widget.d.ts
vendored
@ -257,134 +257,15 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
class AtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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,
|
||||
@ -794,16 +675,6 @@ declare module spine {
|
||||
texture: Texture;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class TextureAtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
constructor(atlas: TextureAtlas);
|
||||
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 {
|
||||
class TransformConstraint implements Updatable {
|
||||
data: TransformConstraintData;
|
||||
@ -886,7 +757,7 @@ declare module spine {
|
||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
@ -923,6 +794,135 @@ 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);
|
||||
|
||||
@ -1097,420 +1097,37 @@ var spine;
|
||||
})(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;
|
||||
var AtlasAttachmentLoader = (function () {
|
||||
function AtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
return Attachment;
|
||||
AtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
AtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return AtlasAttachmentLoader;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
@ -4207,40 +3824,6 @@ var spine;
|
||||
spine.TextureAtlasRegion = TextureAtlasRegion;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlasAttachmentLoader = (function () {
|
||||
function TextureAtlasAttachmentLoader(atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
TextureAtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||
var region = this.atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
var attachment = new spine.MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
|
||||
return new spine.BoundingBoxAttachment(name);
|
||||
};
|
||||
TextureAtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
|
||||
return new spine.PathAttachment(name);
|
||||
};
|
||||
return TextureAtlasAttachmentLoader;
|
||||
}());
|
||||
spine.TextureAtlasAttachmentLoader = TextureAtlasAttachmentLoader;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TransformConstraint = (function () {
|
||||
function TransformConstraint(data, skeleton) {
|
||||
@ -4588,6 +4171,423 @@ var spine;
|
||||
spine.TimeKeeper = TimeKeeper;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Attachment = (function () {
|
||||
function Attachment(name) {
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
return Attachment;
|
||||
}());
|
||||
spine.Attachment = Attachment;
|
||||
var VertexAttachment = (function (_super) {
|
||||
__extends(VertexAttachment, _super);
|
||||
function VertexAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.worldVerticesLength = 0;
|
||||
}
|
||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||
};
|
||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||
count += offset;
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var v = 0, skip = 0;
|
||||
for (var i = 0; i < start; i += 2) {
|
||||
var n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
var wx = x, wy = y;
|
||||
var n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
};
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
spine.VertexAttachment = VertexAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
(function (AttachmentType) {
|
||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||
var AttachmentType = spine.AttachmentType;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var BoundingBoxAttachment = (function (_super) {
|
||||
__extends(BoundingBoxAttachment, _super);
|
||||
function BoundingBoxAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var MeshAttachment = (function (_super) {
|
||||
__extends(MeshAttachment, _super);
|
||||
function MeshAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.inheritDeform = false;
|
||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||
}
|
||||
MeshAttachment.prototype.updateUVs = function () {
|
||||
var regionUVs = this.regionUVs;
|
||||
var verticesLength = regionUVs.length;
|
||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||
var u = 0, v = 0, width = 0, height = 0;
|
||||
if (this.region == null) {
|
||||
u = v = 0;
|
||||
width = height = 1;
|
||||
}
|
||||
else {
|
||||
u = this.region.u;
|
||||
v = this.region.v;
|
||||
width = this.region.u2 - u;
|
||||
height = this.region.v2 - v;
|
||||
}
|
||||
if (this.region.rotate) {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||
}
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||
var x = skeleton.x, y = skeleton.y;
|
||||
var deformArray = slot.attachmentVertices;
|
||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||
var bones = this.bones;
|
||||
if (bones == null) {
|
||||
var verticesLength = vertices.length;
|
||||
if (deformArray.length > 0)
|
||||
vertices = deformArray;
|
||||
var bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||
var vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * b + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
return worldVertices;
|
||||
}
|
||||
var skeletonBones = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var deform = deformArray;
|
||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||
var wx = x, wy = y;
|
||||
var nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
var bone = skeletonBones[bones[v]];
|
||||
var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
worldVertices[w + 2] = color.r;
|
||||
worldVertices[w + 3] = color.g;
|
||||
worldVertices[w + 4] = color.b;
|
||||
worldVertices[w + 5] = color.a;
|
||||
}
|
||||
}
|
||||
return worldVertices;
|
||||
};
|
||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||
};
|
||||
MeshAttachment.prototype.getParentMesh = function () {
|
||||
return this.parentMesh;
|
||||
};
|
||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||
this.parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
this.bones = parentMesh.bones;
|
||||
this.vertices = parentMesh.vertices;
|
||||
this.regionUVs = parentMesh.regionUVs;
|
||||
this.triangles = parentMesh.triangles;
|
||||
this.hullLength = parentMesh.hullLength;
|
||||
}
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var PathAttachment = (function (_super) {
|
||||
__extends(PathAttachment, _super);
|
||||
function PathAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.closed = false;
|
||||
this.constantSpeed = false;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var RegionAttachment = (function (_super) {
|
||||
__extends(RegionAttachment, _super);
|
||||
function RegionAttachment(name) {
|
||||
_super.call(this, name);
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.scaleX = 1;
|
||||
this.scaleY = 1;
|
||||
this.rotation = 0;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.color = new spine.Color(1, 1, 1, 1);
|
||||
this.offset = spine.Utils.newFloatArray(8);
|
||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||
}
|
||||
RegionAttachment.prototype.setRegion = function (region) {
|
||||
var vertices = this.vertices;
|
||||
if (region.rotate) {
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v2;
|
||||
vertices[RegionAttachment.U3] = region.u;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v;
|
||||
vertices[RegionAttachment.U1] = region.u2;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
}
|
||||
else {
|
||||
vertices[RegionAttachment.U1] = region.u;
|
||||
vertices[RegionAttachment.V1] = region.v2;
|
||||
vertices[RegionAttachment.U2] = region.u;
|
||||
vertices[RegionAttachment.V2] = region.v;
|
||||
vertices[RegionAttachment.U3] = region.u2;
|
||||
vertices[RegionAttachment.V3] = region.v;
|
||||
vertices[RegionAttachment.U4] = region.u2;
|
||||
vertices[RegionAttachment.V4] = region.v2;
|
||||
}
|
||||
this.region = region;
|
||||
};
|
||||
RegionAttachment.prototype.updateOffset = function () {
|
||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||
var localX2 = localX + this.region.width * regionScaleX;
|
||||
var localY2 = localY + this.region.height * regionScaleY;
|
||||
var radians = this.rotation * Math.PI / 180;
|
||||
var cos = Math.cos(radians);
|
||||
var sin = Math.sin(radians);
|
||||
var localXCos = localX * cos + this.x;
|
||||
var localXSin = localX * sin;
|
||||
var localYCos = localY * cos + this.y;
|
||||
var localYSin = localY * sin;
|
||||
var localX2Cos = localX2 * cos + this.x;
|
||||
var localX2Sin = localX2 * sin;
|
||||
var localY2Cos = localY2 * cos + this.y;
|
||||
var localY2Sin = localY2 * sin;
|
||||
var offset = this.offset;
|
||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||
};
|
||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||
var skeleton = slot.bone.skeleton;
|
||||
var skeletonColor = skeleton.color;
|
||||
var slotColor = slot.color;
|
||||
var regionColor = this.color;
|
||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||
var vertices = this.vertices;
|
||||
var offset = this.offset;
|
||||
var bone = slot.bone;
|
||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||
var offsetX = 0, offsetY = 0;
|
||||
offsetX = offset[RegionAttachment.OX1];
|
||||
offsetY = offset[RegionAttachment.OY1];
|
||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C1R] = color.r;
|
||||
vertices[RegionAttachment.C1G] = color.g;
|
||||
vertices[RegionAttachment.C1B] = color.b;
|
||||
vertices[RegionAttachment.C1A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX2];
|
||||
offsetY = offset[RegionAttachment.OY2];
|
||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C2R] = color.r;
|
||||
vertices[RegionAttachment.C2G] = color.g;
|
||||
vertices[RegionAttachment.C2B] = color.b;
|
||||
vertices[RegionAttachment.C2A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX3];
|
||||
offsetY = offset[RegionAttachment.OY3];
|
||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C3R] = color.r;
|
||||
vertices[RegionAttachment.C3G] = color.g;
|
||||
vertices[RegionAttachment.C3B] = color.b;
|
||||
vertices[RegionAttachment.C3A] = color.a;
|
||||
offsetX = offset[RegionAttachment.OX4];
|
||||
offsetY = offset[RegionAttachment.OY4];
|
||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||
vertices[RegionAttachment.C4R] = color.r;
|
||||
vertices[RegionAttachment.C4G] = color.g;
|
||||
vertices[RegionAttachment.C4B] = color.b;
|
||||
vertices[RegionAttachment.C4A] = color.a;
|
||||
return vertices;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
RegionAttachment.OY2 = 3;
|
||||
RegionAttachment.OX3 = 4;
|
||||
RegionAttachment.OY3 = 5;
|
||||
RegionAttachment.OX4 = 6;
|
||||
RegionAttachment.OY4 = 7;
|
||||
RegionAttachment.X1 = 0;
|
||||
RegionAttachment.Y1 = 1;
|
||||
RegionAttachment.C1R = 2;
|
||||
RegionAttachment.C1G = 3;
|
||||
RegionAttachment.C1B = 4;
|
||||
RegionAttachment.C1A = 5;
|
||||
RegionAttachment.U1 = 6;
|
||||
RegionAttachment.V1 = 7;
|
||||
RegionAttachment.X2 = 8;
|
||||
RegionAttachment.Y2 = 9;
|
||||
RegionAttachment.C2R = 10;
|
||||
RegionAttachment.C2G = 11;
|
||||
RegionAttachment.C2B = 12;
|
||||
RegionAttachment.C2A = 13;
|
||||
RegionAttachment.U2 = 14;
|
||||
RegionAttachment.V2 = 15;
|
||||
RegionAttachment.X3 = 16;
|
||||
RegionAttachment.Y3 = 17;
|
||||
RegionAttachment.C3R = 18;
|
||||
RegionAttachment.C3G = 19;
|
||||
RegionAttachment.C3B = 20;
|
||||
RegionAttachment.C3A = 21;
|
||||
RegionAttachment.U3 = 22;
|
||||
RegionAttachment.V3 = 23;
|
||||
RegionAttachment.X4 = 24;
|
||||
RegionAttachment.Y4 = 25;
|
||||
RegionAttachment.C4R = 26;
|
||||
RegionAttachment.C4G = 27;
|
||||
RegionAttachment.C4B = 28;
|
||||
RegionAttachment.C4A = 29;
|
||||
RegionAttachment.U4 = 30;
|
||||
RegionAttachment.V4 = 31;
|
||||
return RegionAttachment;
|
||||
}(spine.Attachment));
|
||||
spine.RegionAttachment = RegionAttachment;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var webgl;
|
||||
(function (webgl) {
|
||||
@ -6772,7 +6772,7 @@ var spine;
|
||||
var texture = assetManager.get(imagesPath + path);
|
||||
return texture;
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
skeletonJson.scale = config.scale;
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(config.json));
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -59,8 +59,8 @@ function loadSkeleton (name, initialAnimation, skin) {
|
||||
return assetManager.get("assets/" + path);
|
||||
});
|
||||
|
||||
// Create a TextureAtlasAttachmentLoader, which is specific to the WebGL backend.
|
||||
atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
// Create a AtlasAttachmentLoader, which is specific to the WebGL backend.
|
||||
atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
|
||||
// Create a SkeletonJson instance for parsing the .json file.
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
|
||||
@ -1,69 +1,69 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License v2.5
|
||||
*
|
||||
* Copyright (c) 2013-2016, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
||||
* non-transferable license to use, install, execute, and perform the Spine
|
||||
* Runtimes software and derivative works solely for personal or internal
|
||||
* use. Without the written permission of Esoteric Software (see Section 2 of
|
||||
* the Spine Software License Agreement), you may not (a) modify, translate,
|
||||
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
||||
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
||||
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
||||
* or other intellectual property or proprietary rights notices on or in the
|
||||
* Software, including any copy thereof. Redistributions in binary or source
|
||||
* form must include this license and terms.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
|
||||
* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License v2.5
|
||||
*
|
||||
* Copyright (c) 2013-2016, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
||||
* non-transferable license to use, install, execute, and perform the Spine
|
||||
* Runtimes software and derivative works solely for personal or internal
|
||||
* use. Without the written permission of Esoteric Software (see Section 2 of
|
||||
* the Spine Software License Agreement), you may not (a) modify, translate,
|
||||
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
||||
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
||||
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
||||
* or other intellectual property or proprietary rights notices on or in the
|
||||
* Software, including any copy thereof. Redistributions in binary or source
|
||||
* form must include this license and terms.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
|
||||
* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
module spine {
|
||||
export class TextureAtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
|
||||
constructor (atlas: TextureAtlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
|
||||
/** @return May be null to not load an attachment. */
|
||||
newRegionAttachment (skin: Skin, name: string, path: string): RegionAttachment {
|
||||
let region = this.atlas.findRegion(path);
|
||||
if (region == null) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
let attachment = new RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
}
|
||||
|
||||
/** @return May be null to not load an attachment. */
|
||||
newMeshAttachment (skin: Skin, name: string, path: string) : MeshAttachment {
|
||||
let region = this.atlas.findRegion(path);
|
||||
if (region == null) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
let attachment = new MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
}
|
||||
|
||||
/** @return May be null to not load an attachment. */
|
||||
newBoundingBoxAttachment (skin: Skin, name: string) : BoundingBoxAttachment {
|
||||
return new BoundingBoxAttachment(name);
|
||||
}
|
||||
|
||||
/** @return May be null to not load an attachment */
|
||||
newPathAttachment (skin: Skin, name: string): PathAttachment {
|
||||
return new PathAttachment(name);
|
||||
}
|
||||
}
|
||||
module spine {
|
||||
export class AtlasAttachmentLoader implements AttachmentLoader {
|
||||
atlas: TextureAtlas;
|
||||
|
||||
constructor (atlas: TextureAtlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
|
||||
/** @return May be null to not load an attachment. */
|
||||
newRegionAttachment (skin: Skin, name: string, path: string): RegionAttachment {
|
||||
let region = this.atlas.findRegion(path);
|
||||
if (region == null) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
let attachment = new RegionAttachment(name);
|
||||
attachment.setRegion(region);
|
||||
return attachment;
|
||||
}
|
||||
|
||||
/** @return May be null to not load an attachment. */
|
||||
newMeshAttachment (skin: Skin, name: string, path: string) : MeshAttachment {
|
||||
let region = this.atlas.findRegion(path);
|
||||
if (region == null) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||
region.renderObject = region;
|
||||
let attachment = new MeshAttachment(name);
|
||||
attachment.region = region;
|
||||
return attachment;
|
||||
}
|
||||
|
||||
/** @return May be null to not load an attachment. */
|
||||
newBoundingBoxAttachment (skin: Skin, name: string) : BoundingBoxAttachment {
|
||||
return new BoundingBoxAttachment(name);
|
||||
}
|
||||
|
||||
/** @return May be null to not load an attachment */
|
||||
newPathAttachment (skin: Skin, name: string): PathAttachment {
|
||||
return new PathAttachment(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,8 +71,8 @@ function loadSkeleton (name, scale) {
|
||||
return assetManager.get("assets/" + path);
|
||||
});
|
||||
|
||||
// Create a TextureAtlasAttachmentLoader that resolves region, mesh, boundingbox and path attachments
|
||||
atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
// Create a AtlasAttachmentLoader that resolves region, mesh, boundingbox and path attachments
|
||||
atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
|
||||
// Create a SkeletonJson instance for parsing the .json file.
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
|
||||
@ -40,7 +40,7 @@ var hoverboardDemo = function(loadingComplete, bgColor) {
|
||||
var atlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "atlas1.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json")["spineboy-hover"]);
|
||||
skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -86,7 +86,7 @@ var imageChangesDemo = function(loadingComplete, bgColor) {
|
||||
var atlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "atlas1.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json")[name]);
|
||||
var skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -98,7 +98,7 @@ var meshesDemo = function(loadingComplete, bgColor) {
|
||||
var atlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "atlas2.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json")[name]);
|
||||
var skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -32,7 +32,7 @@ var skinsDemo = function(loadingComplete, bgColor) {
|
||||
var atlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "heroes.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json").heroes);
|
||||
skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -38,7 +38,7 @@ var spritesheetsDemo = function(loadingComplete, bgColor) {
|
||||
skeletonAtlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "atlas1.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(skeletonAtlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(skeletonAtlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json").raptor);
|
||||
skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -48,7 +48,7 @@ var stretchymanDemo = function(loadingComplete, bgColor) {
|
||||
var atlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "atlas2.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json").stretchyman);
|
||||
skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -30,7 +30,7 @@ var tankDemo = function(loadingComplete, bgColor) {
|
||||
var atlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "atlas2.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json").tank);
|
||||
skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -42,7 +42,7 @@ var transformsDemo = function(loadingComplete, bgColor) {
|
||||
var atlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "atlas2.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json").transforms);
|
||||
skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -99,7 +99,7 @@ var transitionsDemo = function(loadingComplete, bgColor) {
|
||||
var atlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "atlas1.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json")[name]);
|
||||
var skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -40,7 +40,7 @@ var vineDemo = function(loadingComplete, bgColor) {
|
||||
var atlas = new spine.TextureAtlas(assetManager.get(DEMO_NAME, "atlas2.atlas"), function(path) {
|
||||
return assetManager.get(DEMO_NAME, path);
|
||||
});
|
||||
var atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(DEMO_NAME, "demos.json").vine);
|
||||
skeleton = new spine.Skeleton(skeletonData);
|
||||
|
||||
@ -103,8 +103,8 @@ function loadSkeleton (name, initialAnimation, premultipliedAlpha, skin) {
|
||||
return assetManager.get("assets/" + path);
|
||||
});
|
||||
|
||||
// Create a TextureAtlasAttachmentLoader that resolves region, mesh, boundingbox and path attachments
|
||||
atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
// Create a AtlasAttachmentLoader that resolves region, mesh, boundingbox and path attachments
|
||||
atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
|
||||
// Create a SkeletonJson instance for parsing the .json file.
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
|
||||
@ -26,8 +26,8 @@
|
||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
module spine {
|
||||
export class SpineWidget {
|
||||
skeleton: Skeleton;
|
||||
@ -125,7 +125,7 @@ module spine {
|
||||
return texture;
|
||||
});
|
||||
|
||||
let atlasLoader = new spine.TextureAtlasAttachmentLoader(atlas);
|
||||
let atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
|
||||
// Set the scale to apply during parsing, parse the file, and create a new skeleton.
|
||||
@ -314,4 +314,4 @@ module spine {
|
||||
error: (widget: SpineWidget, msg: string) => void;
|
||||
}
|
||||
}
|
||||
spine.SpineWidget.setupDOMListener();
|
||||
spine.SpineWidget.setupDOMListener();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user