|
@@ -1,97 +1,3 @@
|
|
|
-declare module spine {
|
|
|
- class AssetManager implements Disposable {
|
|
|
- private pathPrefix;
|
|
|
- private textureLoader;
|
|
|
- private assets;
|
|
|
- private errors;
|
|
|
- private toLoad;
|
|
|
- private loaded;
|
|
|
- constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
|
|
|
- loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
|
|
|
- loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
|
|
|
- loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
|
|
|
- get(path: string): any;
|
|
|
- remove(path: string): void;
|
|
|
- removeAll(): void;
|
|
|
- isLoadingComplete(): boolean;
|
|
|
- getToLoad(): number;
|
|
|
- getLoaded(): number;
|
|
|
- dispose(): void;
|
|
|
- hasErrors(): boolean;
|
|
|
- getErrors(): Map<string>;
|
|
|
- }
|
|
|
-}
|
|
|
-declare module spine.canvas {
|
|
|
- class AssetManager extends spine.AssetManager {
|
|
|
- constructor(pathPrefix?: string);
|
|
|
- }
|
|
|
-}
|
|
|
-declare module spine {
|
|
|
- abstract class Texture {
|
|
|
- protected _image: HTMLImageElement;
|
|
|
- constructor(image: HTMLImageElement);
|
|
|
- getImage(): HTMLImageElement;
|
|
|
- abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
|
- abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
|
- abstract dispose(): void;
|
|
|
- static filterFromString(text: string): TextureFilter;
|
|
|
- static wrapFromString(text: string): TextureWrap;
|
|
|
- }
|
|
|
- enum TextureFilter {
|
|
|
- Nearest = 9728,
|
|
|
- Linear = 9729,
|
|
|
- MipMap = 9987,
|
|
|
- MipMapNearestNearest = 9984,
|
|
|
- MipMapLinearNearest = 9985,
|
|
|
- MipMapNearestLinear = 9986,
|
|
|
- MipMapLinearLinear = 9987,
|
|
|
- }
|
|
|
- enum TextureWrap {
|
|
|
- MirroredRepeat = 33648,
|
|
|
- ClampToEdge = 33071,
|
|
|
- Repeat = 10497,
|
|
|
- }
|
|
|
- class TextureRegion {
|
|
|
- renderObject: any;
|
|
|
- u: number;
|
|
|
- v: number;
|
|
|
- u2: number;
|
|
|
- v2: number;
|
|
|
- width: number;
|
|
|
- height: number;
|
|
|
- rotate: boolean;
|
|
|
- offsetX: number;
|
|
|
- offsetY: number;
|
|
|
- originalWidth: number;
|
|
|
- originalHeight: number;
|
|
|
- }
|
|
|
-}
|
|
|
-declare module spine.canvas {
|
|
|
- class CanvasTexture extends Texture {
|
|
|
- constructor(image: HTMLImageElement);
|
|
|
- setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
|
- setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
|
- dispose(): void;
|
|
|
- }
|
|
|
-}
|
|
|
-declare module spine.canvas {
|
|
|
- class SkeletonRenderer {
|
|
|
- static QUAD_TRIANGLES: number[];
|
|
|
- static VERTEX_SIZE: number;
|
|
|
- private ctx;
|
|
|
- triangleRendering: boolean;
|
|
|
- debugRendering: boolean;
|
|
|
- private vertices;
|
|
|
- private tempColor;
|
|
|
- constructor(context: CanvasRenderingContext2D);
|
|
|
- draw(skeleton: Skeleton): void;
|
|
|
- private drawImages(skeleton);
|
|
|
- private drawTriangles(skeleton);
|
|
|
- private drawTriangle(img, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2);
|
|
|
- private computeRegionVertices(slot, region, pma);
|
|
|
- private computeMeshVertices(slot, mesh, pma);
|
|
|
- }
|
|
|
-}
|
|
|
declare module spine {
|
|
|
class Animation {
|
|
|
name: string;
|
|
@@ -446,33 +352,32 @@ declare module spine {
|
|
|
}
|
|
|
}
|
|
|
declare module spine {
|
|
|
- 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;
|
|
|
- newPointAttachment(skin: Skin, name: string): PointAttachment;
|
|
|
- newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
|
|
|
- }
|
|
|
-}
|
|
|
-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, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
|
|
- applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
|
+ class AssetManager implements Disposable {
|
|
|
+ private pathPrefix;
|
|
|
+ private textureLoader;
|
|
|
+ private assets;
|
|
|
+ private errors;
|
|
|
+ private toLoad;
|
|
|
+ private loaded;
|
|
|
+ constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
|
|
|
+ loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
|
|
|
+ loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
|
|
|
+ loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
|
|
|
+ get(path: string): any;
|
|
|
+ remove(path: string): void;
|
|
|
+ removeAll(): void;
|
|
|
+ isLoadingComplete(): boolean;
|
|
|
+ getToLoad(): number;
|
|
|
+ getLoaded(): number;
|
|
|
+ dispose(): void;
|
|
|
+ hasErrors(): boolean;
|
|
|
+ getErrors(): Map<string>;
|
|
|
}
|
|
|
}
|
|
|
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;
|
|
@@ -481,130 +386,6 @@ declare module spine {
|
|
|
newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
|
|
|
}
|
|
|
}
|
|
|
-declare module spine {
|
|
|
- enum AttachmentType {
|
|
|
- Region = 0,
|
|
|
- BoundingBox = 1,
|
|
|
- Mesh = 2,
|
|
|
- LinkedMesh = 3,
|
|
|
- Path = 4,
|
|
|
- Point = 5,
|
|
|
- }
|
|
|
-}
|
|
|
-declare module spine {
|
|
|
- class BoundingBoxAttachment extends VertexAttachment {
|
|
|
- color: Color;
|
|
|
- constructor(name: string);
|
|
|
- }
|
|
|
-}
|
|
|
-declare module spine {
|
|
|
- class ClippingAttachment extends VertexAttachment {
|
|
|
- endSlot: SlotData;
|
|
|
- color: Color;
|
|
|
- constructor(name: string);
|
|
|
- }
|
|
|
-}
|
|
|
-declare module spine {
|
|
|
- class MeshAttachment extends VertexAttachment {
|
|
|
- region: TextureRegion;
|
|
|
- path: string;
|
|
|
- regionUVs: ArrayLike<number>;
|
|
|
- uvs: ArrayLike<number>;
|
|
|
- triangles: Array<number>;
|
|
|
- color: Color;
|
|
|
- hullLength: number;
|
|
|
- private parentMesh;
|
|
|
- inheritDeform: boolean;
|
|
|
- tempColor: Color;
|
|
|
- constructor(name: string);
|
|
|
- updateUVs(): void;
|
|
|
- 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 PointAttachment extends VertexAttachment {
|
|
|
- x: number;
|
|
|
- y: number;
|
|
|
- rotation: number;
|
|
|
- color: Color;
|
|
|
- constructor(name: string);
|
|
|
- computeWorldPosition(bone: Bone, point: Vector2): Vector2;
|
|
|
- computeWorldRotation(bone: Bone): number;
|
|
|
- }
|
|
|
-}
|
|
|
-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>;
|
|
|
- uvs: ArrayLike<number>;
|
|
|
- tempColor: Color;
|
|
|
- constructor(name: string);
|
|
|
- updateOffset(): void;
|
|
|
- setRegion(region: TextureRegion): void;
|
|
|
- computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
|
|
- }
|
|
|
-}
|
|
|
declare module spine {
|
|
|
enum BlendMode {
|
|
|
Normal = 0,
|
|
@@ -1005,6 +786,46 @@ declare module spine {
|
|
|
constructor(index: number, name: string, boneData: BoneData);
|
|
|
}
|
|
|
}
|
|
|
+declare module spine {
|
|
|
+ abstract class Texture {
|
|
|
+ protected _image: HTMLImageElement;
|
|
|
+ constructor(image: HTMLImageElement);
|
|
|
+ getImage(): HTMLImageElement;
|
|
|
+ abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
|
+ abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
|
+ abstract dispose(): void;
|
|
|
+ static filterFromString(text: string): TextureFilter;
|
|
|
+ static wrapFromString(text: string): TextureWrap;
|
|
|
+ }
|
|
|
+ enum TextureFilter {
|
|
|
+ Nearest = 9728,
|
|
|
+ Linear = 9729,
|
|
|
+ MipMap = 9987,
|
|
|
+ MipMapNearestNearest = 9984,
|
|
|
+ MipMapLinearNearest = 9985,
|
|
|
+ MipMapNearestLinear = 9986,
|
|
|
+ MipMapLinearLinear = 9987,
|
|
|
+ }
|
|
|
+ enum TextureWrap {
|
|
|
+ MirroredRepeat = 33648,
|
|
|
+ ClampToEdge = 33071,
|
|
|
+ Repeat = 10497,
|
|
|
+ }
|
|
|
+ class TextureRegion {
|
|
|
+ renderObject: any;
|
|
|
+ u: number;
|
|
|
+ v: number;
|
|
|
+ u2: number;
|
|
|
+ v2: number;
|
|
|
+ width: number;
|
|
|
+ height: number;
|
|
|
+ rotate: boolean;
|
|
|
+ offsetX: number;
|
|
|
+ offsetY: number;
|
|
|
+ originalWidth: number;
|
|
|
+ originalHeight: number;
|
|
|
+ }
|
|
|
+}
|
|
|
declare module spine {
|
|
|
class TextureAtlas implements Disposable {
|
|
|
pages: TextureAtlasPage[];
|
|
@@ -1094,6 +915,9 @@ declare module spine {
|
|
|
interface Disposable {
|
|
|
dispose(): void;
|
|
|
}
|
|
|
+ interface Restorable {
|
|
|
+ restore(): void;
|
|
|
+ }
|
|
|
class Color {
|
|
|
r: number;
|
|
|
g: number;
|
|
@@ -1181,56 +1005,188 @@ declare module spine {
|
|
|
getMean(): number;
|
|
|
}
|
|
|
}
|
|
|
-declare module spine.threejs {
|
|
|
- class AssetManager extends spine.AssetManager {
|
|
|
- constructor(pathPrefix?: string);
|
|
|
+declare module spine {
|
|
|
+ abstract class Attachment {
|
|
|
+ name: string;
|
|
|
+ constructor(name: string);
|
|
|
+ }
|
|
|
+ abstract class VertexAttachment extends Attachment {
|
|
|
+ bones: Array<number>;
|
|
|
+ vertices: ArrayLike<number>;
|
|
|
+ worldVerticesLength: number;
|
|
|
+ constructor(name: string);
|
|
|
+ computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
|
|
+ applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
|
}
|
|
|
}
|
|
|
-declare module spine.threejs {
|
|
|
- class MeshBatcher {
|
|
|
- mesh: THREE.Mesh;
|
|
|
- private static VERTEX_SIZE;
|
|
|
- private vertexBuffer;
|
|
|
- private vertices;
|
|
|
- private verticesLength;
|
|
|
- private indices;
|
|
|
- private indicesLength;
|
|
|
- constructor(mesh: THREE.Mesh, maxVertices?: number);
|
|
|
- begin(): void;
|
|
|
- batch(vertices: ArrayLike<number>, verticesLength: number, indices: ArrayLike<number>, indicesLength: number, z?: number): void;
|
|
|
- end(): void;
|
|
|
+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;
|
|
|
+ newPointAttachment(skin: Skin, name: string): PointAttachment;
|
|
|
+ newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
|
|
|
}
|
|
|
}
|
|
|
-declare module spine.threejs {
|
|
|
- class SkeletonMesh extends THREE.Mesh {
|
|
|
- skeleton: Skeleton;
|
|
|
- state: AnimationState;
|
|
|
- zOffset: number;
|
|
|
- private batcher;
|
|
|
- private clipper;
|
|
|
- static QUAD_TRIANGLES: number[];
|
|
|
- static VERTEX_SIZE: number;
|
|
|
- private vertices;
|
|
|
- private tempColor;
|
|
|
- constructor(skeletonData: SkeletonData);
|
|
|
- update(deltaTime: number): void;
|
|
|
- private updateGeometry();
|
|
|
+declare module spine {
|
|
|
+ enum AttachmentType {
|
|
|
+ Region = 0,
|
|
|
+ BoundingBox = 1,
|
|
|
+ Mesh = 2,
|
|
|
+ LinkedMesh = 3,
|
|
|
+ Path = 4,
|
|
|
+ Point = 5,
|
|
|
}
|
|
|
}
|
|
|
-declare module spine.threejs {
|
|
|
- class ThreeJsTexture extends Texture {
|
|
|
- texture: THREE.Texture;
|
|
|
+declare module spine {
|
|
|
+ class BoundingBoxAttachment extends VertexAttachment {
|
|
|
+ color: Color;
|
|
|
+ constructor(name: string);
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module spine {
|
|
|
+ class ClippingAttachment extends VertexAttachment {
|
|
|
+ endSlot: SlotData;
|
|
|
+ color: Color;
|
|
|
+ constructor(name: string);
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module spine {
|
|
|
+ class MeshAttachment extends VertexAttachment {
|
|
|
+ region: TextureRegion;
|
|
|
+ path: string;
|
|
|
+ regionUVs: ArrayLike<number>;
|
|
|
+ uvs: ArrayLike<number>;
|
|
|
+ triangles: Array<number>;
|
|
|
+ color: Color;
|
|
|
+ hullLength: number;
|
|
|
+ private parentMesh;
|
|
|
+ inheritDeform: boolean;
|
|
|
+ tempColor: Color;
|
|
|
+ constructor(name: string);
|
|
|
+ updateUVs(): void;
|
|
|
+ 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 PointAttachment extends VertexAttachment {
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ rotation: number;
|
|
|
+ color: Color;
|
|
|
+ constructor(name: string);
|
|
|
+ computeWorldPosition(bone: Bone, point: Vector2): Vector2;
|
|
|
+ computeWorldRotation(bone: Bone): number;
|
|
|
+ }
|
|
|
+}
|
|
|
+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>;
|
|
|
+ uvs: ArrayLike<number>;
|
|
|
+ tempColor: Color;
|
|
|
+ constructor(name: string);
|
|
|
+ updateOffset(): void;
|
|
|
+ setRegion(region: TextureRegion): void;
|
|
|
+ computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module spine.canvas {
|
|
|
+ class AssetManager extends spine.AssetManager {
|
|
|
+ constructor(pathPrefix?: string);
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module spine.canvas {
|
|
|
+ class CanvasTexture extends Texture {
|
|
|
constructor(image: HTMLImageElement);
|
|
|
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
|
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
|
dispose(): void;
|
|
|
- static toThreeJsTextureFilter(filter: TextureFilter): THREE.TextureFilter;
|
|
|
- static toThreeJsTextureWrap(wrap: TextureWrap): THREE.Wrapping;
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module spine.canvas {
|
|
|
+ class SkeletonRenderer {
|
|
|
+ static QUAD_TRIANGLES: number[];
|
|
|
+ static VERTEX_SIZE: number;
|
|
|
+ private ctx;
|
|
|
+ triangleRendering: boolean;
|
|
|
+ debugRendering: boolean;
|
|
|
+ private vertices;
|
|
|
+ private tempColor;
|
|
|
+ constructor(context: CanvasRenderingContext2D);
|
|
|
+ draw(skeleton: Skeleton): void;
|
|
|
+ private drawImages(skeleton);
|
|
|
+ private drawTriangles(skeleton);
|
|
|
+ private drawTriangle(img, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2);
|
|
|
+ private computeRegionVertices(slot, region, pma);
|
|
|
+ private computeMeshVertices(slot, mesh, pma);
|
|
|
}
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
|
class AssetManager extends spine.AssetManager {
|
|
|
- constructor(gl: WebGLRenderingContext, pathPrefix?: string);
|
|
|
+ constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, pathPrefix?: string);
|
|
|
}
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
@@ -1255,14 +1211,16 @@ declare module spine.webgl {
|
|
|
}
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
|
- class GLTexture extends Texture implements Disposable {
|
|
|
- private gl;
|
|
|
+ class GLTexture extends Texture implements Disposable, Restorable {
|
|
|
+ private context;
|
|
|
private texture;
|
|
|
private boundUnit;
|
|
|
- constructor(gl: WebGLRenderingContext, image: HTMLImageElement, useMipMaps?: boolean);
|
|
|
+ private useMipMaps;
|
|
|
+ constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement, useMipMaps?: boolean);
|
|
|
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
|
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
|
update(useMipMaps: boolean): void;
|
|
|
+ restore(): void;
|
|
|
bind(unit?: number): void;
|
|
|
unbind(): void;
|
|
|
dispose(): void;
|
|
@@ -1317,22 +1275,22 @@ declare module spine.webgl {
|
|
|
}
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
|
- const M00: number;
|
|
|
- const M01: number;
|
|
|
- const M02: number;
|
|
|
- const M03: number;
|
|
|
- const M10: number;
|
|
|
- const M11: number;
|
|
|
- const M12: number;
|
|
|
- const M13: number;
|
|
|
- const M20: number;
|
|
|
- const M21: number;
|
|
|
- const M22: number;
|
|
|
- const M23: number;
|
|
|
- const M30: number;
|
|
|
- const M31: number;
|
|
|
- const M32: number;
|
|
|
- const M33: number;
|
|
|
+ const M00 = 0;
|
|
|
+ const M01 = 4;
|
|
|
+ const M02 = 8;
|
|
|
+ const M03 = 12;
|
|
|
+ const M10 = 1;
|
|
|
+ const M11 = 5;
|
|
|
+ const M12 = 9;
|
|
|
+ const M13 = 13;
|
|
|
+ const M20 = 2;
|
|
|
+ const M21 = 6;
|
|
|
+ const M22 = 10;
|
|
|
+ const M23 = 14;
|
|
|
+ const M30 = 3;
|
|
|
+ const M31 = 7;
|
|
|
+ const M32 = 11;
|
|
|
+ const M33 = 15;
|
|
|
class Matrix4 {
|
|
|
temp: Float32Array;
|
|
|
values: Float32Array;
|
|
@@ -1358,9 +1316,9 @@ declare module spine.webgl {
|
|
|
}
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
|
- class Mesh implements Disposable {
|
|
|
+ class Mesh implements Disposable, Restorable {
|
|
|
private attributes;
|
|
|
- private gl;
|
|
|
+ private context;
|
|
|
private vertices;
|
|
|
private verticesBuffer;
|
|
|
private verticesLength;
|
|
@@ -1380,7 +1338,7 @@ declare module spine.webgl {
|
|
|
setIndicesLength(length: number): void;
|
|
|
getIndices(): Uint16Array;
|
|
|
getVertexSizeInFloats(): number;
|
|
|
- constructor(gl: WebGLRenderingContext, attributes: VertexAttribute[], maxVertices: number, maxIndices: number);
|
|
|
+ constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, attributes: VertexAttribute[], maxVertices: number, maxIndices: number);
|
|
|
setVertices(vertices: Array<number>): void;
|
|
|
setIndices(indices: Array<number>): void;
|
|
|
draw(shader: Shader, primitiveType: number): void;
|
|
@@ -1388,6 +1346,7 @@ declare module spine.webgl {
|
|
|
bind(shader: Shader): void;
|
|
|
unbind(shader: Shader): void;
|
|
|
private update();
|
|
|
+ restore(): void;
|
|
|
dispose(): void;
|
|
|
}
|
|
|
class VertexAttribute {
|
|
@@ -1417,7 +1376,7 @@ declare module spine.webgl {
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
|
class PolygonBatcher implements Disposable {
|
|
|
- private gl;
|
|
|
+ private context;
|
|
|
private drawCalls;
|
|
|
private isDrawing;
|
|
|
private mesh;
|
|
@@ -1427,7 +1386,7 @@ declare module spine.webgl {
|
|
|
private indicesLength;
|
|
|
private srcBlend;
|
|
|
private dstBlend;
|
|
|
- constructor(gl: WebGLRenderingContext, twoColorTint?: boolean, maxVertices?: number);
|
|
|
+ constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, twoColorTint?: boolean, maxVertices?: number);
|
|
|
begin(shader: Shader): void;
|
|
|
setBlendMode(srcBlend: number, dstBlend: number): void;
|
|
|
draw(texture: GLTexture, vertices: ArrayLike<number>, indices: Array<number>): void;
|
|
@@ -1439,7 +1398,7 @@ declare module spine.webgl {
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
|
class SceneRenderer implements Disposable {
|
|
|
- gl: WebGLRenderingContext;
|
|
|
+ context: ManagedWebGLRenderingContext;
|
|
|
canvas: HTMLCanvasElement;
|
|
|
camera: OrthoCamera;
|
|
|
batcher: PolygonBatcher;
|
|
@@ -1453,7 +1412,7 @@ declare module spine.webgl {
|
|
|
private QUAD;
|
|
|
private QUAD_TRIANGLES;
|
|
|
private WHITE;
|
|
|
- constructor(canvas: HTMLCanvasElement, gl: WebGLRenderingContext, twoColorTint?: boolean);
|
|
|
+ constructor(canvas: HTMLCanvasElement, context: ManagedWebGLRenderingContext | WebGLRenderingContext, twoColorTint?: boolean);
|
|
|
begin(): void;
|
|
|
drawSkeleton(skeleton: Skeleton, premultipliedAlpha?: boolean): void;
|
|
|
drawSkeletonDebug(skeleton: Skeleton, premultipliedAlpha?: boolean, ignoredBones?: Array<string>): void;
|
|
@@ -1480,7 +1439,7 @@ declare module spine.webgl {
|
|
|
}
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
|
- class Shader implements Disposable {
|
|
|
+ class Shader implements Disposable, Restorable {
|
|
|
private vertexShader;
|
|
|
private fragmentShader;
|
|
|
static MVP_MATRIX: string;
|
|
@@ -1489,7 +1448,7 @@ declare module spine.webgl {
|
|
|
static COLOR2: string;
|
|
|
static TEXCOORDS: string;
|
|
|
static SAMPLER: string;
|
|
|
- private gl;
|
|
|
+ private context;
|
|
|
private vs;
|
|
|
private fs;
|
|
|
private program;
|
|
@@ -1499,10 +1458,11 @@ declare module spine.webgl {
|
|
|
getProgram(): WebGLProgram;
|
|
|
getVertexShader(): string;
|
|
|
getFragmentShader(): string;
|
|
|
- constructor(gl: WebGLRenderingContext, vertexShader: string, fragmentShader: string);
|
|
|
+ constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, vertexShader: string, fragmentShader: string);
|
|
|
private compile();
|
|
|
private compileShader(type, source);
|
|
|
private compileProgram(vs, fs);
|
|
|
+ restore(): void;
|
|
|
bind(): void;
|
|
|
unbind(): void;
|
|
|
setUniformi(uniform: string, value: number): void;
|
|
@@ -1516,14 +1476,14 @@ declare module spine.webgl {
|
|
|
getUniformLocation(uniform: string): WebGLUniformLocation;
|
|
|
getAttributeLocation(attribute: string): number;
|
|
|
dispose(): void;
|
|
|
- static newColoredTextured(gl: WebGLRenderingContext): Shader;
|
|
|
- static newTwoColoredTextured(gl: WebGLRenderingContext): Shader;
|
|
|
- static newColored(gl: WebGLRenderingContext): Shader;
|
|
|
+ static newColoredTextured(context: ManagedWebGLRenderingContext | WebGLRenderingContext): Shader;
|
|
|
+ static newTwoColoredTextured(context: ManagedWebGLRenderingContext | WebGLRenderingContext): Shader;
|
|
|
+ static newColored(context: ManagedWebGLRenderingContext | WebGLRenderingContext): Shader;
|
|
|
}
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
|
class ShapeRenderer implements Disposable {
|
|
|
- private gl;
|
|
|
+ private context;
|
|
|
private isDrawing;
|
|
|
private mesh;
|
|
|
private shapeType;
|
|
@@ -1533,7 +1493,7 @@ declare module spine.webgl {
|
|
|
private tmp;
|
|
|
private srcBlend;
|
|
|
private dstBlend;
|
|
|
- constructor(gl: WebGLRenderingContext, maxVertices?: number);
|
|
|
+ constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, maxVertices?: number);
|
|
|
begin(shader: Shader): void;
|
|
|
setBlendMode(srcBlend: number, dstBlend: number): void;
|
|
|
setColor(color: Color): void;
|
|
@@ -1580,13 +1540,13 @@ declare module spine.webgl {
|
|
|
premultipliedAlpha: boolean;
|
|
|
scale: number;
|
|
|
boneWidth: number;
|
|
|
- private gl;
|
|
|
+ private context;
|
|
|
private bounds;
|
|
|
private temp;
|
|
|
private vertices;
|
|
|
private static LIGHT_GRAY;
|
|
|
private static GREEN;
|
|
|
- constructor(gl: WebGLRenderingContext);
|
|
|
+ constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext);
|
|
|
draw(shapes: ShapeRenderer, skeleton: Skeleton, ignoredBones?: Array<string>): void;
|
|
|
dispose(): void;
|
|
|
}
|
|
@@ -1595,7 +1555,6 @@ declare module spine.webgl {
|
|
|
class SkeletonRenderer {
|
|
|
static QUAD_TRIANGLES: number[];
|
|
|
premultipliedAlpha: boolean;
|
|
|
- private gl;
|
|
|
private tempColor;
|
|
|
private tempColor2;
|
|
|
private vertices;
|
|
@@ -1603,7 +1562,7 @@ declare module spine.webgl {
|
|
|
private twoColorTint;
|
|
|
private renderable;
|
|
|
private clipper;
|
|
|
- constructor(gl: WebGLRenderingContext, twoColorTint?: boolean);
|
|
|
+ constructor(context: ManagedWebGLRenderingContext, twoColorTint?: boolean);
|
|
|
draw(batcher: PolygonBatcher, skeleton: Skeleton): void;
|
|
|
}
|
|
|
}
|
|
@@ -1628,14 +1587,69 @@ declare module spine.webgl {
|
|
|
}
|
|
|
}
|
|
|
declare module spine.webgl {
|
|
|
- function getSourceGLBlendMode(gl: WebGLRenderingContext, blendMode: BlendMode, premultipliedAlpha?: boolean): number;
|
|
|
- function getDestGLBlendMode(gl: WebGLRenderingContext, blendMode: BlendMode): number;
|
|
|
+ class ManagedWebGLRenderingContext {
|
|
|
+ canvas: HTMLCanvasElement;
|
|
|
+ gl: WebGLRenderingContext;
|
|
|
+ private restorables;
|
|
|
+ constructor(canvasOrContext: HTMLCanvasElement | WebGLRenderingContext, contextConfig?: any);
|
|
|
+ addRestorable(restorable: Restorable): void;
|
|
|
+ removeRestorable(restorable: Restorable): void;
|
|
|
+ }
|
|
|
+ function getSourceGLBlendMode(blendMode: BlendMode, premultipliedAlpha?: boolean): number;
|
|
|
+ function getDestGLBlendMode(blendMode: BlendMode): number;
|
|
|
+}
|
|
|
+declare module spine.threejs {
|
|
|
+ class AssetManager extends spine.AssetManager {
|
|
|
+ constructor(pathPrefix?: string);
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module spine.threejs {
|
|
|
+ class MeshBatcher {
|
|
|
+ mesh: THREE.Mesh;
|
|
|
+ private static VERTEX_SIZE;
|
|
|
+ private vertexBuffer;
|
|
|
+ private vertices;
|
|
|
+ private verticesLength;
|
|
|
+ private indices;
|
|
|
+ private indicesLength;
|
|
|
+ constructor(mesh: THREE.Mesh, maxVertices?: number);
|
|
|
+ begin(): void;
|
|
|
+ batch(vertices: ArrayLike<number>, verticesLength: number, indices: ArrayLike<number>, indicesLength: number, z?: number): void;
|
|
|
+ end(): void;
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module spine.threejs {
|
|
|
+ class SkeletonMesh extends THREE.Mesh {
|
|
|
+ skeleton: Skeleton;
|
|
|
+ state: AnimationState;
|
|
|
+ zOffset: number;
|
|
|
+ private batcher;
|
|
|
+ private clipper;
|
|
|
+ static QUAD_TRIANGLES: number[];
|
|
|
+ static VERTEX_SIZE: number;
|
|
|
+ private vertices;
|
|
|
+ private tempColor;
|
|
|
+ constructor(skeletonData: SkeletonData);
|
|
|
+ update(deltaTime: number): void;
|
|
|
+ private updateGeometry();
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module spine.threejs {
|
|
|
+ class ThreeJsTexture extends Texture {
|
|
|
+ texture: THREE.Texture;
|
|
|
+ constructor(image: HTMLImageElement);
|
|
|
+ setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
|
+ setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
|
+ dispose(): void;
|
|
|
+ static toThreeJsTextureFilter(filter: TextureFilter): THREE.TextureFilter;
|
|
|
+ static toThreeJsTextureWrap(wrap: TextureWrap): THREE.Wrapping;
|
|
|
+ }
|
|
|
}
|
|
|
declare module spine {
|
|
|
class SpineWidget {
|
|
|
skeleton: Skeleton;
|
|
|
state: AnimationState;
|
|
|
- gl: WebGLRenderingContext;
|
|
|
+ context: spine.webgl.ManagedWebGLRenderingContext;
|
|
|
canvas: HTMLCanvasElement;
|
|
|
debugRenderer: spine.webgl.SkeletonDebugRenderer;
|
|
|
private config;
|