API

Class FrameGraphTextureManager

Manages the textures used by a frame graph

Index
engine: AbstractEngine

The engine to use

showDebugLogsForTextureAllcationOptimization: boolean = false

Gets or sets a boolean indicating if debug logs should be shown when applying texture allocation optimization (default: false)

  • Calculates the total byte size of all textures used by the frame graph texture manager (including external textures)

    Parameters

    • optimizedSize: boolean

      True if the calculation should not factor in aliased textures

    • outputWidth: number

      The output width of the frame graph. Will be used to calculate the size of percentage-based textures

    • outputHeight: number

      The output height of the frame graph. Will be used to calculate the size of percentage-based textures

    Returns number

    The total size of all textures

  • 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

  • Creates a new render target texture If multiple textures are described in FrameGraphTextureCreationOptions, the handle of the first texture is returned, handle+1 is the handle of the second texture, etc.

    Parameters

    • name: string

      Name of the texture

    • creationOptions: FrameGraphTextureCreationOptions

      Options to use when creating the texture

    • Optionalhandle: any

      Existing handle to use for the texture. If not provided (default), a new handle will be created.

    Returns FrameGraphTextureHandle

    The handle to the texture

  • Gets the absolute dimensions of a texture.

    Parameters

    • size: TextureSize

      The size of the texture. Width and height must be expressed as a percentage of the screen size (100=100%)!

    • OptionalscreenWidth: number

      The width of the screen (default: the width of the rendering canvas)

    • OptionalscreenHeight: number

      The height of the screen (default: the height of the rendering canvas)

    Returns { height: number; width: number }

    The absolute dimensions of the texture

  • Gets the absolute dimensions of a texture from its handle or creation options.

    Parameters

    • handleOrCreationOptions: any

      The handle or creation options of the texture

    Returns { height: number; width: number }

    The absolute dimensions of the texture

  • Gets the creation options of a texture

    Parameters

    • handle: FrameGraphTextureHandle

      Handle of the texture

    • preserveHistoryTextureFlag: boolean = false

      If true, the isHistoryTexture flag in the returned creation options will be the same as when the texture was created (default: false)

    Returns FrameGraphTextureCreationOptions

    The creation options of the texture

  • Gets the description of a texture

    Parameters

    • handle: FrameGraphTextureHandle

      Handle of the texture

    Returns FrameGraphTextureDescription

    The description of the texture

  • 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, except if historyGetWriteTexture is true.

    Parameters

    • handle: FrameGraphTextureHandle

      The handle of the texture

    • OptionalhistoryGetWriteTexture: boolean

      If true and the texture is a history texture, the write texture for the current frame will be returned (default: false)

    Returns Nullable<InternalTexture>

    The texture or null if not found

  • Gets a texture handle or creates a new texture if the handle is not provided. If handle is not provided, newTextureName and creationOptions must be provided.

    Parameters

    • Optionalhandle: any

      If provided, will simply return the handle

    • OptionalnewTextureName: string

      Name of the new texture to create

    • OptionalcreationOptions: any

      Options to use when creating the new texture

    Returns FrameGraphTextureHandle

    The handle to the texture.

  • Imports a texture into the texture manager

    Parameters

    • name: string

      Name of the texture

    • texture: InternalTexture

      Texture to import

    • Optionalhandle: any

      Existing handle to use for the texture. If not provided (default), a new handle will be created.

    Returns FrameGraphTextureHandle

    The handle to the texture

  • Checks if a handle is a backbuffer depth/stencil handle

    Parameters

    • handle: FrameGraphTextureHandle

      The handle to check

    Returns boolean

    True if the handle is a backbuffer depth/stencil handle

  • Checks if a handle is a history texture (or points to a history texture, for a dangling handle)

    Parameters

    • handle: FrameGraphTextureHandle

      The handle to check

    • checkAllTextures: boolean = false

      If false (default), the function will check if the handle is the main handle of a history texture (the first handle of the history texture). If true, the function will also check if the handle is one of the other handles of a history texture.

    Returns boolean

    True if the handle is a history texture, otherwise false

  • Associates a texture with a dangling handle

    Parameters

    • danglingHandle: FrameGraphTextureHandle

      The dangling handle

    • Optionalhandle: any

      The handle to associate with the dangling handle (if not provided, a new texture handle will be created, using the newTextureName and creationOptions parameters)

    • OptionalnewTextureName: string

      The name of the new texture to create (if handle is not provided)

    • OptionalcreationOptions: any

      The options to use when creating the new texture (if handle is not provided)

    Returns void

  • Overrides the default back buffer color/depth-stencil textures used by the frame graph. Note that if both textureCreationOptions and depthStencilTextureCreationOptions are provided, the engine will use them to create the back buffer color and depth/stencil textures respectively. In that case, width and height are ignored.

    Parameters

    • width: number

      The width of the back buffer color/depth-stencil texture (if 0, the engine's current back buffer color/depth-stencil texture width will be used)

    • height: number

      The height of the back buffer color/depth-stencil texture (if 0, the engine's current back buffer color/depth-stencil texture height will be used)

    • OptionaltextureCreationOptions: any

      The color texture creation options (optional)

    • OptionaldepthStencilTextureCreationOptions: any

      The depth/stencil texture creation options (optional)

    Returns void

  • Clones a texture options

    Parameters

    • options: FrameGraphTextureOptions

      The options to clone

    • OptionaltextureIndex: number

      The index of the texture in the types, formats, etc array of FrameGraphTextureOptions. If not provided, all options are cloned.

    • OptionalpreserveLabels: boolean

      True if the labels should be preserved (default: false)

    Returns FrameGraphTextureOptions

    The cloned options