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 in the Spine User Guide.

Constructor

new(name:String)

Methods

setRegion(region:TextureRegion):Void

getRegion():TextureRegion

updateUVs():Void

Calculates {@link #uvs} using {@link #regionUVs} and the {@link #region}. Must be called after changing the region UVs or region.

getTriangles():ShortArray

Triplets of vertex indices which describe the mesh's triangulation.

getRegionUVs():FloatArray

The UV pair for each vertex, normalized within the texture region.

setRegionUVs(regionUVs:FloatArray):Void

Sets the texture coordinates for the region. The values are u,v pairs for each vertex.

getUVs():FloatArray

The UV pair for each vertex, normalized within the entire texture.

See {@link #updateUVs}.

getColor():Color

The color to tint the mesh.

getPath():String

The name of the texture region for this attachment.

getHullLength():Int

The number of entries at the beginning of {@link #vertices} that make up the mesh hull.

setHullLength(hullLength:Int):Void

getEdges():ShortArray

Vertex index pairs describing edges for controlling triangulation, or be null if nonessential data was not exported. Mesh triangles will never cross edges. Triangulation is not performed at runtime.

getWidth():Float

The width of the mesh's image, or zero if nonessential data was not exported.

getHeight():Float

The height of the mesh's image, or zero if nonessential data was not exported.

getParentMesh():MeshAttachment

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).

newLinkedMesh():MeshAttachment

Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh.

Inherited Variables

Inherited Methods

Defined by VertexAttachment

computeWorldVertices(slot:Slot, start:Int, count:Int, worldVertices:FloatArray, offset:Int, stride:Int):Void

Transforms the attachment's local {@link #getVertices()} to world coordinates. If the slot's {@link Slot#getDeform()} is not empty, it is used to deform the vertices.

See World transforms in the Spine Runtimes Guide. @link #getVertices()} value to transform. Each vertex has 2 values, x and y. @link #getWorldVerticesLength()} - start.

Parameters:

start

The index of the first {

count

The number of world vertex values to output. Must be <= {

worldVertices

The output world vertices. Must have a length >= offset + count * stride / 2.

offset

The worldVertices index to begin writing values.

stride

The number of worldVertices entries between the value pairs written.

getDeformAttachment():VertexAttachment

Deform keys for the deform attachment are also applied to this attachment.

Returns:

May be null if no deform keys should be applied.

setDeformAttachment(deformAttachment:VertexAttachment):Void

Parameters:

deformAttachment

May be null if no deform keys should be applied.

getBones():IntArray

The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#getBones()}. Will be null if this attachment has no weights.

setBones(bones:IntArray):Void

Parameters:

bones

May be null if this attachment has no weights.

getVertices():FloatArray

The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are x,y entries for each vertex. For a weighted attachment, the values are x,y,weight entries for each bone affecting each vertex.

getWorldVerticesLength():Int

The maximum number of world vertex values that can be output by {@link #computeWorldVertices(Slot, int, int, float[], int, int)} using the count parameter.

setWorldVerticesLength(worldVerticesLength:Int):Void

getId():Int

Returns a unique ID for this attachment.

copyTo(attachment:VertexAttachment):Void

Does not copy id (generated) or name (set on construction).

Defined by Attachment

getName():String

The attachment's name.