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: numpy.ndarray = None, camera_matrix: numpy.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) → 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
Scene.apply_mesh_programs(mesh_programs=None) → 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
Scene.calc_scene_bbox() → None[source]

Calculate scene bbox

Scene.prepare() → None[source]

prepare the scene for rendering.

Calls apply_mesh_programs() assining default meshprograms if needed and sets the model matrix.

Scene.destroy() → None[source]

Destroys the scene data and vertex buffers

Attributes

Scene.ctx

The current context

Type:moderngl.Context
Scene.model_matrix

The current model matrix

This property is settable.

Type:numpy.ndarray