API

Class FrameGraph

Class used to implement a frame graph

Implements

Index
  • Constructs 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

name: string = "Frame Graph"

Name of the frame graph

onBuildObservable: any = ...

Observable raised when the node render graph is built

optimizeTextureAllocation: boolean = true

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)

pausedExecution: boolean = false

Indicates whether the execution of the frame graph is paused (default is false)

textureManager: FrameGraphTextureManager

Gets the texture manager used by the frame graph

uniqueId: any = UniqueIdGenerator.UniqueId

Gets the unique id of the frame graph

  • 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

  • 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

  • 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>

  • 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

  • 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

  • Gets the node render graph linked to the frame graph (if any)

    Returns Nullable<NodeRenderGraph>

    the linked node render graph or null if none

  • 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

  • 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

  • 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

  • Gets all tasks of a specific type

    Type Parameters

    • T extends FrameGraphTask

    Parameters

    • taskType: new (...args: any[]) => T

      Type of the task(s) to get

    Returns T[]

    The list of tasks of the specified type

  • 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

  • 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