UNPKG

@esotericsoftware/spine-core

Version:
80 lines (79 loc) 4.71 kB
/****************************************************************************** * Spine Runtimes License Agreement * Last updated April 5, 2025. Replaces all prior versions. * * Copyright (c) 2013-2025, Esoteric Software LLC * * Integration of the Spine Runtimes into software or otherwise creating * derivative works of the Spine Runtimes is permitted under the terms and * conditions of Section 2 of the Spine Editor License Agreement: * http://esotericsoftware.com/spine-editor-license * * Otherwise, it is permitted to integrate the Spine Runtimes into software * or otherwise create derivative works of the Spine Runtimes (collectively, * "Products"), provided that each user of the Products must obtain their own * Spine Editor license and redistribution of the Products in any form must * include this license and copyright notice. * * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ import { TextureRegion } from "../Texture.js"; import { Color, NumberArrayLike } from "../Utils.js"; import { VertexAttachment, Attachment } from "./Attachment.js"; import { HasTextureRegion } from "./HasTextureRegion.js"; import { Sequence } from "./Sequence.js"; import { Slot } from "../Slot.js"; /** An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not * supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh. * * See [Mesh attachments](http://esotericsoftware.com/spine-meshes) in the Spine User Guide. */ export declare class MeshAttachment extends VertexAttachment implements HasTextureRegion { region: TextureRegion | null; /** The name of the texture region for this attachment. */ path: string; /** The UV pair for each vertex, normalized within the texture region. */ regionUVs: NumberArrayLike; /** The UV pair for each vertex, normalized within the entire texture. * * See {@link #updateUVs}. */ uvs: NumberArrayLike; /** Triplets of vertex indices which describe the mesh's triangulation. */ triangles: Array<number>; /** The color to tint the mesh. */ color: Color; /** The width of the mesh's image. Available only when nonessential data was exported. */ width: number; /** The height of the mesh's image. Available only when nonessential data was exported. */ height: number; /** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */ hullLength: number; /** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if * nonessential data was exported. Triangulation is not performed at runtime. */ edges: Array<number>; private parentMesh; sequence: Sequence | null; tempColor: Color; constructor(name: string, path: string); /** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or * the {@link #regionUVs} are changed. */ updateRegion(): void; /** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices}, * {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the * parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */ getParentMesh(): MeshAttachment | null; /** @param parentMesh May be null. */ setParentMesh(parentMesh: MeshAttachment): void; copy(): Attachment; computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: NumberArrayLike, offset: number, stride: number): void; /** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/ newLinkedMesh(): MeshAttachment; }