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)

Variables

@:value(new Color(1, 1, 1, 1))color:Color = new Color(1, 1, 1, 1)

The color to tint the mesh.

edges:Null<Array<Int>>

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.

height:Float

The height of the mesh's image. Available only when nonessential data was exported.

hullLength:Int

The number of entries at the beginning of vertices that make up the mesh hull.

path:String

The name of the texture region for this attachment.

regionUVs:Array<Float>

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

triangles:Array<Int>

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

uvs:Array<Float>

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

See updateUVs.

width:Float

The width of the mesh's image. Available only when nonessential data was exported.

Methods

inlinegetParentMesh():Null<MeshAttachment>

The parent mesh if this is a linked mesh, else null. A linked mesh shares the bones, vertices, regionUVs, triangles, hullLength, edges, width, and height with the parent mesh, but may have a different name or path (and therefore a different texture).

newLinkedMesh():MeshAttachment

Returns a new mesh with the parentMesh set to this mesh's parent mesh, if any, else to this mesh.

setParentMesh(parentMesh:Null<MeshAttachment>):Void

updateUVs():Void

Calculates uvs using regionUVs and the region. Must be called after changing the region UVs or region.

Inherited Variables

Defined by VertexAttachment

bones:Null<Array<Int>>

The bones which affect the vertices. 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 Skeleton.bones. Will be null if this attachment has no weights.

deformAttachment:Null<VertexAttachment>

Deform keys for the deform attachment are also applied to this attachment. May be null if no deform keys should be applied.

@:value((VertexAttachment.nextID++ & 65535) << 11)finalid:Int = (VertexAttachment.nextID++ & 65535) << 11

The unique ID for this attachment.

vertices:Array<Float>

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.

@:value(0)worldVerticesLength:Int = 0

The maximum number of world vertex values that can be output by computeWorldVertices using the count parameter.

Defined by Attachment

finalname:String

Inherited Methods

Defined by VertexAttachment

computeWorldVertices(slot:Slot, start:Int, count:Int, worldVertices:Array<Float>, offset:Int, stride:Int):Void

Transforms the attachment's local vertices to world coordinates. If the slot's Slot.deform is not empty, it is used to deform the vertices.

See World transforms in the Spine Runtimes Guide.

Parameters:

start

The index of the first vertices value to transform. Each vertex has 2 values, x and y.

count

The number of world vertex values to output. Must be <= worldVerticesLength - start.

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.