# Scene

## Methods

Scene.__init__(name, **kwargs)

  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

  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

  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))

  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

  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.calc_scene_bbox() → None

  Calculate scene bbox

Scene.find_material(name: str = None) → Material

  Finds a `Material`

  Keyword Arguments:

    name (str) – Case sensitive material name

  Returns:

    A `Material` or `None`

Scene.find_node(name: str = None) → Node

  Finds a `Node`

  Keyword Arguments:

    name (str) – Case sensitive name

  Returns:

    A `Node` or `None` if not found.

Scene.prepare() → None

  prepare the scene for rendering.

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

Scene.destroy() → None

  Destroys the scene data and vertex buffers

Scene.release()

  Destroys the scene data and vertex buffers

## Attributes

Scene.ctx

  The current context

  Type:

    moderngl.Context

Scene.matrix

  The current model matrix

  This property is settable.

  Type:

    numpy.ndarray