Scene
Methods
- Scene.__init__(name, **kwargs)[source]
Create a scene with a name.
- Parameters:
name (str) – Unique name or path for the scene
- Scene.draw(projection_matrix: ndarray = None, camera_matrix: ndarray = None, time=0.0) None [source]
Draw all the nodes in the scene.
- Parameters:
projection_matrix (ndarray) – projection matrix (bytes)
camera_matrix (ndarray) – camera_matrix (bytes)
time (float) – The current time
- Scene.draw_bbox(projection_matrix=None, camera_matrix=None, children=True, color=(0.75, 0.75, 0.75)) None [source]
Draw scene and mesh bounding boxes.
- Parameters:
projection_matrix (ndarray) – mat4 projection
camera_matrix (ndarray) – mat4 camera matrix
children (bool) – Will draw bounding boxes for meshes as well
color (tuple) – Color of the bounding boxes
- Scene.draw_wireframe(projection_matrix=None, camera_matrix=None, color=(0.75, 0.75, 0.75, 1.0))[source]
Render the scene in wireframe mode.
- Parameters:
projection_matrix (ndarray) – mat4 projection
camera_matrix (ndarray) – mat4 camera matrix
children (bool) – Will draw bounding boxes for meshes as well
color (tuple) – Color of the wireframes
- Scene.apply_mesh_programs(mesh_programs=None, clear: bool = True) None [source]
Applies mesh programs to meshes. If not mesh programs are passed in we assign default ones.
- Parameters:
mesh_programs (list) – List of mesh programs to assign
clear (bool) – Clear all assigned mesh programs
- Scene.find_material(name: str = None) Material [source]
Finds a
Material
- Keyword Arguments:
name (str) – Case sensitive material name
- Returns:
A
Material
orNone
- Scene.find_node(name: str = None) Node [source]
Finds a
Node
- Keyword Arguments:
name (str) – Case sensitive name
- Returns:
A
Node
orNone
if not found.
Attributes
- Scene.ctx
The current context
- Type:
moderngl.Context
- Scene.matrix
The current model matrix
This property is settable.
- Type:
numpy.ndarray