API

Class NodeRenderGraph

Defines a node render graph

Index
attachedBlocks: NodeRenderGraphBlock[] = []

Gets an array of blocks that needs to be serialized even if they are not yet connected

comment: string

A free comment about the graph

editorData: any = null

Gets or sets data used by visual editor

name: string

The name of the node render graph

onBeforeBuildObservable: Observable<FrameGraph> = ...

Observable raised before the node render graph is built

onBuildErrorObservable: Observable<string> = ...

Observable raised when an error is detected

outputBlock: Nullable<NodeRenderGraphOutputBlock> = null

Gets or sets the RenderGraphOutputBlock used to gather the final node render graph data

snippetId: string

Snippet ID if the graph was created from the snippet server

CustomBlockDescriptions: INodeRenderGraphCustomBlockDescription[] = []

Description of custom blocks to use in the node render graph editor

EditorURL: string = ...

Define the Url to load node editor script

SnippetUrl: string = Constants.SnippetUrl

Define the Url to load snippets

  • Build the final list of blocks that will be executed by the "execute" method. It also builds the underlying frame graph unless specified otherwise.

    Parameters

    • dontBuildFrameGraph: boolean = false

      If the underlying frame graph should not be built (default: false)

    • waitForReadiness: boolean = true

      If the method should wait for the frame graph to be ready before resolving (default: true). Note that this parameter has no effect if "dontBuildFrameGraph" is true.

    • setAsSceneFrameGraph: boolean = true

      If the built frame graph must be set as the scene's frame graph (default: true)

    Returns Promise<void>

  • Gets a block by its name

    Type Parameters

    • T extends NodeRenderGraphBlock

    Parameters

    • name: string

      defines the name of the block to retrieve

    Returns Nullable<T>

    the required block or null if not found

  • Get a block using a predicate

    Type Parameters

    • T extends NodeRenderGraphBlock

    Parameters

    • predicate: (block: NodeRenderGraphBlock) => boolean

      defines the predicate used to find the good candidate

    Returns Nullable<T>

    the required block or null if not found

  • Get all blocks that match a predicate

    Type Parameters

    • T extends NodeRenderGraphBlock

    Parameters

    • predicate: (block: NodeRenderGraphBlock) => boolean

      defines the predicate used to find the good candidate(s)

    Returns T[]

    the list of blocks found

  • Clear the current graph and load a new one from a serialization object

    Parameters

    • source: any

      defines the JSON representation of the graph

    • merge: boolean = false

      defines whether or not the source must be merged or replace the current content

    Returns void

  • Replaces a camera in all camera input blocks of this node render graph. If the current camera is found in any input block, it is replaced by the new camera, optionally updating the scene's pointer camera and rebuilding the graph.

    Parameters

    • currentCamera: Nullable<Camera>

      The camera to replace.

    • newCamera: Camera

      The new camera to assign to the matching input blocks.

    • updateCameraToUseForPointers: boolean = true

      If true (default), updates scene.cameraToUseForPointers to the new camera when a replacement occurs.

    • rebuildGraph: boolean = true

      If true (default), rebuilds the graph asynchronously after the replacement.

    Returns Promise<boolean>

    A promise that resolves to true if at least one input block was updated, false otherwise.

  • Serializes this node render graph in a JSON representation

    Parameters

    • OptionalselectedBlocks: NodeRenderGraphBlock[]

      defines the list of blocks to save (if null the whole node render graph will be saved)

    Returns any

    the serialized node render graph object

  • Returns a promise that resolves when the node render graph is ready to be executed This method must be called after the graph has been built (NodeRenderGraph.build called)!

    Parameters

    • timeStep: number = 16

      Time step in ms between retries (default is 16)

    • maxTimeout: number = 10000

      Maximum time in ms to wait for the graph to be ready (default is 10000)

    Returns Promise<void>

    The promise that resolves when the graph is ready

  • Creates a new node render graph set to default basic configuration

    Parameters

    • name: string

      defines the name of the node render graph

    • scene: Scene

      defines the scene to use

    • OptionalnodeRenderGraphOptions: any

      defines options to use when creating the node render graph

    Returns Promise<NodeRenderGraph>

    a new NodeRenderGraph

  • Creates a node render graph from parsed graph data

    Parameters

    • source: any

      defines the JSON representation of the node render graph

    • scene: Scene

      defines the scene to use

    • OptionalnodeRenderGraphOptions: any

      defines options to use when creating the node render

    • skipBuild: boolean = true

      defines whether to skip building the node render graph (default is true)

    Returns NodeRenderGraph

    a new node render graph

  • Creates a node render graph from a snippet saved by the node render graph editor

    Parameters

    • snippetId: string

      defines the snippet to load

    • scene: Scene

      defines the scene to use

    • OptionalnodeRenderGraphOptions: any

      defines options to use when creating the node render graph

    • OptionalnodeRenderGraph: NodeRenderGraph

      defines a node render graph to update (instead of creating a new one)

    • skipBuild: boolean = true

      defines whether to skip building the node render graph (default is true)

    Returns Promise<NodeRenderGraph>

    a promise that will resolve to the new node render graph