API

Class FrameGraphRenderContext

Frame graph context used render passes.

Hierarchy (View Summary)

Index
enableDebugMarkers: boolean = true

If true, debug markers will be enabled in the context.

  • Applies a full-screen effect to the current render target

    Parameters

    • drawWrapper: DrawWrapper

      The draw wrapper containing the effect to apply

    • OptionalcustomBindings: () => void

      The custom bindings to use when applying the effect (optional)

    • OptionalstencilState: any

      The stencil state to use when applying the effect (optional)

    • OptionaldisableColorWrite: boolean

      If true, color write will be disabled when applying the effect (optional)

    • OptionaldrawBackFace: boolean

      If true, the fullscreen quad will be drawn as a back face (in CW - optional)

    • OptionaldepthTest: boolean

      If true, depth testing will be enabled when applying the effect (default is false)

    • OptionalnoViewport: boolean

      If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.

    • alphaMode: number = Constants.ALPHA_DISABLE

      The alpha mode to use when applying the effect (default is ALPHA_DISABLE)

    Returns boolean

    True if the effect was applied, otherwise false (effect not ready)

  • Binds a render target texture so that upcoming draw calls will render to it Note: it is a lazy operation, so the render target will only be bound when needed. This way, it is possible to call this method several times with different render targets without incurring the cost of binding if no draw calls are made

    Parameters

    • OptionalrenderTarget: any

      The handle of the render target texture to bind (default: undefined, meaning "back buffer"). Pass an array for MRT rendering.

    • applyImmediately: boolean = false

      If true, the render target will be applied immediately (otherwise it will be applied at first use). Default is false (delayed application).

    Returns void

  • Binds a texture handle to a given effect (resolves the handle to a texture and binds it to the effect)

    Parameters

    • effect: Effect

      The effect to bind the texture to

    • name: string

      The name of the texture in the effect

    • handle: FrameGraphTextureHandle

      The handle of the texture to bind

    Returns void

  • Clears the current render buffer or the current render target (if any is set up)

    Parameters

    • color: Nullable<IColor4Like>

      Defines the color to use

    • backBuffer: boolean

      Defines if the back buffer must be cleared

    • depth: boolean

      Defines if the depth buffer must be cleared

    • Optionalstencil: boolean

      Defines if the stencil buffer must be cleared

    • stencilClearValue: number = 0

      Defines the value to use to clear the stencil buffer (default is 0)

    Returns void

  • Clears all attachments (color(s) + depth/stencil) of the current render target

    Parameters

    • color: Nullable<IColor4Like>

      Defines the color to use

    • attachments: number[]

      The attachments to clear

    • backBuffer: boolean

      Defines if the back buffer must be cleared

    • depth: boolean

      Defines if the depth buffer must be cleared

    • Optionalstencil: boolean

      Defines if the stencil buffer must be cleared

    • stencilClearValue: number = 0

      Defines the value to use to clear the stencil buffer (default is 0)

    Returns void

  • Clears the color attachments of the current render target.

    Float, signed-integer, and unsigned-integer attachments can be mixed in the same layout.

    Parameters

    • color: Nullable<IColor4Like>

      Defines the color to use

    • attachments: number[]

      The attachments to clear

    Returns void

  • Copies a texture to the current render target

    Parameters

    • sourceTexture: FrameGraphTextureHandle

      The source texture to copy from

    • forceCopyToBackbuffer: boolean = false

      If true, the copy will be done to the back buffer regardless of the current render target

    • OptionalnoViewport: boolean

      If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.

    • lodLevel: number = 0

      The LOD level to use when copying the texture (default: 0).

    Returns void

  • Creates a (frame graph) render target wrapper Note that renderTargets or renderTargetDepth can be undefined, but not both at the same time!

    Parameters

    • name: string

      Name of the render target wrapper

    • OptionalrenderTargets: any

      Render target handles (textures) to use

    • OptionalrenderTargetDepth: any

      Render target depth handle (texture) to use

    • OptionaldepthReadOnly: boolean

      If true, the depth buffer will be read-only

    • OptionalstencilReadOnly: boolean

      If true, the stencil buffer will be read-only

    Returns FrameGraphRenderTarget

    The created render target wrapper

  • Generates mipmaps for the current render target

    Parameters

    • Optionalhandle: any

      Optional handle of the texture to generate mipmaps for (if not provided, will generate mipmaps for all textures in the current render target)

    Returns void

  • Gets a texture from a handle. Note that if the texture is a history texture, the read texture for the current frame will be returned.

    Parameters

    • handle: FrameGraphTextureHandle

      The handle of the texture

    Returns Nullable<InternalTexture>

    The texture or null if not found

  • Checks whether a texture handle points to the backbuffer's color or depth texture

    Parameters

    • handle: FrameGraphTextureHandle

      The handle to check

    Returns boolean

    True if the handle points to the backbuffer's color or depth texture, otherwise false

  • Checks whether a texture handle points to the backbuffer's color texture

    Parameters

    • handle: FrameGraphTextureHandle

      The handle to check

    Returns boolean

    True if the handle points to the backbuffer's color texture, otherwise false

  • Checks whether a texture handle points to the backbuffer's depth texture

    Parameters

    • handle: FrameGraphTextureHandle

      The handle to check

    Returns boolean

    True if the handle points to the backbuffer's depth texture, otherwise false

  • Renders a RenderTargetTexture or a layer

    Parameters

    • object: any

      The RenderTargetTexture/Layer to render

    • OptionalviewportWidth: number

      The width of the viewport (optional for Layer, but mandatory for ObjectRenderer)

    • OptionalviewportHeight: number

      The height of the viewport (optional for Layer, but mandatory for ObjectRenderer)

    • restoreDefaultFramebuffer: boolean = false

      If true, the default framebuffer will be restored after rendering (default: false)

    Returns void

  • Renders a component without managing the render target. Use this method when you have a component that handles its own rendering logic which is not fully integrated into the frame graph system.

    Parameters

    • component: { render: () => void }

      The component to render.

    • intermediateRendering: boolean = true

      If true, the scene's intermediate rendering flag will be set to true during the render call (default: true)

    Returns void

  • Sets the texture sampling mode for a given texture handle

    Parameters

    • handle: FrameGraphTextureHandle

      Handle of the texture to set the sampling mode for

    • samplingMode: number

      Sampling mode to set

    Returns void

  • Sets the current viewport

    Parameters

    • viewport: IViewportLike

      defines the viewport element to be used

    • OptionalrequiredWidth: number

      defines the width required for rendering. If not provided, the width of the render texture is used.

    • OptionalrequiredHeight: number

      defines the height required for rendering. If not provided the height of the render texture is used.

    Returns void