Difference between revisions of "Mesh:setVertex"

(Created page with "{{newin|0.9.0|090|type=function}} Sets the vertex information for a geometry. == Function == === Synopsis === <source lang="lua"> Geometry:setVertex( i, x, y, u, v, r, g, b,...")
 
(Updated for 11.0)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{newin|[[0.9.0]]|090|type=function}}
 
{{newin|[[0.9.0]]|090|type=function}}
Sets the vertex information for a geometry.
+
Sets the properties of a vertex in the Mesh.
  
 +
In versions prior to [[11.0]], color and byte component values were within the range of 0 to 255 instead of 0 to 1.
 
== Function ==
 
== Function ==
 +
{{newin|[[0.10.0]]|100|type=variant}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
Geometry:setVertex( i, x, y, u, v, r, g, b, a )
+
Mesh:setVertex( index, attributecomponent, ... )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|i|The index of the the vertex you want to alter the information for.}}
+
{{param|number|index|The index of the the vertex you want to modify (one-based).}}
{{param|number|x|The x vertex coordinate.}}
+
{{param|number|attributecomponent|The first component of the first vertex attribute in the specified vertex.}}
{{param|number|y|The y vertex coordinate.}}
+
{{param|number|...|Additional components of all vertex attributes in the specified vertex.}}
{{param|number|u|The u texture coordinate.}}
 
{{param|number|v|The v texture coordinate.}}
 
{{param|number|r (255)|The red color component.}}
 
{{param|number|g (255)|The green color component.}}
 
{{param|number|b (255)|The blue color component.}}
 
{{param|number|a (255)|The alpha color component.}}
 
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
=== Notes ===
 +
The arguments are in the same order as the vertex attributes in the Mesh's [[Mesh:getVertexFormat|vertex format]]. A standard Mesh that wasn't [[love.graphics.newMesh|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 [[AttributeDataType|data type]] is "float", or 1 if its data type is "byte".
 +
 +
== Function ==
 +
{{newin|[[0.10.0]]|100|type=variant}}
 +
=== Synopsis ===
 +
<source lang="lua">
 +
Mesh:setVertex( index, vertex )
 +
</source>
 +
=== Arguments ===
 +
{{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>.}}
 +
{{subparam|number|attributecomponent|The first component of the first vertex attribute in the specified vertex.}}
 +
{{subparam|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 [[Mesh:getVertexFormat|vertex format]]. A standard Mesh that wasn't [[love.graphics.newMesh|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 [[AttributeDataType|data type]] is "float", or 1 if its data type is "byte".
 +
 +
== Function ==
 +
Sets the vertex components of a Mesh that wasn't [[love.graphics.newMesh|created]] with a custom vertex format.
 +
=== Synopsis ===
 +
<source lang="lua">
 +
Mesh:setVertex( index, x, y, u, v, r, g, b, a )
 +
</source>
 +
=== Arguments ===
 +
{{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|y|The position of the vertex on the y-axis.}}
 +
{{param|number|u|The horizontal component of the texture coordinate.}}
 +
{{param|number|v|The vertical component of the texture coordinate.}}
 +
{{param|number|r (1)|The red component of the vertex's color.}}
 +
{{param|number|g (1)|The green component of the vertex's color.}}
 +
{{param|number|b (1)|The blue component of the vertex's color.}}
 +
{{param|number|a (1)|The alpha component of the vertex's color.}}
 +
=== Returns ===
 +
Nothing.
 +
 +
== Function ==
 +
Sets the vertex components of a Mesh that wasn't [[love.graphics.newMesh|created]] with a custom vertex format.
 +
=== Synopsis ===
 +
<source lang="lua">
 +
Mesh:setVertex( index, vertex )
 +
</source>
 +
=== Arguments ===
 +
{{param|number|index|The index of the the vertex you want to modify (one-based).}}
 +
{{param|table|vertex|A table with vertex information.}}
 +
{{subparam|number|[1]|The position of the vertex on the x-axis.}}
 +
{{subparam|number|[2]|The position of the vertex on the y-axis.}}
 +
{{subparam|number|[3]|The u texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see [[WrapMode]].)}}
 +
{{subparam|number|[4]|The v texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see [[WrapMode]].)}}
 +
{{subparam|number|[5] (1)|The red color component.}}
 +
{{subparam|number|[6] (1)|The green color component.}}
 +
{{subparam|number|[7] (1)|The blue color component.}}
 +
{{subparam|number|[8] (1)|The alpha color component.}}
 +
=== Returns ===
 +
Nothing.
 +
 
== See Also ==
 
== See Also ==
* [[parent::Geometry]]
+
* [[parent::Mesh]]
* [[Geometry:getVertex]]
+
* [[Mesh:getVertex]]
 +
* [[Mesh:getVertexCount]]
 +
* [[Mesh:getVertexFormat]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Sets the vertex information for a geometry.}}
+
{{#set:Description=Sets the properties of a vertex in the Mesh.}}
 
== Other Languages ==
 
== Other Languages ==
{{i18n|Geometry:setVertex}}
+
{{i18n|Mesh:setVertex}}

Latest revision as of 20:23, 1 April 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.

In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.

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 1 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 1 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 (1)
The red component of the vertex's color.
number g (1)
The green component of the vertex's color.
number b (1)
The blue component of the vertex's color.
number a (1)
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] (1)
The red color component.
number [6] (1)
The green color component.
number [7] (1)
The blue color component.
number [8] (1)
The alpha color component.

Returns

Nothing.

See Also

Other Languages