Class FrameGraphTextureManager
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
new FrameGraphTextureManager(
engine: AbstractEngine,
_debugTextures?: boolean,
_scene: Scene,
): FrameGraphTextureManagerConstructs a new instance of the texture manager
Parameters
- engine: AbstractEngine
The engine to use
- _debugTextures: boolean = false
If true, debug textures will be created so that they are visible in the inspector
- _scene: Scene
The scene the manager belongs to
Returns FrameGraphTextureManager
- engine: AbstractEngine
Properties
Readonlyengine
The engine to use
show Debug Logs For Texture Allcation Optimization
Gets or sets a boolean indicating if debug logs should be shown when applying texture allocation optimization (default: false)
Accessors
back Buffer Texture Overriden
-
get backBufferTextureOverriden(): boolean
True if the back buffer texture has been overriden by a call to setBackBufferTexture
Returns boolean
has History Textures
-
get hasHistoryTextures(): boolean
Returns true if the texture manager has at least one history texture
Returns boolean
Methods
compute Total Texture Size
-
computeTotalTextureSize(
optimizedSize: boolean,
outputWidth: number,
outputHeight: number,
): numberCalculates 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
- optimizedSize: boolean
create Dangling Handle
-
Creates a handle which is not associated with any texture. Call resolveDanglingHandle to associate the handle with a valid texture handle.
Returns number
The dangling handle
create Render Target
-
createRenderTarget(
name: string,
renderTargets?: any,
renderTargetDepth?: any,
depthReadOnly?: boolean,
stencilReadOnly?: boolean,
): FrameGraphRenderTargetCreates 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: anyRender target handles (textures) to use
OptionalrenderTargetDepth: anyRender target depth handle (texture) to use
OptionaldepthReadOnly: booleanIf true, the depth buffer will be read-only
OptionalstencilReadOnly: booleanIf true, the stencil buffer will be read-only
Returns FrameGraphRenderTarget
The created render target wrapper
- name: string
create Render Target Texture
-
createRenderTargetTexture(
name: string,
creationOptions: FrameGraphTextureCreationOptions,
handle?: any,
): FrameGraphTextureHandleCreates 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: anyExisting handle to use for the texture. If not provided (default), a new handle will be created.
Returns FrameGraphTextureHandle
The handle to the texture
- name: string
get Absolute Dimensions
-
getAbsoluteDimensions(
size: TextureSize,
screenWidth?: number,
screenHeight?: number,
): { height: number; width: number }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: numberThe width of the screen (default: the width of the rendering canvas)
OptionalscreenHeight: numberThe height of the screen (default: the height of the rendering canvas)
Returns { height: number; width: number }
The absolute dimensions of the texture
- size: TextureSize
get Texture Absolute Dimensions
-
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
- handleOrCreationOptions: any
get Texture Creation Options
-
getTextureCreationOptions(
handle: FrameGraphTextureHandle,
preserveHistoryTextureFlag?: boolean,
): FrameGraphTextureCreationOptionsGets 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
- handle: FrameGraphTextureHandle
get Texture Description
-
Gets the description of a texture
Parameters
- handle: FrameGraphTextureHandle
Handle of the texture
Returns FrameGraphTextureDescription
The description of the texture
- handle: FrameGraphTextureHandle
get Texture From Handle
-
getTextureFromHandle(
handle: FrameGraphTextureHandle,
historyGetWriteTexture?: boolean,
): Nullable<InternalTexture>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: booleanIf 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
- handle: FrameGraphTextureHandle
get Texture Handle Or Create Texture
-
getTextureHandleOrCreateTexture(
handle?: any,
newTextureName?: string,
creationOptions?: any,
): FrameGraphTextureHandleGets 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: anyIf provided, will simply return the handle
OptionalnewTextureName: stringName of the new texture to create
OptionalcreationOptions: anyOptions to use when creating the new texture
Returns FrameGraphTextureHandle
The handle to the texture.
import Texture
-
Imports a texture into the texture manager
Parameters
- name: string
Name of the texture
- texture: InternalTexture
Texture to import
Optionalhandle: anyExisting handle to use for the texture. If not provided (default), a new handle will be created.
Returns FrameGraphTextureHandle
The handle to the texture
- name: string
is Backbuffer
-
Checks if a handle is a backbuffer handle (color or depth/stencil)
Parameters
- handle: FrameGraphTextureHandle
The handle to check
Returns boolean
True if the handle is a backbuffer handle
- handle: FrameGraphTextureHandle
is Backbuffer Color
-
Checks if a handle is a backbuffer color handle
Parameters
- handle: FrameGraphTextureHandle
The handle to check
Returns boolean
True if the handle is a backbuffer color handle
- handle: FrameGraphTextureHandle
is Backbuffer Depth Stencil
-
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
- handle: FrameGraphTextureHandle
is History Texture
-
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
- handle: FrameGraphTextureHandle
reset Back Buffer Textures
-
Resets the back buffer color/depth-stencil textures to the default (the engine's current back buffer textures) It has no effect if setBackBufferTextures has not been called before.
Returns void
resolve Dangling Handle
-
resolveDanglingHandle(
danglingHandle: FrameGraphTextureHandle,
handle?: any,
newTextureName?: string,
creationOptions?: any,
): voidAssociates a texture with a dangling handle
Parameters
- danglingHandle: FrameGraphTextureHandle
The dangling handle
Optionalhandle: anyThe handle to associate with the dangling handle (if not provided, a new texture handle will be created, using the newTextureName and creationOptions parameters)
OptionalnewTextureName: stringThe name of the new texture to create (if handle is not provided)
OptionalcreationOptions: anyThe options to use when creating the new texture (if handle is not provided)
Returns void
- danglingHandle: FrameGraphTextureHandle
set Back Buffer Textures
-
setBackBufferTextures(
width: number,
height: number,
textureCreationOptions?: any,
depthStencilTextureCreationOptions?: any,
): voidOverrides 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: anyThe color texture creation options (optional)
OptionaldepthStencilTextureCreationOptions: anyThe depth/stencil texture creation options (optional)
Returns void
- width: number
StaticClone Texture Options
-
CloneTextureOptions(
options: FrameGraphTextureOptions,
textureIndex?: number,
preserveLabels?: boolean,
): FrameGraphTextureOptionsClones a texture options
Parameters
- options: FrameGraphTextureOptions
The options to clone
OptionaltextureIndex: numberThe index of the texture in the types, formats, etc array of FrameGraphTextureOptions. If not provided, all options are cloned.
OptionalpreserveLabels: booleanTrue if the labels should be preserved (default: false)
Returns FrameGraphTextureOptions
The cloned options
- options: FrameGraphTextureOptions
Manages the textures used by a frame graph