Node

moderngl_window.scene.Node[source]

A generic scene node containing a mesh or camera and/or a container for other nodes. Nodes and their children represents the scene tree.

Methods

Node.__init__(camera=None, mesh=None, matrix=None)[source]

Create a node.

Keyword Arguments
  • camera – Camera to store in the node

  • mesh – Mesh to store in the node

  • matrix – The node’s matrix

Node.add_child(node)[source]

Add a child to this node

Parameters

node (Node) – Node to add as a child

Node.draw(projection_matrix=None, camera_matrix=None, time=0)[source]

Draw node and children.

Keyword Arguments
  • projection_matrix (bytes) – projection matrix

  • camera_matrix (bytes) – camera_matrix

  • time (float) – The current time

Node.draw_bbox(projection_matrix, camera_matrix, program, vao)[source]

Draw bounding box around the node and children.

Keyword Arguments
  • projection_matrix (bytes) – projection matrix

  • camera_matrix (bytes) – camera_matrix

  • program (moderngl.Program) – The program to render the bbox

  • vao – The vertex array representing the bounding box

Node.calc_global_bbox(view_matrix, bbox_min, bbox_max)[source]

Recursive calculation of scene bbox.

Keyword Arguments
  • view_matrix (numpy.ndarray) – view matrix

  • bbox_min – min bbox values

  • bbox_max – max bbox values

Node.calc_model_mat(model_matrix)[source]

Calculate the model matrix related to all parents.

Parameters

model_matrix (numpy.ndarray) – model matrix

Attributes

Node.children

List of children

Type

list