mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-03 22:29:13 +08:00
[ts] Refactored AssetManager and TextureAtlas to be in core/ package for sharing between backends
This commit is contained in:
parent
3b90df58a5
commit
e72c9030eb
685
spine-ts/build/spine-core.d.ts
vendored
685
spine-ts/build/spine-core.d.ts
vendored
@ -1815,688 +1815,3 @@ declare module spine {
|
|||||||
originalHeight: number;
|
originalHeight: number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class AssetManager implements Disposable {
|
|
||||||
private _gl;
|
|
||||||
private _assets;
|
|
||||||
private _errors;
|
|
||||||
private _toLoad;
|
|
||||||
private _loaded;
|
|
||||||
constructor(gl: WebGLRenderingContext);
|
|
||||||
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;
|
|
||||||
get(path: string): string | Texture;
|
|
||||||
remove(path: string): void;
|
|
||||||
removeAll(): void;
|
|
||||||
isLoadingComplete(): boolean;
|
|
||||||
toLoad(): number;
|
|
||||||
loaded(): number;
|
|
||||||
dispose(): void;
|
|
||||||
hasErrors(): boolean;
|
|
||||||
errors(): Map<string>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
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;
|
|
||||||
class Matrix4 {
|
|
||||||
temp: Float32Array;
|
|
||||||
values: Float32Array;
|
|
||||||
constructor();
|
|
||||||
set(values: ArrayLike<number>): Matrix4;
|
|
||||||
transpose(): Matrix4;
|
|
||||||
identity(): Matrix4;
|
|
||||||
invert(): Matrix4;
|
|
||||||
determinant(): number;
|
|
||||||
translate(x: number, y: number, z: number): Matrix4;
|
|
||||||
copy(): Matrix4;
|
|
||||||
projection(near: number, far: number, fovy: number, aspectRatio: number): Matrix4;
|
|
||||||
ortho2d(x: number, y: number, width: number, height: number): Matrix4;
|
|
||||||
ortho(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
|
|
||||||
multiply(matrix: Matrix4): Matrix4;
|
|
||||||
multiplyLeft(matrix: Matrix4): Matrix4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class Mesh implements Disposable {
|
|
||||||
private _attributes;
|
|
||||||
private _gl;
|
|
||||||
private _vertices;
|
|
||||||
private _verticesBuffer;
|
|
||||||
private _verticesLength;
|
|
||||||
private _dirtyVertices;
|
|
||||||
private _indices;
|
|
||||||
private _indicesBuffer;
|
|
||||||
private _indicesLength;
|
|
||||||
private _dirtyIndices;
|
|
||||||
private _elementsPerVertex;
|
|
||||||
attributes(): VertexAttribute[];
|
|
||||||
maxVertices(): number;
|
|
||||||
numVertices(): number;
|
|
||||||
setVerticesLength(length: number): void;
|
|
||||||
vertices(): Float32Array;
|
|
||||||
maxIndices(): number;
|
|
||||||
numIndices(): number;
|
|
||||||
setIndicesLength(length: number): void;
|
|
||||||
indices(): Uint16Array;
|
|
||||||
constructor(gl: WebGLRenderingContext, _attributes: VertexAttribute[], maxVertices: number, maxIndices: number);
|
|
||||||
setVertices(vertices: Array<number>): void;
|
|
||||||
setIndices(indices: Array<number>): void;
|
|
||||||
draw(shader: Shader, primitiveType: number): void;
|
|
||||||
drawWithOffset(shader: Shader, primitiveType: number, offset: number, count: number): void;
|
|
||||||
bind(shader: Shader): void;
|
|
||||||
unbind(shader: Shader): void;
|
|
||||||
private update();
|
|
||||||
dispose(): void;
|
|
||||||
}
|
|
||||||
class VertexAttribute {
|
|
||||||
name: string;
|
|
||||||
type: VertexAttributeType;
|
|
||||||
numElements: number;
|
|
||||||
constructor(name: string, type: VertexAttributeType, numElements: number);
|
|
||||||
}
|
|
||||||
class Position2Attribute extends VertexAttribute {
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
class Position3Attribute extends VertexAttribute {
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
class TexCoordAttribute extends VertexAttribute {
|
|
||||||
constructor(unit?: number);
|
|
||||||
}
|
|
||||||
class ColorAttribute extends VertexAttribute {
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
enum VertexAttributeType {
|
|
||||||
Float = 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class PolygonBatcher {
|
|
||||||
private _gl;
|
|
||||||
private _drawCalls;
|
|
||||||
private _drawing;
|
|
||||||
private _mesh;
|
|
||||||
private _shader;
|
|
||||||
private _lastTexture;
|
|
||||||
private _verticesLength;
|
|
||||||
private _indicesLength;
|
|
||||||
private _srcBlend;
|
|
||||||
private _dstBlend;
|
|
||||||
constructor(gl: WebGLRenderingContext, maxVertices?: number);
|
|
||||||
begin(shader: Shader): void;
|
|
||||||
setBlendMode(srcBlend: number, dstBlend: number): void;
|
|
||||||
draw(texture: Texture, vertices: ArrayLike<number>, indices: Array<number>): void;
|
|
||||||
private flush();
|
|
||||||
end(): void;
|
|
||||||
drawCalls(): number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class Shader implements Disposable {
|
|
||||||
private _vertexShader;
|
|
||||||
private _fragmentShader;
|
|
||||||
static MVP_MATRIX: string;
|
|
||||||
static POSITION: string;
|
|
||||||
static COLOR: string;
|
|
||||||
static TEXCOORDS: string;
|
|
||||||
static SAMPLER: string;
|
|
||||||
private _gl;
|
|
||||||
private _vs;
|
|
||||||
private _fs;
|
|
||||||
private _program;
|
|
||||||
private _tmp2x2;
|
|
||||||
private _tmp3x3;
|
|
||||||
private _tmp4x4;
|
|
||||||
program(): WebGLProgram;
|
|
||||||
vertexShader(): string;
|
|
||||||
fragmentShader(): string;
|
|
||||||
constructor(gl: WebGLRenderingContext, _vertexShader: string, _fragmentShader: string);
|
|
||||||
private compile();
|
|
||||||
private compileShader(type, source);
|
|
||||||
private compileProgram(vs, fs);
|
|
||||||
bind(): void;
|
|
||||||
unbind(): void;
|
|
||||||
setUniformi(uniform: string, value: number): void;
|
|
||||||
setUniformf(uniform: string, value: number): void;
|
|
||||||
setUniform2f(uniform: string, value: number, value2: number): void;
|
|
||||||
setUniform3f(uniform: string, value: number, value2: number, value3: number): void;
|
|
||||||
setUniform4f(uniform: string, value: number, value2: number, value3: number, value4: number): void;
|
|
||||||
setUniform2x2f(uniform: string, value: ArrayLike<number>): void;
|
|
||||||
setUniform3x3f(uniform: string, value: ArrayLike<number>): void;
|
|
||||||
setUniform4x4f(uniform: string, value: ArrayLike<number>): void;
|
|
||||||
getUniformLocation(uniform: string): WebGLUniformLocation;
|
|
||||||
getAttributeLocation(attribute: string): number;
|
|
||||||
dispose(): void;
|
|
||||||
static newColoredTextured(gl: WebGLRenderingContext): Shader;
|
|
||||||
static newColored(gl: WebGLRenderingContext): Shader;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class SkeletonRenderer {
|
|
||||||
static QUAD_TRIANGLES: number[];
|
|
||||||
premultipliedAlpha: boolean;
|
|
||||||
private _gl;
|
|
||||||
constructor(gl: WebGLRenderingContext);
|
|
||||||
draw(batcher: PolygonBatcher, skeleton: Skeleton): void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class Texture implements Disposable {
|
|
||||||
private _gl;
|
|
||||||
private _texture;
|
|
||||||
private _image;
|
|
||||||
private _boundUnit;
|
|
||||||
constructor(gl: WebGLRenderingContext, image: HTMLImageElement, useMipMaps?: boolean);
|
|
||||||
getImage(): HTMLImageElement;
|
|
||||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
||||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
||||||
update(useMipMaps: boolean): void;
|
|
||||||
bind(unit?: number): void;
|
|
||||||
unbind(): void;
|
|
||||||
dispose(): void;
|
|
||||||
static filterFromString(text: string): TextureFilter;
|
|
||||||
static wrapFromString(text: string): TextureWrap;
|
|
||||||
}
|
|
||||||
enum TextureFilter {
|
|
||||||
Nearest,
|
|
||||||
Linear,
|
|
||||||
MipMap,
|
|
||||||
MipMapNearestNearest,
|
|
||||||
MipMapLinearNearest,
|
|
||||||
MipMapNearestLinear,
|
|
||||||
MipMapLinearLinear,
|
|
||||||
}
|
|
||||||
enum TextureWrap {
|
|
||||||
MirroredRepeat,
|
|
||||||
ClampToEdge,
|
|
||||||
Repeat,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class TextureAtlas implements Disposable {
|
|
||||||
pages: TextureAtlasPage[];
|
|
||||||
regions: TextureAtlasRegion[];
|
|
||||||
constructor(atlasText: string, textureLoader: (path: string) => Texture);
|
|
||||||
private load(atlasText, textureLoader);
|
|
||||||
findRegion(name: string): TextureAtlasRegion;
|
|
||||||
dispose(): void;
|
|
||||||
}
|
|
||||||
class TextureAtlasPage {
|
|
||||||
name: string;
|
|
||||||
minFilter: TextureFilter;
|
|
||||||
magFilter: TextureFilter;
|
|
||||||
uWrap: TextureWrap;
|
|
||||||
vWrap: TextureWrap;
|
|
||||||
texture: Texture;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
}
|
|
||||||
class TextureAtlasRegion extends TextureRegion {
|
|
||||||
page: TextureAtlasPage;
|
|
||||||
name: string;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
index: number;
|
|
||||||
rotate: boolean;
|
|
||||||
texture: Texture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class TextureAtlasAttachmentLoader implements AttachmentLoader {
|
|
||||||
atlas: TextureAtlas;
|
|
||||||
constructor(atlas: TextureAtlas);
|
|
||||||
/** @return May be null to not load an attachment. */
|
|
||||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
|
||||||
/** @return May be null to not load an attachment. */
|
|
||||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
|
||||||
/** @return May be null to not load an attachment. */
|
|
||||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
|
||||||
/** @return May be null to not load an attachment */
|
|
||||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class Vector3 {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
z: number;
|
|
||||||
set(x: number, y: number, z: number): Vector3;
|
|
||||||
add(v: Vector3): Vector3;
|
|
||||||
sub(v: Vector3): Vector3;
|
|
||||||
scale(s: number): Vector3;
|
|
||||||
normalize(): Vector3;
|
|
||||||
cross(v: Vector3): Vector3;
|
|
||||||
multiply(matrix: Matrix4): Vector3;
|
|
||||||
project(matrix: Matrix4): Vector3;
|
|
||||||
dot(v: Vector3): number;
|
|
||||||
length(): number;
|
|
||||||
distance(v: Vector3): number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
function getSourceGLBlendMode(gl: WebGLRenderingContext, blendMode: BlendMode, premultipliedAlpha?: boolean): number;
|
|
||||||
function getDestGLBlendMode(gl: WebGLRenderingContext, blendMode: BlendMode): number;
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine {
|
|
||||||
class SpineWidget {
|
|
||||||
skeleton: Skeleton;
|
|
||||||
state: AnimationState;
|
|
||||||
gl: WebGLRenderingContext;
|
|
||||||
canvas: HTMLCanvasElement;
|
|
||||||
private _config;
|
|
||||||
private _assetManager;
|
|
||||||
private _shader;
|
|
||||||
private _batcher;
|
|
||||||
private _mvp;
|
|
||||||
private _skeletonRenderer;
|
|
||||||
private _paused;
|
|
||||||
private _lastFrameTime;
|
|
||||||
private _backgroundColor;
|
|
||||||
private _loaded;
|
|
||||||
constructor(element: Element | string, config: SpineWidgetConfig);
|
|
||||||
private validateConfig(config);
|
|
||||||
private load();
|
|
||||||
private render();
|
|
||||||
pause(): void;
|
|
||||||
play(): void;
|
|
||||||
isPlaying(): boolean;
|
|
||||||
setAnimation(animationName: string): void;
|
|
||||||
static loadWidgets(): void;
|
|
||||||
static loadWidget(widget: Element): void;
|
|
||||||
static pageLoaded: boolean;
|
|
||||||
private static ready();
|
|
||||||
static setupDOMListener(): void;
|
|
||||||
}
|
|
||||||
class SpineWidgetConfig {
|
|
||||||
json: string;
|
|
||||||
atlas: string;
|
|
||||||
animation: string;
|
|
||||||
imagesPath: string;
|
|
||||||
skin: string;
|
|
||||||
loop: boolean;
|
|
||||||
scale: number;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
backgroundColor: string;
|
|
||||||
premultipliedAlpha: boolean;
|
|
||||||
success: (widget: SpineWidget) => void;
|
|
||||||
error: (widget: SpineWidget, msg: string) => void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
362
spine-ts/build/spine-webgl.d.ts
vendored
362
spine-ts/build/spine-webgl.d.ts
vendored
@ -354,6 +354,57 @@ declare module spine {
|
|||||||
getMix(from: Animation, to: Animation): number;
|
getMix(from: Animation, to: Animation): number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/******************************************************************************
|
||||||
|
* Spine Runtimes Software License
|
||||||
|
* Version 2.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.
|
||||||
|
*****************************************************************************/
|
||||||
|
declare module spine.webgl {
|
||||||
|
class AssetManager implements Disposable {
|
||||||
|
private _textureLoader;
|
||||||
|
private _assets;
|
||||||
|
private _errors;
|
||||||
|
private _toLoad;
|
||||||
|
private _loaded;
|
||||||
|
constructor(textureLoader: (image: HTMLImageElement) => any);
|
||||||
|
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;
|
||||||
|
get(path: string): any;
|
||||||
|
remove(path: string): void;
|
||||||
|
removeAll(): void;
|
||||||
|
isLoadingComplete(): boolean;
|
||||||
|
toLoad(): number;
|
||||||
|
loaded(): number;
|
||||||
|
dispose(): void;
|
||||||
|
hasErrors(): boolean;
|
||||||
|
errors(): Map<string>;
|
||||||
|
}
|
||||||
|
}
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes Software License
|
* Spine Runtimes Software License
|
||||||
* Version 2.5
|
* Version 2.5
|
||||||
@ -1206,6 +1257,91 @@ declare module spine {
|
|||||||
constructor(index: number, name: string, boneData: BoneData);
|
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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/******************************************************************************
|
||||||
|
* Spine Runtimes Software License
|
||||||
|
* Version 2.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.
|
||||||
|
*****************************************************************************/
|
||||||
|
declare module spine.webgl {
|
||||||
|
class TextureAtlas implements Disposable {
|
||||||
|
pages: TextureAtlasPage[];
|
||||||
|
regions: TextureAtlasRegion[];
|
||||||
|
constructor(atlasText: string, textureLoader: (path: string, minFilter: TextureFilter, magFilter: TextureFilter, uWrap: TextureWrap, vWrap: TextureWrap) => any);
|
||||||
|
private load(atlasText, textureLoader);
|
||||||
|
findRegion(name: string): TextureAtlasRegion;
|
||||||
|
dispose(): void;
|
||||||
|
}
|
||||||
|
class TextureAtlasPage {
|
||||||
|
name: string;
|
||||||
|
minFilter: TextureFilter;
|
||||||
|
magFilter: TextureFilter;
|
||||||
|
uWrap: TextureWrap;
|
||||||
|
vWrap: TextureWrap;
|
||||||
|
texture: Texture;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
}
|
||||||
|
class TextureAtlasRegion extends TextureRegion {
|
||||||
|
page: TextureAtlasPage;
|
||||||
|
name: string;
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
index: number;
|
||||||
|
rotate: boolean;
|
||||||
|
texture: Texture;
|
||||||
|
}
|
||||||
|
}
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes Software License
|
* Spine Runtimes Software License
|
||||||
* Version 2.5
|
* Version 2.5
|
||||||
@ -1846,24 +1982,17 @@ declare module spine {
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
declare module spine.webgl {
|
declare module spine.webgl {
|
||||||
class AssetManager implements Disposable {
|
class GLTexture extends Texture implements Disposable {
|
||||||
private _gl;
|
private _gl;
|
||||||
private _assets;
|
private _texture;
|
||||||
private _errors;
|
private _boundUnit;
|
||||||
private _toLoad;
|
constructor(gl: WebGLRenderingContext, image: HTMLImageElement, useMipMaps?: boolean);
|
||||||
private _loaded;
|
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||||
constructor(gl: WebGLRenderingContext);
|
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||||
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
|
update(useMipMaps: boolean): void;
|
||||||
loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
|
bind(unit?: number): void;
|
||||||
get(path: string): string | Texture;
|
unbind(): void;
|
||||||
remove(path: string): void;
|
|
||||||
removeAll(): void;
|
|
||||||
isLoadingComplete(): boolean;
|
|
||||||
toLoad(): number;
|
|
||||||
loaded(): number;
|
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
hasErrors(): boolean;
|
|
||||||
errors(): Map<string>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@ -2060,7 +2189,7 @@ declare module spine.webgl {
|
|||||||
constructor(gl: WebGLRenderingContext, maxVertices?: number);
|
constructor(gl: WebGLRenderingContext, maxVertices?: number);
|
||||||
begin(shader: Shader): void;
|
begin(shader: Shader): void;
|
||||||
setBlendMode(srcBlend: number, dstBlend: number): void;
|
setBlendMode(srcBlend: number, dstBlend: number): void;
|
||||||
draw(texture: Texture, vertices: ArrayLike<number>, indices: Array<number>): void;
|
draw(texture: GLTexture, vertices: ArrayLike<number>, indices: Array<number>): void;
|
||||||
private flush();
|
private flush();
|
||||||
end(): void;
|
end(): void;
|
||||||
drawCalls(): number;
|
drawCalls(): number;
|
||||||
@ -2175,127 +2304,6 @@ declare module spine.webgl {
|
|||||||
draw(batcher: PolygonBatcher, skeleton: Skeleton): void;
|
draw(batcher: PolygonBatcher, skeleton: Skeleton): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class Texture implements Disposable {
|
|
||||||
private _gl;
|
|
||||||
private _texture;
|
|
||||||
private _image;
|
|
||||||
private _boundUnit;
|
|
||||||
constructor(gl: WebGLRenderingContext, image: HTMLImageElement, useMipMaps?: boolean);
|
|
||||||
getImage(): HTMLImageElement;
|
|
||||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
||||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
||||||
update(useMipMaps: boolean): void;
|
|
||||||
bind(unit?: number): void;
|
|
||||||
unbind(): void;
|
|
||||||
dispose(): void;
|
|
||||||
static filterFromString(text: string): TextureFilter;
|
|
||||||
static wrapFromString(text: string): TextureWrap;
|
|
||||||
}
|
|
||||||
enum TextureFilter {
|
|
||||||
Nearest,
|
|
||||||
Linear,
|
|
||||||
MipMap,
|
|
||||||
MipMapNearestNearest,
|
|
||||||
MipMapLinearNearest,
|
|
||||||
MipMapNearestLinear,
|
|
||||||
MipMapLinearLinear,
|
|
||||||
}
|
|
||||||
enum TextureWrap {
|
|
||||||
MirroredRepeat,
|
|
||||||
ClampToEdge,
|
|
||||||
Repeat,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine.webgl {
|
|
||||||
class TextureAtlas implements Disposable {
|
|
||||||
pages: TextureAtlasPage[];
|
|
||||||
regions: TextureAtlasRegion[];
|
|
||||||
constructor(atlasText: string, textureLoader: (path: string) => Texture);
|
|
||||||
private load(atlasText, textureLoader);
|
|
||||||
findRegion(name: string): TextureAtlasRegion;
|
|
||||||
dispose(): void;
|
|
||||||
}
|
|
||||||
class TextureAtlasPage {
|
|
||||||
name: string;
|
|
||||||
minFilter: TextureFilter;
|
|
||||||
magFilter: TextureFilter;
|
|
||||||
uWrap: TextureWrap;
|
|
||||||
vWrap: TextureWrap;
|
|
||||||
texture: Texture;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
}
|
|
||||||
class TextureAtlasRegion extends TextureRegion {
|
|
||||||
page: TextureAtlasPage;
|
|
||||||
name: string;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
index: number;
|
|
||||||
rotate: boolean;
|
|
||||||
texture: Texture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes Software License
|
* Spine Runtimes Software License
|
||||||
* Version 2.5
|
* Version 2.5
|
||||||
@ -2422,81 +2430,3 @@ declare module spine.webgl {
|
|||||||
function getSourceGLBlendMode(gl: WebGLRenderingContext, blendMode: BlendMode, premultipliedAlpha?: boolean): number;
|
function getSourceGLBlendMode(gl: WebGLRenderingContext, blendMode: BlendMode, premultipliedAlpha?: boolean): number;
|
||||||
function getDestGLBlendMode(gl: WebGLRenderingContext, blendMode: BlendMode): number;
|
function getDestGLBlendMode(gl: WebGLRenderingContext, blendMode: BlendMode): number;
|
||||||
}
|
}
|
||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License
|
|
||||||
* Version 2.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.
|
|
||||||
*****************************************************************************/
|
|
||||||
declare module spine {
|
|
||||||
class SpineWidget {
|
|
||||||
skeleton: Skeleton;
|
|
||||||
state: AnimationState;
|
|
||||||
gl: WebGLRenderingContext;
|
|
||||||
canvas: HTMLCanvasElement;
|
|
||||||
private _config;
|
|
||||||
private _assetManager;
|
|
||||||
private _shader;
|
|
||||||
private _batcher;
|
|
||||||
private _mvp;
|
|
||||||
private _skeletonRenderer;
|
|
||||||
private _paused;
|
|
||||||
private _lastFrameTime;
|
|
||||||
private _backgroundColor;
|
|
||||||
private _loaded;
|
|
||||||
constructor(element: Element | string, config: SpineWidgetConfig);
|
|
||||||
private validateConfig(config);
|
|
||||||
private load();
|
|
||||||
private render();
|
|
||||||
pause(): void;
|
|
||||||
play(): void;
|
|
||||||
isPlaying(): boolean;
|
|
||||||
setAnimation(animationName: string): void;
|
|
||||||
static loadWidgets(): void;
|
|
||||||
static loadWidget(widget: Element): void;
|
|
||||||
static pageLoaded: boolean;
|
|
||||||
private static ready();
|
|
||||||
static setupDOMListener(): void;
|
|
||||||
}
|
|
||||||
class SpineWidgetConfig {
|
|
||||||
json: string;
|
|
||||||
atlas: string;
|
|
||||||
animation: string;
|
|
||||||
imagesPath: string;
|
|
||||||
skin: string;
|
|
||||||
loop: boolean;
|
|
||||||
scale: number;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
backgroundColor: string;
|
|
||||||
premultipliedAlpha: boolean;
|
|
||||||
success: (widget: SpineWidget) => void;
|
|
||||||
error: (widget: SpineWidget, msg: string) => void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
12
spine-ts/canvas/example/index.html
Normal file
12
spine-ts/canvas/example/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<html>
|
||||||
|
<script src="../../build/spine-canvas.js"></script>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
|
||||||
|
<body>
|
||||||
|
<center>
|
||||||
|
<canvas id="canvas" style="width: 640; height: 480"></canvas>
|
||||||
|
</center>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
5
spine-ts/canvas/src/SkeletonRenderer.js
Normal file
5
spine-ts/canvas/src/SkeletonRenderer.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module spine.canvas {
|
||||||
|
export class SkeletonRenderer {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -31,14 +31,14 @@
|
|||||||
|
|
||||||
module spine.webgl {
|
module spine.webgl {
|
||||||
export class AssetManager implements Disposable {
|
export class AssetManager implements Disposable {
|
||||||
private _gl: WebGLRenderingContext;
|
private _textureLoader: (image: HTMLImageElement) => any;
|
||||||
private _assets: Map<string | Texture> = {};
|
private _assets: Map<any> = {};
|
||||||
private _errors: Map<string> = {};
|
private _errors: Map<string> = {};
|
||||||
private _toLoad = 0;
|
private _toLoad = 0;
|
||||||
private _loaded = 0;
|
private _loaded = 0;
|
||||||
|
|
||||||
constructor (gl: WebGLRenderingContext) {
|
constructor (textureLoader: (image: HTMLImageElement) => any) {
|
||||||
this._gl = gl;
|
this._textureLoader = textureLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadText(path: string,
|
loadText(path: string,
|
||||||
@ -73,7 +73,7 @@ module spine.webgl {
|
|||||||
img.src = path;
|
img.src = path;
|
||||||
img.onload = (ev) => {
|
img.onload = (ev) => {
|
||||||
if (success) success(path, img);
|
if (success) success(path, img);
|
||||||
let texture = new Texture(this._gl, img);
|
let texture = this._textureLoader(img);
|
||||||
this._assets[path] = texture;
|
this._assets[path] = texture;
|
||||||
this._toLoad--;
|
this._toLoad--;
|
||||||
this._loaded++;
|
this._loaded++;
|
||||||
@ -92,16 +92,14 @@ module spine.webgl {
|
|||||||
|
|
||||||
remove (path: string) {
|
remove (path: string) {
|
||||||
let asset = this._assets[path];
|
let asset = this._assets[path];
|
||||||
if (asset instanceof Texture) {
|
if ((<any>asset).dispose) (<any>asset).dispose();
|
||||||
asset.dispose();
|
|
||||||
}
|
|
||||||
this._assets[path] = null;
|
this._assets[path] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAll () {
|
removeAll () {
|
||||||
for (let key in this._assets) {
|
for (let key in this._assets) {
|
||||||
let asset = this._assets[key];
|
let asset = this._assets[key];
|
||||||
if (asset instanceof Texture) asset.dispose();
|
if ((<any>asset).dispose) (<any>asset).dispose();
|
||||||
}
|
}
|
||||||
this._assets = {};
|
this._assets = {};
|
||||||
}
|
}
|
||||||
56
spine-ts/core/src/Texture.ts
Normal file
56
spine-ts/core/src/Texture.ts
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
module spine {
|
||||||
|
export abstract class Texture {
|
||||||
|
protected _image: HTMLImageElement;
|
||||||
|
|
||||||
|
constructor (image: HTMLImageElement) {
|
||||||
|
this._image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
getImage (): HTMLImageElement {
|
||||||
|
return this._image;
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract setFilters (minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||||
|
abstract setWraps (uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||||
|
abstract dispose (): void;
|
||||||
|
|
||||||
|
|
||||||
|
public static filterFromString (text: string): TextureFilter {
|
||||||
|
switch (text.toLowerCase()) {
|
||||||
|
case "nearest": return TextureFilter.Nearest;
|
||||||
|
case "linear": return TextureFilter.Linear;
|
||||||
|
case "mipmap": return TextureFilter.MipMap;
|
||||||
|
case "mipmapnearestnearest": return TextureFilter.MipMapNearestNearest;
|
||||||
|
case "mipmaplinearnearest": return TextureFilter.MipMapLinearNearest;
|
||||||
|
case "mipmapnearestlinear": return TextureFilter.MipMapNearestLinear;
|
||||||
|
case "mipmaplinearlinear": return TextureFilter.MipMapLinearLinear;
|
||||||
|
default: throw new Error(`Unknown texture filter ${text}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static wrapFromString (text: string): TextureWrap {
|
||||||
|
switch (text.toLowerCase()) {
|
||||||
|
case "mirroredtepeat": return TextureWrap.MirroredRepeat;
|
||||||
|
case "clamptoedge": return TextureWrap.ClampToEdge;
|
||||||
|
case "repeat": return TextureWrap.Repeat;
|
||||||
|
default: throw new Error(`Unknown texture wrap ${text}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum TextureFilter {
|
||||||
|
Nearest = 9728, // WebGLRenderingContext.NEAREST
|
||||||
|
Linear = 9729, // WebGLRenderingContext.LINEAR
|
||||||
|
MipMap = 9987, // WebGLRenderingContext.LINEAR_MIPMAP_LINEAR
|
||||||
|
MipMapNearestNearest = 9984, // WebGLRenderingContext.NEAREST_MIPMAP_NEAREST
|
||||||
|
MipMapLinearNearest = 9985, // WebGLRenderingContext.LINEAR_MIPMAP_NEAREST
|
||||||
|
MipMapNearestLinear = 9986, // WebGLRenderingContext.NEAREST_MIPMAP_LINEAR
|
||||||
|
MipMapLinearLinear = 9987 // WebGLRenderingContext.LINEAR_MIPMAP_LINEAR
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum TextureWrap {
|
||||||
|
MirroredRepeat = 33648, // WebGLRenderingContext.MIRRORED_REPEAT
|
||||||
|
ClampToEdge = 33071, // WebGLRenderingContext.CLAMP_TO_EDGE
|
||||||
|
Repeat = 10497 // WebGLRenderingContext.REPEAT
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -34,11 +34,11 @@ module spine.webgl {
|
|||||||
pages = new Array<TextureAtlasPage>();
|
pages = new Array<TextureAtlasPage>();
|
||||||
regions = new Array<TextureAtlasRegion>();
|
regions = new Array<TextureAtlasRegion>();
|
||||||
|
|
||||||
constructor (atlasText: string, textureLoader: (path: string) => Texture) {
|
constructor (atlasText: string, textureLoader: (path: string, minFilter: TextureFilter, magFilter: TextureFilter, uWrap: TextureWrap, vWrap: TextureWrap) => any) {
|
||||||
this.load(atlasText, textureLoader);
|
this.load(atlasText, textureLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private load (atlasText: string, textureLoader: (path: string) => Texture) {
|
private load (atlasText: string, textureLoader: (path: string, minFilter: TextureFilter, magFilter: TextureFilter, uWrap: TextureWrap, vWrap: TextureWrap) => any) {
|
||||||
if (textureLoader == null)
|
if (textureLoader == null)
|
||||||
throw new Error("textureLoader cannot be null.");
|
throw new Error("textureLoader cannot be null.");
|
||||||
|
|
||||||
@ -77,9 +77,7 @@ module spine.webgl {
|
|||||||
else if (direction == "xy")
|
else if (direction == "xy")
|
||||||
page.uWrap = page.vWrap = TextureWrap.Repeat;
|
page.uWrap = page.vWrap = TextureWrap.Repeat;
|
||||||
|
|
||||||
page.texture = textureLoader(line);
|
page.texture = textureLoader(line, page.minFilter, page.magFilter, page.uWrap, page.vWrap);
|
||||||
page.texture.setFilters(page.minFilter, page.magFilter);
|
|
||||||
page.texture.setWraps(page.uWrap, page.vWrap);
|
|
||||||
page.width = page.texture.getImage().width;
|
page.width = page.texture.getImage().width;
|
||||||
page.height = page.texture.getImage().height;
|
page.height = page.texture.getImage().height;
|
||||||
this.pages.push(page);
|
this.pages.push(page);
|
||||||
@ -13,11 +13,8 @@
|
|||||||
"canvas/src/**/*"
|
"canvas/src/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"webgl/src/*.ts",
|
"webgl",
|
||||||
"widget/src/*.ts",
|
"widget",
|
||||||
"build",
|
"build"
|
||||||
"build/*.d.ts",
|
|
||||||
"build/*.js",
|
|
||||||
"build/*.js.map"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -12,9 +12,8 @@
|
|||||||
"core/src/**/*"
|
"core/src/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"webgl/src/*.ts",
|
"webgl",
|
||||||
"widget/src/*.ts",
|
"widget",
|
||||||
"build",
|
"build"
|
||||||
"build/*.d.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -10,13 +10,11 @@
|
|||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"core/src/**/*",
|
"core/src/**/*",
|
||||||
|
"canvas/src/**/*",
|
||||||
"webgl/src/**/*",
|
"webgl/src/**/*",
|
||||||
"widget/src/**/*"
|
"widget/src/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"build",
|
"build"
|
||||||
"build/*.js",
|
|
||||||
"build/*.d.ts",
|
|
||||||
"build/*.js.map"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -13,9 +13,8 @@
|
|||||||
"webgl/src/**/*"
|
"webgl/src/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"build",
|
"canvas",
|
||||||
"build/*.d.ts",
|
"widget",
|
||||||
"build/*.js",
|
"build"
|
||||||
"build/*.js.map"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -14,9 +14,7 @@
|
|||||||
"widget/src/**/*"
|
"widget/src/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"build",
|
"canvas",
|
||||||
"build/*.d.ts",
|
"build"
|
||||||
"build/*.js",
|
|
||||||
"build/*.js.map"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -78,8 +78,10 @@ function loadSkeleton (name, scale, initialAnimation, positionX, positionY, prem
|
|||||||
|
|
||||||
// Load the texture atlas using name.atlas and name.png from the AssetManager.
|
// Load the texture atlas using name.atlas and name.png from the AssetManager.
|
||||||
// The function passed to TextureAtlas is used to resolve relative paths.
|
// The function passed to TextureAtlas is used to resolve relative paths.
|
||||||
atlas = new spine.webgl.TextureAtlas(assetManager.get("assets/" + name + ".atlas"), function(path) {
|
atlas = new spine.webgl.TextureAtlas(assetManager.get("assets/" + name + ".atlas"), function(path, minFilter, magFilter, uWrap, vWrap) {
|
||||||
return assetManager.get("assets/" + path);
|
var texture = assetManager.get("assets/" + path);
|
||||||
|
texture.setFilters(minFilter, magFilter);
|
||||||
|
texture.setWraps(uWrap, vWrap);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a TextureAtlasAttachmentLoader, which is specific to the WebGL backend.
|
// Create a TextureAtlasAttachmentLoader, which is specific to the WebGL backend.
|
||||||
|
|||||||
@ -30,23 +30,18 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
module spine.webgl {
|
module spine.webgl {
|
||||||
export class Texture implements Disposable {
|
export class GLTexture extends Texture implements Disposable {
|
||||||
private _gl: WebGLRenderingContext;
|
private _gl: WebGLRenderingContext;
|
||||||
private _texture: WebGLTexture;
|
private _texture: WebGLTexture;
|
||||||
private _image: HTMLImageElement;
|
|
||||||
private _boundUnit = 0;
|
private _boundUnit = 0;
|
||||||
|
|
||||||
constructor (gl: WebGLRenderingContext, image: HTMLImageElement, useMipMaps: boolean = false) {
|
constructor (gl: WebGLRenderingContext, image: HTMLImageElement, useMipMaps: boolean = false) {
|
||||||
|
super(image);
|
||||||
this._gl = gl;
|
this._gl = gl;
|
||||||
this._texture = gl.createTexture();
|
this._texture = gl.createTexture();
|
||||||
this._image = image;
|
|
||||||
this.update(useMipMaps);
|
this.update(useMipMaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
getImage (): HTMLImageElement {
|
|
||||||
return this._image;
|
|
||||||
}
|
|
||||||
|
|
||||||
setFilters (minFilter: TextureFilter, magFilter: TextureFilter) {
|
setFilters (minFilter: TextureFilter, magFilter: TextureFilter) {
|
||||||
let gl = this._gl;
|
let gl = this._gl;
|
||||||
this.bind();
|
this.bind();
|
||||||
@ -89,43 +84,5 @@ module spine.webgl {
|
|||||||
let gl = this._gl;
|
let gl = this._gl;
|
||||||
gl.deleteTexture(this._texture);
|
gl.deleteTexture(this._texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static filterFromString (text: string): TextureFilter {
|
|
||||||
switch (text.toLowerCase()) {
|
|
||||||
case "nearest": return TextureFilter.Nearest;
|
|
||||||
case "linear": return TextureFilter.Linear;
|
|
||||||
case "mipmap": return TextureFilter.MipMap;
|
|
||||||
case "mipmapnearestnearest": return TextureFilter.MipMapNearestNearest;
|
|
||||||
case "mipmaplinearnearest": return TextureFilter.MipMapLinearNearest;
|
|
||||||
case "mipmapnearestlinear": return TextureFilter.MipMapNearestLinear;
|
|
||||||
case "mipmaplinearlinear": return TextureFilter.MipMapLinearLinear;
|
|
||||||
default: throw new Error(`Unknown texture filter ${text}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static wrapFromString (text: string): TextureWrap {
|
|
||||||
switch (text.toLowerCase()) {
|
|
||||||
case "mirroredtepeat": return TextureWrap.MirroredRepeat;
|
|
||||||
case "clamptoedge": return TextureWrap.ClampToEdge;
|
|
||||||
case "repeat": return TextureWrap.Repeat;
|
|
||||||
default: throw new Error(`Unknown texture wrap ${text}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum TextureFilter {
|
|
||||||
Nearest = WebGLRenderingContext.NEAREST,
|
|
||||||
Linear = WebGLRenderingContext.LINEAR,
|
|
||||||
MipMap = WebGLRenderingContext.LINEAR_MIPMAP_LINEAR,
|
|
||||||
MipMapNearestNearest = WebGLRenderingContext.NEAREST_MIPMAP_NEAREST,
|
|
||||||
MipMapLinearNearest = WebGLRenderingContext.LINEAR_MIPMAP_NEAREST,
|
|
||||||
MipMapNearestLinear = WebGLRenderingContext.NEAREST_MIPMAP_LINEAR,
|
|
||||||
MipMapLinearLinear = WebGLRenderingContext.LINEAR_MIPMAP_LINEAR
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum TextureWrap {
|
|
||||||
MirroredRepeat = WebGLRenderingContext.MIRRORED_REPEAT,
|
|
||||||
ClampToEdge = WebGLRenderingContext.CLAMP_TO_EDGE,
|
|
||||||
Repeat = WebGLRenderingContext.REPEAT
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ module spine.webgl {
|
|||||||
private _drawing = false;
|
private _drawing = false;
|
||||||
private _mesh: Mesh;
|
private _mesh: Mesh;
|
||||||
private _shader: Shader = null;
|
private _shader: Shader = null;
|
||||||
private _lastTexture: Texture = null;
|
private _lastTexture: GLTexture = null;
|
||||||
private _verticesLength = 0;
|
private _verticesLength = 0;
|
||||||
private _indicesLength = 0;
|
private _indicesLength = 0;
|
||||||
private _srcBlend: number = WebGLRenderingContext.SRC_ALPHA;
|
private _srcBlend: number = WebGLRenderingContext.SRC_ALPHA;
|
||||||
@ -70,7 +70,7 @@ module spine.webgl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
draw (texture: Texture, vertices: ArrayLike<number>, indices: Array<number>) {
|
draw (texture: GLTexture, vertices: ArrayLike<number>, indices: Array<number>) {
|
||||||
if (texture != this._lastTexture) {
|
if (texture != this._lastTexture) {
|
||||||
this.flush();
|
this.flush();
|
||||||
this._lastTexture = texture;
|
this._lastTexture = texture;
|
||||||
|
|||||||
@ -50,18 +50,18 @@ module spine.webgl {
|
|||||||
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
||||||
let slot = drawOrder[i];
|
let slot = drawOrder[i];
|
||||||
let attachment = slot.getAttachment();
|
let attachment = slot.getAttachment();
|
||||||
let texture: Texture = null;
|
let texture: GLTexture = null;
|
||||||
if (attachment instanceof RegionAttachment) {
|
if (attachment instanceof RegionAttachment) {
|
||||||
let region = <RegionAttachment>attachment;
|
let region = <RegionAttachment>attachment;
|
||||||
vertices = region.updateWorldVertices(slot, premultipliedAlpha);
|
vertices = region.updateWorldVertices(slot, premultipliedAlpha);
|
||||||
triangles = SkeletonRenderer.QUAD_TRIANGLES;
|
triangles = SkeletonRenderer.QUAD_TRIANGLES;
|
||||||
texture = (<TextureAtlasRegion>region.region.renderObject).texture;
|
texture = <GLTexture>(<TextureAtlasRegion>region.region.renderObject).texture;
|
||||||
|
|
||||||
} else if (attachment instanceof MeshAttachment) {
|
} else if (attachment instanceof MeshAttachment) {
|
||||||
let mesh = <MeshAttachment>attachment;
|
let mesh = <MeshAttachment>attachment;
|
||||||
vertices = mesh.updateWorldVertices(slot, premultipliedAlpha);
|
vertices = mesh.updateWorldVertices(slot, premultipliedAlpha);
|
||||||
triangles = mesh.triangles;
|
triangles = mesh.triangles;
|
||||||
texture = (<TextureAtlasRegion>mesh.region.renderObject).texture;
|
texture = <GLTexture>(<TextureAtlasRegion>mesh.region.renderObject).texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture != null) {
|
if (texture != null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user