Difference between revisions of "Mesh:getVertex"

m
(Specify that the index is one-based)
Line 9: Line 9:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|index|The index of the vertex you want to retrieve the information for.}}
+
{{param|number|index|The one-based index of the vertex you want to retrieve the information for.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|number|attributecomponent|The first component of the first vertex attribute in the specified vertex.}}
 
{{param|number|attributecomponent|The first component of the first vertex attribute in the specified vertex.}}

Revision as of 02:52, 18 March 2018

Available since LÖVE 0.9.0
This function is not supported in earlier versions.

Gets the properties of a vertex in the Mesh.

Function

Available since LÖVE 0.10.0
This variant is not supported in earlier versions.

Synopsis

attributecomponent, ... = Mesh:getVertex( index )

Arguments

number index
The one-based index of the vertex you want to retrieve the information for.

Returns

number attributecomponent
The first component of the first vertex attribute in the specified vertex.
number ...
Additional components of all vertex attributes in the specified vertex.

Notes

The values are returned in the same order as the vertex attributes in the Mesh's vertex format. A standard Mesh that wasn't created with a custom vertex format will return two position numbers, two texture coordinate numbers, and four color components: x, y, u, v, r, g, b, a.

Function

Gets the vertex components of a Mesh that wasn't created with a custom vertex format.

Synopsis

x, y, u, v, r, g, b, a = Mesh:getVertex( index )

Arguments

number index
The index of the vertex you want to retrieve the information for.

Returns

number x
The position of the vertex on the x-axis.
number y
The position of the vertex on the y-axis.
number u
The horizontal component of the texture coordinate.
number v
The vertical component of the texture coordinate.
number r
The red component of the vertex's color.
number g
The green component of the vertex's color.
number b
The blue component of the vertex's color.
number a
The alpha component of the vertex's color.

See Also


Other Languages