Difference between revisions of "Mesh:setVertex"

m
m (Specify that indices are one-based)
Line 9: Line 9:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|index|The index of the the vertex you want to modify.}}
+
{{param|number|index|The index of the the vertex you want to modify (one-based).}}
 
{{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.}}
 
{{param|number|...|Additional components of all vertex attributes in the specified vertex.}}
 
{{param|number|...|Additional components of all vertex attributes in the specified vertex.}}
Line 26: Line 26:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|index|The index of the the vertex you want to modify.}}
+
{{param|number|index|The index of the the vertex you want to modify (one-based).}}
 
{{param|table|vertex|A table with vertex information, in the form of <code>{attributecomponent, ...}</code>.}}
 
{{param|table|vertex|A table with vertex information, in the form of <code>{attributecomponent, ...}</code>.}}
 
{{subparam|number|attributecomponent|The first component of the first vertex attribute in the specified vertex.}}
 
{{subparam|number|attributecomponent|The first component of the first vertex attribute in the specified vertex.}}
Line 44: Line 44:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|index|The index of the the vertex you want to modify.}}
+
{{param|number|index|The index of the the vertex you want to modify (one-based).}}
 
{{param|number|x|The position of the vertex on the x-axis.}}
 
{{param|number|x|The position of the vertex on the x-axis.}}
 
{{param|number|y|The position of the vertex on the y-axis.}}
 
{{param|number|y|The position of the vertex on the y-axis.}}
Line 63: Line 63:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|index|The index of the the vertex you want to modify.}}
+
{{param|number|index|The index of the the vertex you want to modify (one-based).}}
 
{{param|table|vertex|A table with vertex information.}}
 
{{param|table|vertex|A table with vertex information.}}
 
{{subparam|number|[1]|The position of the vertex on the x-axis.}}
 
{{subparam|number|[1]|The position of the vertex on the x-axis.}}

Revision as of 02:37, 18 March 2018

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

Sets 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

Mesh:setVertex( index, attributecomponent, ... )

Arguments

number index
The index of the the vertex you want to modify (one-based).
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.

Returns

Nothing.

Notes

The arguments are 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 use two position numbers, two texture coordinate numbers, and four color components per vertex: x, y, u, v, r, g, b, a.

If no value is supplied for a specific vertex attribute component, it will be set to a default value of 0 if its data type is "float", or 255 if its data type is "byte".

Function

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

Synopsis

Mesh:setVertex( index, vertex )

Arguments

number index
The index of the the vertex you want to modify (one-based).
table vertex
A table with vertex information, in the form of {attributecomponent, ...}.
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.

Returns

Nothing.

Notes

The table indices are 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 use two position numbers, two texture coordinate numbers, and four color components per vertex: x, y, u, v, r, g, b, a.

If no value is supplied for a specific vertex attribute component, it will be set to a default value of 0 if its data type is "float", or 255 if its data type is "byte".

Function

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

Synopsis

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

Arguments

number index
The index of the the vertex you want to modify (one-based).
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 (255)
The red component of the vertex's color.
number g (255)
The green component of the vertex's color.
number b (255)
The blue component of the vertex's color.
number a (255)
The alpha component of the vertex's color.

Returns

Nothing.

Function

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

Synopsis

Mesh:setVertex( index, vertex )

Arguments

number index
The index of the the vertex you want to modify (one-based).
table vertex
A table with vertex information.
number [1]
The position of the vertex on the x-axis.
number [2]
The position of the vertex on the y-axis.
number [3]
The u texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode.)
number [4]
The v texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode.)
number [5] (255)
The red color component.
number [6] (255)
The green color component.
number [7] (255)
The blue color component.
number [8] (255)
The alpha color component.

Returns

Nothing.

See Also

Other Languages