Model:meshes

Edit

Returns an iterator that iterates over the nodes with meshes in the Model.

This is convenient when drawing individual meshes in the Model using Pass:drawPart.

iterator, state, initial = Model:meshes()

Arguments

None

Returns

NameTypeDescription
iteratorfunction The iterator function. The iterator function returns the index of the next node, and the index of its mesh.
stateModel The Model.
initialnil The initial value.

Example

function lovr.draw(pass)
  for node, mesh in model:meshes() do
    pass:push()
    pass:transform(model:getNodeTransform(node))
    -- Instead of drawing the whole mesh like this,
    -- you could also draw individual parts of the mesh
    pass:drawPart(model, mesh)
    pass:pop()
  end
end

See also