# Node

moderngl_window.scene.Node

  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__(name=None, camera=None, mesh=None, matrix=None)

  Create a node.

  Keyword Arguments:

    - name – Name of the node

    - camera – Camera to store in the node

    - mesh – Mesh to store in the node

    - matrix – The node’s matrix

Node.add_child(node)

  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)

  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)

  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.draw_wireframe(projection_matrix, camera_matrix, program)

  Render the node as wireframe.

  Keyword Arguments:

    - projection_matrix (bytes) – projection matrix

    - camera_matrix (bytes) – camera_matrix

    - program (moderngl.Program) – The program to render wireframe

Node.calc_global_bbox(view_matrix, bbox_min, bbox_max)

  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)

  Calculate the model matrix related to all parents.

  Parameters:

    model_matrix (numpy.ndarray) – model matrix

## Attributes

Node.name

  Get or set the node name

  Type:

    str

Node.mesh

  The mesh if present

  Type:

    `Mesh`

Node.camera

  The camera if present

  Type:

    `Camera`

Node.matrix

  Note matrix (local)

  Type:

    numpy.ndarray

Node.matrix_global

  The global node matrix containing transformations from parent nodes

  Type:

    numpy.ndarray

Node.children

  List of children

  Type:

    list