Nano WebGPU API - v0.11.0
    Preparing search index...

    Class Node

    Base class for all nodes in the scene graph hierarchy. Handles hierarchical parent-child relationships, traversal, and coordinate space transformations by propagating dirty transform states down the tree.

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Adds a child node to this node's hierarchy. If the child already has a parent, it is automatically removed from that parent first. Sets the child's dirty flag to true to force transform updates.

      Parameters

      • child: Node

        The Node instance to append as a child.

      Returns void

    • Removes a child node from this node's hierarchy. Clears the parent reference of the child node and sets its dirty flag.

      Parameters

      • child: Node

        The Node instance to detach.

      Returns void

    • Performs a depth-first traversal of the node hierarchy starting from this node, executing the provided callback on each visited node.

      Parameters

      • callback: (node: Node) => void

        The function to invoke for each node.

      Returns void

    • Recomputes the node's local transformation matrix. Base Node does not define individual translation, rotation, or scale properties. This should be overridden in subclasses (e.g. Node3D) that maintain distinct components.

      Returns void

    • Updates the global world matrix of this node and recursively propagates the updates down the hierarchy to all child nodes.

      Parameters

      • force: boolean = false

        If true, forces transformation matrices to be recomputed even if they are not flagged as dirty.

      Returns void

    Properties

    children: Node[] = []

    List of child nodes belonging to this node.

    isDirty: boolean = true

    Whether the local transform has changed and needs to be recomputed and propagated.

    localMatrix: Mat4 = ...

    Local transformation matrix relative to the parent node.

    name: string = ""

    Unique identifier or friendly name for the node.

    parent: Node | null = null

    Parent node in the scene graph. Null if this is the root node.

    visible: boolean = true

    Visibility flag. If false, this node and its descendants are typically skipped in rendering.

    worldMatrix: Mat4 = ...

    Global world transformation matrix relative to the scene origin.