Mesh:setVertex

Update a single vertex in the Mesh.

Mesh:setVertex(index, ...)

Arguments

NameTypeDescription
indexnumberThe index of the vertex to set.
...numberThe attributes of the vertex.

Returns

Nothing


Mesh:setVertex(index, vertexData)

Arguments

NameTypeDescription
indexnumberThe index of the vertex to set.
vertexDatatableA table containing the attributes of the vertex.

Returns

Nothing

Notes

Any unspecified components will be set to 0 for float and int attributes, or 255 for byte attributes.

Example

Set the position of a vertex:

function lovr.load()
  mesh = lovr.graphics.newMesh({
    { -1, 1, 0,  0, 0, 1,  0, 0 },
    { 1, 1, 0,  0, 0, 1,  1, 0 },
    { -1, -1, 0,  0, 0, 1,  0, 1 },
    { 1, -1, 0,  0, 0, 1,  1, 1 }
  }, 'strip')

  mesh:setVertex(2, { 7, 7, 7 })
  print(mesh:getVertex(2)) -- 7, 7, 7, 0, 0, 0, 0, 0
end

See also