Mesh
- moderngl_window.scene.Mesh = <class 'moderngl_window.scene.mesh.Mesh'>[source]
Mesh info and geometry
Methods
- Mesh.__init__(name, vao=None, material=None, attributes=None, bbox_min=None, bbox_max=None)[source]
Initialize mesh.
- Parameters:
name (str) – name of the mesh
- Keyword Arguments:
Attributes example:
{ "NORMAL": {"name": "in_normal", "components": 3, "type": GL_FLOAT}, "POSITION": {"name": "in_position", "components": 3, "type": GL_FLOAT} }
- Mesh.draw(projection_matrix=None, model_matrix=None, camera_matrix=None, time=0.0)[source]
Draw the mesh using the assigned mesh program
- Keyword Arguments:
projection_matrix (bytes) – projection_matrix
view_matrix (bytes) – view_matrix
camera_matrix (bytes) – camera_matrix
- Mesh.draw_bbox(proj_matrix, model_matrix, cam_matrix, program, vao)[source]
Renders the bounding box for this mesh.
- Parameters:
proj_matrix – Projection matrix
model_matrix – View/model matrix
cam_matrix – Camera matrix
program – The moderngl.Program rendering the bounding box
vao – The vao mesh for the bounding box
- Mesh.draw_wireframe(proj_matrix, model_matrix, program)[source]
Render the mesh as wireframe.
proj_matrix: Projection matrix model_matrix: View/model matrix program: The moderngl.Program rendering the wireframe
- Mesh.add_attribute(attr_type, name, components)[source]
Add metadata about the mesh :param attr_type: POSITION, NORMAL etc :param name: The attribute name used in the program :param components: Number of floats