Class FrameGraph
Implements
Constructors
constructor
-
new FrameGraph(
scene: Scene,
debugTextures?: boolean,
_linkedNodeRenderGraph?: Nullable<NodeRenderGraph>,
): FrameGraphConstructs the frame graph
Parameters
- scene: Scene
defines the scene the frame graph is associated with
- debugTextures: boolean = false
defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)
- _linkedNodeRenderGraph: Nullable<NodeRenderGraph> = null
defines the linked node render graph (if any)
Returns FrameGraph
- scene: Scene
Properties
name
Name of the frame graph
on Build Observable
Observable raised when the node render graph is built
optimize Texture Allocation
Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)
paused Execution
Indicates whether the execution of the frame graph is paused (default is false)
Readonlytexture Manager
Gets the texture manager used by the frame graph
Readonlyunique Id
Gets the unique id of the frame graph
Accessors
engine
-
get engine(): AbstractEngine
Gets the engine used by the frame graph
Returns AbstractEngine
scene
-
get scene(): Scene
Gets the scene used by the frame graph
Returns Scene
tasks
-
get tasks(): FrameGraphTask[]
Gets the list of tasks in the frame graph
Returns FrameGraphTask[]
Methods
add Object List Pass
-
Adds an object list pass to a task. This method can only be called during a Task.record execution.
Parameters
- name: string
The name of the pass
- whenTaskDisabled: boolean = false
If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)
Returns FrameGraphObjectListPass
The object list pass created
- name: string
add Pass
-
Adds a pass to a task. This method can only be called during a Task.record execution.
Parameters
- name: string
The name of the pass
- whenTaskDisabled: boolean = false
If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)
Returns FrameGraphPass<FrameGraphContext>
The render pass created
- name: string
add Render Pass
-
Adds a render pass to a task. This method can only be called during a Task.record execution.
Parameters
- name: string
The name of the pass
- whenTaskDisabled: boolean = false
If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)
Returns FrameGraphRenderPass
The render pass created
- name: string
add Task
-
Adds a task to the frame graph
Parameters
- task: FrameGraphTask
Task to add
Returns void
- task: FrameGraphTask
build Async
-
Builds the frame graph. This method should be called after all tasks have been added to the frame graph (FrameGraph.addTask) and before the graph is executed (FrameGraph.execute).
Parameters
- waitForReadiness: boolean = true
If true, the method will wait for the frame graph to be ready before returning (default is true)
Returns Promise<void>
- waitForReadiness: boolean = true
clear
-
Clears the frame graph (remove the tasks and release the textures). The frame graph can be built again after this method is called.
Returns void
dispose
-
Disposes the frame graph
Returns void
execute
-
Executes the frame graph.
Returns void
find Main Camera
-
Looks for the main camera used by the frame graph. By default, this is the camera used by the main object renderer task. If no such task, we try to find a camera in a utility layer renderer tasks.
Returns Nullable<Camera>
The main camera used by the frame graph, or null if not found
find Main Object Renderer
-
Looks for the main object renderer task in the frame graph. By default, this is the object/geometry renderer task with isMainObjectRenderer set to true. If no such task, we return the last object/geometry renderer task that has an object list with meshes (or null if none found).
Returns Nullable<FrameGraphObjectRendererTask>
The main object renderer of the frame graph, or null if not found
get Class Name
-
Gets the class name of the frame graph
Returns string
the class name
get Linked Node Render Graph
-
Gets the node render graph linked to the frame graph (if any)
Returns Nullable<NodeRenderGraph>
the linked node render graph or null if none
get Task By Name
-
Gets a task by name
Type Parameters
- T extends FrameGraphTask
Parameters
- name: string
Name of the task to get
Returns T | undefined
The task or undefined if not found
get Tasks By Class Name
-
Gets all tasks of a specific type, based on their class name
Type Parameters
- T extends FrameGraphTask
Parameters
- taskClassName: string | string[]
Class name(s) of the task(s) to get
Returns T[]
The list of tasks of the specified type
get Tasks By Class Names
-
Gets all tasks of a specific class name(s)
Type Parameters
- T extends FrameGraphTask
Parameters
- name: string | string[]
Class name(s) of the task to get
Returns T[]
The list of tasks or an empty array if none found
get Tasks By Type
is Ready
-
Checks if the frame graph is ready to be executed. Note that you can use the whenReadyAsync method to wait for the frame graph to be ready.
Returns boolean
True if the frame graph is ready to be executed, else false
when Ready Async
-
Returns a promise that resolves when the frame graph is ready to be executed. In general, calling “await buildAsync()” should suffice, as this function also waits for readiness by default.
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
Class used to implement a frame graph