A visual Node in the Renderer scene graph.

A Node is a basic building block of the Renderer scene graph. It can be a container for other Nodes, or it can be a leaf Node that renders a solid color, gradient, image, or specific texture, using a specific shader.

For text rendering Nodes, see ITextNode.

CoreNode is the name of the class for a Renderer Node and is only directly used internally by the Renderer. INode describes the public API of a Renderer Node including the ability to be tied to a specific Shader.

Users of the Renderer API, should generally interact with INode objects instead of CoreNode objects.

interface INode<SC> {
    absX: number;
    absY: number;
    alpha: number;
    autosize: boolean;
    calcZIndex: number;
    children: CoreNode[];
    childUpdateType: UpdateType;
    clipping: boolean;
    clippingRect: RectWithValid;
    color: number;
    colorBl: number;
    colorBottom: number;
    colorBr: number;
    colorLeft: number;
    colorRight: number;
    colorTl: number;
    colorTop: number;
    colorTr: number;
    data: undefined | CustomDataMap;
    framebufferDimensions: Dimensions;
    globalTransform?: Matrix3d;
    hasRTTupdates: boolean;
    height: number;
    id: number;
    imageType:
        | null
        | "svg"
        | "regular"
        | "compressed";
    isRenderable: boolean;
    localTransform?: Matrix3d;
    mount: number;
    mountX: number;
    mountY: number;
    parent: null | INode<BaseShaderController>;
    parentHasRenderTexture: boolean;
    parentRenderTexture: null | CoreNode;
    pivot: number;
    pivotX: number;
    pivotY: number;
    preloadBound?: Bound;
    premultipliedColorBl: number;
    premultipliedColorBr: number;
    premultipliedColorTl: number;
    premultipliedColorTr: number;
    preventCleanup: boolean;
    props: CoreNodeProps;
    renderBound?: Bound;
    renderCoords?: RenderCoords;
    renderState: CoreNodeRenderState;
    rotation: number;
    rtt: boolean;
    rttParent: null | CoreNode;
    scale: number;
    scaleRotateTransform?: Matrix3d;
    scaleX: number;
    scaleY: number;
    shader: SC;
    src: null | string;
    srcHeight: undefined | number;
    srcWidth: undefined | number;
    srcX: undefined | number;
    srcY: undefined | number;
    stage: Stage;
    strictBound?: Bound;
    strictBounds: boolean;
    texture: null | Texture;
    textureOptions: TextureOptions;
    updateType: UpdateType;
    width: number;
    worldAlpha: number;
    x: number;
    y: number;
    zIndex: number;
    zIndexLocked: number;
    animate(props: Partial<INodeAnimateProps<SC>>, settings: Partial<AnimationSettings>): IAnimationController;
    autosizeNode(dimensions: Dimensions): void;
    calculateClippingRect(parentClippingRect: RectWithValid): void;
    calculateRenderCoords(): void;
    calculateZIndex(): void;
    checkRenderBounds(): CoreNodeRenderState;
    createRenderBounds(): void;
    destroy(): void;
    emit(event: string, data?: any): void;
    flush(): void;
    hasRenderableProperties(): boolean;
    loadTexture(): void;
    off(event: string, listener?: ((target: any, data: any) => void)): void;
    on(event: string, listener: ((target: any, data: any) => void)): void;
    once(event: string, listener: ((target: any, data: any) => void)): void;
    onChangeIsRenderable(isRenderable: boolean): void;
    removeAllListeners(): void;
    renderQuads(renderer: CoreRenderer): void;
    setUpdateType(type: UpdateType): void;
    sortChildren(): void;
    unloadTexture(): void;
    update(delta: number, parentClippingRect: RectWithValid): void;
    updateBoundingRect(): void;
    updateIsRenderable(): void;
    updateLocalTransform(): void;
    updateRenderState(renderState: CoreNodeRenderState): void;
    updateScaleRotateTransform(): void;
}

Type Parameters

Hierarchy

  • Omit<CoreNode, "shader" | "animate" | "parent">
    • INode

Properties

absX: number
absY: number
alpha: number
autosize: boolean
calcZIndex: number = 0
children: CoreNode[] = []
childUpdateType: UpdateType = UpdateType.None
clipping: boolean
clippingRect: RectWithValid = ...
color: number
colorBl: number
colorBottom: number
colorBr: number
colorLeft: number
colorRight: number
colorTl: number
colorTop: number
colorTr: number
data: undefined | CustomDataMap
framebufferDimensions: Dimensions
globalTransform?: Matrix3d
hasRTTupdates: boolean = false
height: number
id: number
imageType:
    | null
    | "svg"
    | "regular"
    | "compressed"
isRenderable: boolean = false
localTransform?: Matrix3d
mount: number
mountX: number
mountY: number
parent: null | INode<BaseShaderController>
parentHasRenderTexture: boolean = false
parentRenderTexture: null | CoreNode
pivot: number
pivotX: number
pivotY: number
preloadBound?: Bound
premultipliedColorBl: number = 0
premultipliedColorBr: number = 0
premultipliedColorTl: number = 0
premultipliedColorTr: number = 0
preventCleanup: boolean
props: CoreNodeProps
renderBound?: Bound
renderCoords?: RenderCoords
renderState: CoreNodeRenderState = CoreNodeRenderState.Init
rotation: number
rtt: boolean
rttParent: null | CoreNode = null
scale: number
scaleRotateTransform?: Matrix3d
scaleX: number
scaleY: number
shader: SC
src: null | string
srcHeight: undefined | number
srcWidth: undefined | number
srcX: undefined | number
srcY: undefined | number
stage: Stage
strictBound?: Bound
strictBounds: boolean
texture: null | Texture
textureOptions: TextureOptions
updateType: UpdateType = UpdateType.All
width: number
worldAlpha: number = 1
x: number
y: number
zIndex: number
zIndexLocked: number

Methods

  • This function calculates the clipping rectangle for a node.

    The function then checks if the node is rotated. If the node requires clipping and is not rotated, a new clipping rectangle is created based on the node's global transform and dimensions. If a parent clipping rectangle exists, it is intersected with the node's clipping rectangle (if it exists), or replaces the node's clipping rectangle.

    Finally, the node's parentClippingRect and clippingRect properties are updated.

    Parameters

    • parentClippingRect: RectWithValid

    Returns void

  • Destroy the node and cleanup all resources

    Returns void

  • Returns boolean

  • Parameters

    • event: string
    • Optionallistener: ((target: any, data: any) => void)
        • (target, data): void
        • Parameters

          • target: any
          • data: any

          Returns void

    Returns void

  • Parameters

    • event: string
    • listener: ((target: any, data: any) => void)
        • (target, data): void
        • Parameters

          • target: any
          • data: any

          Returns void

    Returns void

  • Parameters

    • event: string
    • listener: ((target: any, data: any) => void)
        • (target, data): void
        • Parameters

          • target: any
          • data: any

          Returns void

    Returns void

  • Parameters

    • isRenderable: boolean

    Returns void

  • Parameters

    • renderer: CoreRenderer

    Returns void

  • Change types types is used to determine the scope of the changes being applied

    Parameters

    • type: UpdateType

    Returns void

    See UpdateType for more information on each type

  • @todo: test for correct calculation flag

    Parameters

    • delta: number
    • parentClippingRect: RectWithValid

    Returns void

  • This function updates the isRenderable property based on certain conditions.

    Returns void

  • Returns void