Class Mesh
Class for initializing and storing mesh vertices and material.
Functions
Mesh.generate_indices (count, template) | Generate indices for quadrilateral primitives. |
Mesh.get_attribute_index (attribute, format) | Get the attribute index from the vertex format. |
Mesh.from_primitive (vertices[, opt]) | Create a menori.Mesh from vertices. |
Methods
Mesh:init (primitives[, texture]) | The public constructor. |
Mesh:draw (material) | Draw a Mesh object on the screen. |
Mesh:get_triangles () | Create a cached array of triangles from the mesh vertices and return it. |
Mesh:get_vertices ([iprimitive=1]) | Get an array of all mesh vertices. |
Mesh:set_vertices (vertices, startvertex) | Get an array of all mesh vertices. |
Mesh:apply_matrix (matrix) | Apply the transformation matrix to the mesh vertices. |
Functions
- Mesh.generate_indices (count, template)
-
Generate indices for quadrilateral primitives.
Parameters:
- count number Count of vertices
- template table Template list that is used to generate indices in a specific sequence
- Mesh.get_attribute_index (attribute, format)
-
Get the attribute index from the vertex format.
Parameters:
- Mesh.from_primitive (vertices[, opt])
-
Create a menori.Mesh from vertices.
Parameters:
Methods
- Mesh:init (primitives[, texture])
-
The public constructor.
Parameters:
- primitives table List of primitives
- texture Image (optional)
- Mesh:draw (material)
-
Draw a Mesh object on the screen.
Parameters:
- material menori.Material The Material to be used when drawing the mesh.
- Mesh:get_triangles ()
-
Create a cached array of triangles from the mesh vertices and return it.
Returns:
-
table
Triangles { {{x, y, z}, {x, y, z}, {x, y, z}}, ...}
- Mesh:get_vertices ([iprimitive=1])
-
Get an array of all mesh vertices.
Parameters:
- iprimitive int The index of the primitive. (default 1)
Returns:
-
table
The table in the form of {vertex, ...} where each vertex is a table in the form of {attributecomponent, ...}.
- Mesh:set_vertices (vertices, startvertex)
-
Get an array of all mesh vertices.
Parameters:
- vertices table The table in the form of {vertex, ...} where each vertex is a table in the form of {attributecomponent, ...}.
- startvertex number The vertex from which the insertion will start.
- Mesh:apply_matrix (matrix)
-
Apply the transformation matrix to the mesh vertices.
Parameters:
- matrix ml.mat4