μScene
    Preparing search index...

    Class Node

    A node in a scene graph.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Create a node in a scene graph.

      Parameters

      • enabled: boolean = true

        Whether or not the node should be enabled.

      Returns Node

    Properties

    enabled: boolean

    Whether or not this node is enabled. Disabled nodes and their descendents are not included in traversals.

    matrix: Matrix4Like

    The transformation matrix of this node relative to its parent.

    Accessors

    • get rotation(): Readonly<QuaternionLike> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      The rotation of this node relative to its parent.

      Returns Readonly<QuaternionLike> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      • Readonlybuffer: Readonly<
            Pick<
                Float32Array["buffer"],
                "byteLength"
                | "maxByteLength"
                | "slice"
                | typeof Symbol.toStringTag,
            >,
        >

        The ArrayBuffer instance referenced by the array.

    • set rotation(value: Readonly<QuaternionLike>): void

      The rotation of this node relative to its parent.

      Parameters

      Returns void

    • get scaling(): Readonly<Vector3Like> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      The scaling of this node relative to its parent.

      Returns Readonly<Vector3Like> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      • Readonlybuffer: Readonly<
            Pick<
                Float32Array["buffer"],
                "byteLength"
                | "maxByteLength"
                | "slice"
                | typeof Symbol.toStringTag,
            >,
        >

        The ArrayBuffer instance referenced by the array.

    • set scaling(value: Readonly<Vector3Like>): void

      The scaling of this node relative to its parent.

      Parameters

      Returns void

    • get translation(): Readonly<Vector3Like> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      The translation of this node relative to its parent.

      Returns Readonly<Vector3Like> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      • Readonlybuffer: Readonly<
            Pick<
                Float32Array["buffer"],
                "byteLength"
                | "maxByteLength"
                | "slice"
                | typeof Symbol.toStringTag,
            >,
        >

        The ArrayBuffer instance referenced by the array.

    • set translation(value: Readonly<Vector3Like>): void

      The translation of this node relative to its parent.

      Parameters

      Returns void

    • get worldMat(): Readonly<Matrix4Like> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      The world matrix of this node, which represents its transformation relative to the origin.

      Returns Readonly<Matrix4Like> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      • Readonlybuffer: Readonly<
            Pick<
                Float32Array["buffer"],
                "byteLength"
                | "maxByteLength"
                | "slice"
                | typeof Symbol.toStringTag,
            >,
        >

        The ArrayBuffer instance referenced by the array.

    • get worldTranslation(): Readonly<Vector3Like> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      The translation of this node relative to the origin.

      Returns Readonly<Vector3Like> & Readonly<
          Omit<
              Float32Array<ArrayBufferLike>,
              "buffer" | "copyWithin" | "fill" | "reverse" | "set" | "sort",
          >,
      > & {
          buffer: Readonly<
              Pick<
                  Float32Array["buffer"],
                  "byteLength"
                  | "maxByteLength"
                  | "slice"
                  | typeof Symbol.toStringTag,
              >,
          >;
      }

      • Readonlybuffer: Readonly<
            Pick<
                Float32Array["buffer"],
                "byteLength"
                | "maxByteLength"
                | "slice"
                | typeof Symbol.toStringTag,
            >,
        >

        The ArrayBuffer instance referenced by the array.

    Methods

    • Add a child to this node.

      Parameters

      • node: Node

        The child. The child's parent will be updated to point to this node. If the child already had a parent, it will be removed from that parent's children.

      Returns void

    • Reset this node's transformation relative to its parent.

      Returns void

    • Remove a child from this node.

      Parameters

      • node: Node

        The child. The child's parent will be updated to point to nothing.

      Returns void

    • Rotate this node around the X-axis relative to its parent.

      Parameters

      • r: number

        The number of radians to rotate by.

      Returns void

    • Rotate this node around the Y-axis relative to its parent.

      Parameters

      • r: number

        The number of radians to rotate by.

      Returns void

    • Rotate this node around the Z-axis relative to its parent.

      Parameters

      • r: number

        The number of radians to rotate by.

      Returns void

    • Perform a function on this node and each of its children recursively.

      Parameters

      • f:
            | (
                (
                    self: Node,
                    worldMat: Float32Array<ArrayBufferLike> & Matrix4Like,
                ) => boolean
            )
            | (
                (
                    self: Node,
                    worldMat: Float32Array<ArrayBufferLike> & Matrix4Like,
                ) => void
            )

        The function to perform for each node. Receives as an argument the node and the node's transformation matrix relative to the node on which the traversal started. If this function returns false, the node's children are not included in the traversal.

      Returns void