Class NodeRenderGraph
Constructors
constructor
-
Creates a new node render graph
Parameters
- name: string
defines the name of the node render graph
- scene: Scene
defines the scene to use to execute the graph
Optionaloptions: anydefines the options to use when creating the graph
Returns NodeRenderGraph
- name: string
Properties
attached Blocks
Gets an array of blocks that needs to be serialized even if they are not yet connected
comment
A free comment about the graph
editor Data
Gets or sets data used by visual editor
name
The name of the node render graph
on Before Build Observable
Observable raised before the node render graph is built
on Build Error Observable
Observable raised when an error is detected
output Block
Gets or sets the RenderGraphOutputBlock used to gather the final node render graph data
snippet Id
Snippet ID if the graph was created from the snippet server
StaticCustom Block Descriptions
Description of custom blocks to use in the node render graph editor
StaticEditor URL
Define the Url to load node editor script
StaticSnippet Url
Define the Url to load snippets
Accessors
frame Graph
-
Gets the frame graph used by this node render graph
Returns FrameGraph
on Build Observable
-
get onBuildObservable(): any
Observable raised after the node render graph is built Note that this is the same observable as the one in the underlying FrameGraph!
Returns any
options
-
get options(): Immutable<INodeRenderGraphCreateOptions>
Gets the options used to create this node render graph
Returns Immutable<INodeRenderGraphCreateOptions>
Methods
build Async
-
buildAsync(
dontBuildFrameGraph?: boolean,
waitForReadiness?: boolean,
setAsSceneFrameGraph?: boolean,
): Promise<void>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>
- dontBuildFrameGraph: boolean = false
clear
-
Clear the current graph
Returns void
clone
-
Makes a duplicate of the current node render graph. Note that you should call buildAsync() on the returned graph to make it usable.
Parameters
- name: string
defines the name to use for the new node render graph
Returns NodeRenderGraph
the new node render graph
- name: string
dispose
-
Disposes the resources
Returns void
edit
-
Launch the node render graph editor
Parameters
Optionalconfig: anyDefine the configuration of the editor
Returns Promise<void>
a promise fulfilled when the node editor is visible
execute
-
Execute the graph (the graph must have been built before!)
Returns void
generate Code
-
Generate a string containing the code declaration required to create an equivalent of this node render graph
Returns string
a string
get Block By Name
-
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 Block By Predicate
-
getBlockByPredicate<T extends NodeRenderGraphBlock>(
predicate: (block: NodeRenderGraphBlock) => boolean,
): Nullable<T>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 Blocks By Predicate
-
getBlocksByPredicate<T extends NodeRenderGraphBlock>(
predicate: (block: NodeRenderGraphBlock) => boolean,
): T[]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
get Class Name
-
Gets the current class name ("NodeRenderGraph")
Returns string
the class name
get Input Blocks
-
Gets the list of input blocks attached to this material
Returns NodeRenderGraphInputBlock[]
an array of InputBlocks
get Scene
-
Gets the scene used by this node render graph
Returns Scene
the scene used by this node render graph
parse Serialized Object
-
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
- source: any
remove Block
-
Remove a block from the current graph
Parameters
- block: NodeRenderGraphBlock
defines the block to remove
Returns void
- block: NodeRenderGraphBlock
replace Camera Async
-
replaceCameraAsync(
currentCamera: Nullable<Camera>,
newCamera: Camera,
updateCameraToUseForPointers?: boolean,
rebuildGraph?: boolean,
): Promise<boolean>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.cameraToUseForPointersto 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.
- currentCamera: Nullable<Camera>
serialize
-
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
set To Default
-
Clear the current graph and set it to a default state
Returns void
when Ready Async
-
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
- timeStep: number = 16
StaticCreate Default Async
-
CreateDefaultAsync(
name: string,
scene: Scene,
nodeRenderGraphOptions?: any,
): Promise<NodeRenderGraph>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: anydefines options to use when creating the node render graph
Returns Promise<NodeRenderGraph>
a new NodeRenderGraph
- name: string
StaticParse
-
Parse(
source: any,
scene: Scene,
nodeRenderGraphOptions?: any,
skipBuild?: boolean,
): NodeRenderGraphCreates 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: anydefines 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
- source: any
StaticParse From Snippet Async
-
ParseFromSnippetAsync(
snippetId: string,
scene: Scene,
nodeRenderGraphOptions?: any,
nodeRenderGraph?: NodeRenderGraph,
skipBuild?: boolean,
): Promise<NodeRenderGraph>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: anydefines options to use when creating the node render graph
OptionalnodeRenderGraph: NodeRenderGraphdefines 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
- snippetId: string
Defines a node render graph