Mesh
EditMeshes store arbitrary geometry data, and can be drawn with Pass:draw
.
Meshes hold a list of vertices. The number of vertices is declared upfront when the Mesh is created, and it can not be resized afterwards.
The Mesh has a vertex format, which is a set of attributes comprising each vertex, like a position
, color
, etc.
The vertex indices in the Mesh describe the order that the vertices are rendered in. This is an optimization that allows vertices to be reused if they are used for multiple triangles, without duplicating all of their data.
The Mesh has a draw mode, which controls how the vertices are connected together to create pixels. It can either be points
, lines
, or triangles
.
The Mesh can have a Material
applied, which defines colors, textures, and other properties of its surface.
The draw range of the Mesh defines a subset of the vertices to render when the Mesh is drawn.
The bounding box of the Mesh allows LÖVR to skip rendering it when it's out of view.
Constructor
lovr.graphics.newMesh | Create a new Mesh. |
Methods
Mesh:computeBoundingBox | Compute the bounding box of the Mesh. |
Mesh:getBoundingBox | Get the bounding box of the Mesh. |
Mesh:getDrawMode | Get the draw mode of the Mesh. |
Mesh:getDrawRange | Get the range of vertices drawn by the Mesh. |
Mesh:getIndexBuffer | Get the Buffer backing the vertex indices of the Mesh. |
Mesh:getIndices | Get the vertex indices in the Mesh. |
Mesh:getMaterial | Get the Material applied to the Mesh. |
Mesh:getVertexBuffer | Get the Buffer backing the vertices of the Mesh. |
Mesh:getVertexCount | Get the number of vertices in the Mesh. |
Mesh:getVertexFormat | Get the vertex format of the Mesh. |
Mesh:getVertexStride | Get the size of each vertex in the Mesh. |
Mesh:getVertices | Get the vertices in the Mesh. |
Mesh:setBoundingBox | Set or remove the bounding box of the Mesh. |
Mesh:setDrawMode | Set the draw mode of the Mesh. |
Mesh:setDrawRange | Set the range of vertices drawn by the Mesh. |
Mesh:setIndexBuffer | Set a Buffer for the Mesh to use for vertex indices. |
Mesh:setIndices | Set the vertex indices of the Mesh. |
Mesh:setMaterial | Set a Material to use when drawing the Mesh. |
Mesh:setVertices | Set vertices in the Mesh. |