Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AdvancedDynamicTexture

Class used to create texture to support 2D GUI elements

see

https://doc.babylonjs.com/how_to/gui

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new AdvancedDynamicTexture(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean): AdvancedDynamicTexture
  • Creates a new AdvancedDynamicTexture

    Parameters

    • name: string

      defines the name of the texture

    • width: number | undefined

      defines the width of the texture

    • height: number | undefined

      defines the height of the texture

    • scene: Nullable<Scene>

      defines the hosting scene

    • Optional generateMipMaps: boolean

      defines a boolean indicating if mipmaps must be generated (false by default)

    • Optional samplingMode: number

      defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)

    • Optional invertY: boolean

      defines if the texture needs to be inverted on the y axis during loading (true by default)

    Returns AdvancedDynamicTexture

Properties

animationsSearch playground for animations

animations: Animation[]

Define the list of animation attached to the texture.

anisotropicFilteringLevelSearch playground for anisotropicFilteringLevel

anisotropicFilteringLevel: number

With compliant hardware and browser (supporting anisotropic filtering) this defines the level of anisotropic filtering in the texture. The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.

applyYInversionOnUpdateSearch playground for applyYInversionOnUpdate

applyYInversionOnUpdate: boolean

Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture

coordinatesIndexSearch playground for coordinatesIndex

coordinatesIndex: number

Define the UV chanel to use starting from 0 and defaulting to 0. This is part of the texture as textures usually maps to one uv set.

delayLoadStateSearch playground for delayLoadState

delayLoadState: number

Define the current state of the loading sequence when in delayed load mode.

getAlphaFromRGBSearch playground for getAlphaFromRGB

getAlphaFromRGB: boolean

Defines if the alpha value should be determined via the rgb values. If true the luminance of the pixel might be used to find the corresponding alpha value.

homogeneousRotationInUVTransformSearch playground for homogeneousRotationInUVTransform

homogeneousRotationInUVTransform: boolean

Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling

inspectableCustomPropertiesSearch playground for inspectableCustomProperties

inspectableCustomProperties: Nullable<IInspectable[]>

List of inspectable custom properties (used by the Inspector)

see

https://doc.babylonjs.com/how_to/debug_layer#extensibility

invertZSearch playground for invertZ

invertZ: boolean

Is Z inverted in the texture (useful in a cube texture).

isRenderTargetSearch playground for isRenderTarget

isRenderTarget: boolean

Define if the texture is a render target.

levelSearch playground for level

level: number

Intensity or strength of the texture. It is commonly used by materials to fine tune the intensity of the texture

metadataSearch playground for metadata

metadata: any

Gets or sets an object used to store user defined information.

nameSearch playground for name

name: string

Define the name of the texture.

onBeginLayoutObservableSearch playground for onBeginLayoutObservable

onBeginLayoutObservable: Observable<AdvancedDynamicTexture>

BABYLON.Observable event triggered before layout is evaluated

onBeginRenderObservableSearch playground for onBeginRenderObservable

onBeginRenderObservable: Observable<AdvancedDynamicTexture>

BABYLON.Observable event triggered before the texture is rendered

onClipboardObservableSearch playground for onClipboardObservable

onClipboardObservable: Observable<ClipboardInfo>

BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas

onControlPickedObservableSearch playground for onControlPickedObservable

onControlPickedObservable: Observable<Control>

BABYLON.Observable event triggered each time a pointer down is intercepted by a control

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<BaseTexture>

An event triggered when the texture is disposed.

onEndLayoutObservableSearch playground for onEndLayoutObservable

onEndLayoutObservable: Observable<AdvancedDynamicTexture>

BABYLON.Observable event triggered after the layout was evaluated

onEndRenderObservableSearch playground for onEndRenderObservable

onEndRenderObservable: Observable<AdvancedDynamicTexture>

BABYLON.Observable event triggered after the texture was rendered

onLoadObservableSearch playground for onLoadObservable

onLoadObservable: Observable<Texture>

Observable triggered once the texture has been loaded.

premulAlphaSearch playground for premulAlpha

premulAlpha: boolean

Gets or sets a boolean defining if alpha is stored as premultiplied

reservedDataStoreSearch playground for reservedDataStore

reservedDataStore: any

For internal use only. Please do not use.

uAngSearch playground for uAng

uAng: number

Define an offset on the texture to rotate around the u coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials

uOffsetSearch playground for uOffset

uOffset: number

Define an offset on the texture to offset the u coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#offsetting

uRotationCenterSearch playground for uRotationCenter

uRotationCenter: number

Defines the center of rotation (U)

uScaleSearch playground for uScale

uScale: number

Define an offset on the texture to scale the u coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#tiling

uniqueIdSearch playground for uniqueId

uniqueId: number

Gets or sets the unique id of the texture

urlSearch playground for url

url: Nullable<string>

Define the url of the texture.

vAngSearch playground for vAng

vAng: number

Define an offset on the texture to rotate around the v coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials

vOffsetSearch playground for vOffset

vOffset: number

Define an offset on the texture to offset the v coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#offsetting

vRotationCenterSearch playground for vRotationCenter

vRotationCenter: number

Defines the center of rotation (V)

vScaleSearch playground for vScale

vScale: number

Define an offset on the texture to scale the v coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#tiling

wAngSearch playground for wAng

wAng: number

Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)

see

https://doc.babylonjs.com/how_to/more_materials

wRotationCenterSearch playground for wRotationCenter

wRotationCenter: number

Defines the center of rotation (W)

wrapRSearch playground for wrapR

wrapR: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

Static Readonly BILINEAR_SAMPLINGMODESearch playground for BILINEAR_SAMPLINGMODE

BILINEAR_SAMPLINGMODE: number

Bilinear is mag = linear and min = linear and mip = nearest

Static Readonly CLAMP_ADDRESSMODESearch playground for CLAMP_ADDRESSMODE

CLAMP_ADDRESSMODE: number

Texture is not repeating outside of 0..1 UVs

Static Readonly CUBIC_MODESearch playground for CUBIC_MODE

CUBIC_MODE: number

Cubic coordinates mode

Static DEFAULT_ANISOTROPIC_FILTERING_LEVELSearch playground for DEFAULT_ANISOTROPIC_FILTERING_LEVEL

DEFAULT_ANISOTROPIC_FILTERING_LEVEL: number

Default anisotropic filtering level for the application. It is set to 4 as a good tradeoff between perf and quality.

Static Readonly EQUIRECTANGULAR_MODESearch playground for EQUIRECTANGULAR_MODE

EQUIRECTANGULAR_MODE: number

Equirectangular coordinates mode

Static Readonly EXPLICIT_MODESearch playground for EXPLICIT_MODE

EXPLICIT_MODE: number

Explicit coordinates mode

Static Readonly FIXED_EQUIRECTANGULAR_MIRRORED_MODESearch playground for FIXED_EQUIRECTANGULAR_MIRRORED_MODE

FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number

Equirectangular Fixed Mirrored coordinates mode

Static Readonly FIXED_EQUIRECTANGULAR_MODESearch playground for FIXED_EQUIRECTANGULAR_MODE

FIXED_EQUIRECTANGULAR_MODE: number

Equirectangular Fixed coordinates mode

Static ForceSerializeBuffersSearch playground for ForceSerializeBuffers

ForceSerializeBuffers: boolean

Gets or sets a general boolean used to indicate that texture buffers must be saved as part of the serialization process. If no buffer exists, one will be created as base64 string from the internal webgl data.

Static Readonly INVCUBIC_MODESearch playground for INVCUBIC_MODE

INVCUBIC_MODE: number

Inverse Cubic coordinates mode

Static Readonly LINEAR_LINEARSearch playground for LINEAR_LINEAR

LINEAR_LINEAR: number

mag = linear and min = linear and mip = none

Static Readonly LINEAR_LINEAR_MIPLINEARSearch playground for LINEAR_LINEAR_MIPLINEAR

LINEAR_LINEAR_MIPLINEAR: number

Trilinear is mag = linear and min = linear and mip = linear

Static Readonly LINEAR_LINEAR_MIPNEARESTSearch playground for LINEAR_LINEAR_MIPNEAREST

LINEAR_LINEAR_MIPNEAREST: number

Bilinear is mag = linear and min = linear and mip = nearest

Static Readonly LINEAR_NEARESTSearch playground for LINEAR_NEAREST

LINEAR_NEAREST: number

mag = linear and min = nearest and mip = none

Static Readonly LINEAR_NEAREST_MIPLINEARSearch playground for LINEAR_NEAREST_MIPLINEAR

LINEAR_NEAREST_MIPLINEAR: number

mag = linear and min = nearest and mip = linear

Static Readonly LINEAR_NEAREST_MIPNEARESTSearch playground for LINEAR_NEAREST_MIPNEAREST

LINEAR_NEAREST_MIPNEAREST: number

mag = linear and min = nearest and mip = nearest

Static Readonly MIRROR_ADDRESSMODESearch playground for MIRROR_ADDRESSMODE

MIRROR_ADDRESSMODE: number

Texture is repeating and mirrored

Static Readonly NEAREST_LINEARSearch playground for NEAREST_LINEAR

NEAREST_LINEAR: number

mag = nearest and min = linear and mip = none

Static Readonly NEAREST_LINEAR_MIPLINEARSearch playground for NEAREST_LINEAR_MIPLINEAR

NEAREST_LINEAR_MIPLINEAR: number

mag = nearest and min = linear and mip = linear

Static Readonly NEAREST_LINEAR_MIPNEARESTSearch playground for NEAREST_LINEAR_MIPNEAREST

NEAREST_LINEAR_MIPNEAREST: number

mag = nearest and min = linear and mip = nearest

Static Readonly NEAREST_NEARESTSearch playground for NEAREST_NEAREST

NEAREST_NEAREST: number

mag = nearest and min = nearest and mip = none

Static Readonly NEAREST_NEAREST_MIPLINEARSearch playground for NEAREST_NEAREST_MIPLINEAR

NEAREST_NEAREST_MIPLINEAR: number

nearest is mag = nearest and min = nearest and mip = linear

Static Readonly NEAREST_NEAREST_MIPNEARESTSearch playground for NEAREST_NEAREST_MIPNEAREST

NEAREST_NEAREST_MIPNEAREST: number

mag = nearest and min = nearest and mip = nearest

Static Readonly NEAREST_SAMPLINGMODESearch playground for NEAREST_SAMPLINGMODE

NEAREST_SAMPLINGMODE: number

nearest is mag = nearest and min = nearest and mip = linear

Static Readonly PLANAR_MODESearch playground for PLANAR_MODE

PLANAR_MODE: number

Planar coordinates mode

Static Readonly PROJECTION_MODESearch playground for PROJECTION_MODE

PROJECTION_MODE: number

Projection coordinates mode

Static Readonly SKYBOX_MODESearch playground for SKYBOX_MODE

SKYBOX_MODE: number

Inverse Cubic coordinates mode

Static Readonly SPHERICAL_MODESearch playground for SPHERICAL_MODE

SPHERICAL_MODE: number

Spherical coordinates mode

Static SerializeBuffersSearch playground for SerializeBuffers

SerializeBuffers: boolean

Gets or sets a general boolean used to indicate that textures containing direct data (buffers) must be saved as part of the serialization process

Static Readonly TRILINEAR_SAMPLINGMODESearch playground for TRILINEAR_SAMPLINGMODE

TRILINEAR_SAMPLINGMODE: number

Trilinear is mag = linear and min = linear and mip = linear

Static UseSerializedUrlIfAnySearch playground for UseSerializedUrlIfAny

UseSerializedUrlIfAny: boolean

Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file

Static Readonly WRAP_ADDRESSMODESearch playground for WRAP_ADDRESSMODE

WRAP_ADDRESSMODE: number

Texture is repeating outside of 0..1 UVs

Accessors

background

  • get background(): string
  • set background(value: string): any
  • Gets or sets the background color

    Returns string

  • Gets or sets the background color

    Parameters

    • value: string

    Returns any

canRescale

  • get canRescale(): boolean

clipboardData

  • get clipboardData(): string
  • set clipboardData(value: string): any
  • Gets or set information about clipboardData

    Returns string

  • Gets or set information about clipboardData

    Parameters

    • value: string

    Returns any

coordinatesMode

  • get coordinatesMode(): number
  • set coordinatesMode(value: number): any
  • How a texture is mapped.

    Value Type Description
    0 EXPLICIT_MODE
    1 SPHERICAL_MODE
    2 PLANAR_MODE
    3 CUBIC_MODE
    4 PROJECTION_MODE
    5 SKYBOX_MODE
    6 INVCUBIC_MODE
    7 EQUIRECTANGULAR_MODE
    8 FIXED_EQUIRECTANGULAR_MODE
    9 FIXED_EQUIRECTANGULAR_MIRRORED_MODE

    Returns number

  • How a texture is mapped.

    Value Type Description
    0 EXPLICIT_MODE
    1 SPHERICAL_MODE
    2 PLANAR_MODE
    3 CUBIC_MODE
    4 PROJECTION_MODE
    5 SKYBOX_MODE
    6 INVCUBIC_MODE
    7 EQUIRECTANGULAR_MODE
    8 FIXED_EQUIRECTANGULAR_MODE
    9 FIXED_EQUIRECTANGULAR_MIRRORED_MODE

    Parameters

    • value: number

    Returns any

focusedControl

  • Gets or sets the current focused control

    Returns Nullable<IFocusableControl>

  • Gets or sets the current focused control

    Parameters

    Returns any

gammaSpace

  • get gammaSpace(): boolean
  • set gammaSpace(gamma: boolean): any
  • Define if the texture contains data in gamma space (most of the png/jpg aside bump). HDR texture are usually stored in linear space. This only impacts the PBR and Background materials

    Returns boolean

  • Define if the texture contains data in gamma space (most of the png/jpg aside bump). HDR texture are usually stored in linear space. This only impacts the PBR and Background materials

    Parameters

    • gamma: boolean

    Returns any

hasAlpha

  • get hasAlpha(): boolean
  • set hasAlpha(value: boolean): any
  • Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).

    Returns boolean

  • Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).

    Parameters

    • value: boolean

    Returns any

idealHeight

  • get idealHeight(): number
  • set idealHeight(value: number): any

idealRatio

  • get idealRatio(): number

idealWidth

  • get idealWidth(): number
  • set idealWidth(value: number): any

invertY

  • get invertY(): boolean
  • Gets a boolean indicating if the texture needs to be inverted on the y axis during loading

    Returns boolean

irradianceTexture

  • In case a better definition than spherical harmonics is required for the diffuse part of the environment. You can set the irradiance texture to rely on a texture instead of the spherical approach. This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).

    Returns Nullable<BaseTexture>

  • In case a better definition than spherical harmonics is required for the diffuse part of the environment. You can set the irradiance texture to rely on a texture instead of the spherical approach. This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).

    Parameters

    Returns any

is2DArray

  • get is2DArray(): boolean
  • set is2DArray(value: boolean): any
  • Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.

    Returns boolean

  • Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.

    Parameters

    • value: boolean

    Returns any

is3D

  • get is3D(): boolean
  • set is3D(value: boolean): any
  • Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.

    Returns boolean

  • Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.

    Parameters

    • value: boolean

    Returns any

isBlocking

  • get isBlocking(): boolean
  • set isBlocking(value: boolean): any
  • Is the texture preventing material to render while loading. If false, a default texture will be used instead of the loading one during the preparation step.

    Returns boolean

  • Is the texture preventing material to render while loading. If false, a default texture will be used instead of the loading one during the preparation step.

    Parameters

    • value: boolean

    Returns any

isCube

  • get isCube(): boolean
  • set isCube(value: boolean): any
  • Define if the texture is a cube texture or if false a 2d texture.

    Returns boolean

  • Define if the texture is a cube texture or if false a 2d texture.

    Parameters

    • value: boolean

    Returns any

isForeground

  • get isForeground(): boolean
  • set isForeground(value: boolean): any
  • Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode

    Returns boolean

  • Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode

    Parameters

    • value: boolean

    Returns any

isRGBD

  • get isRGBD(): boolean
  • set isRGBD(value: boolean): any
  • Gets or sets whether or not the texture contains RGBD data.

    Returns boolean

  • Gets or sets whether or not the texture contains RGBD data.

    Parameters

    • value: boolean

    Returns any

layer

  • Gets the underlying layer used to render the texture when in fullscreen mode

    Returns Nullable<Layer>

linearSpecularLOD

  • get linearSpecularLOD(): boolean
  • set linearSpecularLOD(value: boolean): any
  • With prefiltered texture, defined if the specular generation is based on a linear ramp. By default we are using a log2 of the linear roughness helping to keep a better resolution for average roughness values.

    Returns boolean

  • With prefiltered texture, defined if the specular generation is based on a linear ramp. By default we are using a log2 of the linear roughness helping to keep a better resolution for average roughness values.

    Parameters

    • value: boolean

    Returns any

lodGenerationOffset

  • get lodGenerationOffset(): number
  • set lodGenerationOffset(value: number): any
  • With prefiltered texture, defined the offset used during the prefiltering steps.

    Returns number

  • With prefiltered texture, defined the offset used during the prefiltering steps.

    Parameters

    • value: number

    Returns any

lodGenerationScale

  • get lodGenerationScale(): number
  • set lodGenerationScale(value: number): any
  • With prefiltered texture, defined the scale used during the prefiltering steps.

    Returns number

  • With prefiltered texture, defined the scale used during the prefiltering steps.

    Parameters

    • value: number

    Returns any

mimeType

  • get mimeType(): string | undefined
  • Returns the texture mime type if it was defined by a loader (undefined else)

    Returns string | undefined

noMipmap

  • get noMipmap(): boolean

numLayoutCalls

  • get numLayoutCalls(): number
  • Gets the number of layout calls made the last time the ADT has been rendered

    Returns number

numRenderCalls

  • get numRenderCalls(): number
  • Gets the number of render calls made the last time the ADT has been rendered

    Returns number

onDispose

  • set onDispose(callback: () => void): any
  • Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns any

renderAtIdealSize

  • get renderAtIdealSize(): boolean
  • set renderAtIdealSize(value: boolean): any

renderScale

  • get renderScale(): number
  • set renderScale(value: number): any
  • Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger). Useful when you want more antialiasing

    Returns number

  • Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger). Useful when you want more antialiasing

    Parameters

    • value: number

    Returns any

rootContainer

  • Gets the root container control

    Returns Container

samplingMode

  • get samplingMode(): number
  • Get the current sampling mode associated with the texture.

    Returns number

textureFormat

  • get textureFormat(): number
  • Get the texture underlying format (RGB, RGBA...)

    Returns number

textureType

  • get textureType(): number
  • Get the texture underlying type (INT, FLOAT...)

    Returns number

uid

  • get uid(): string
  • Define the unique id of the texture in the scene.

    Returns string

useInvalidateRectOptimization

  • get useInvalidateRectOptimization(): boolean
  • set useInvalidateRectOptimization(value: boolean): any
  • Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on

    Returns boolean

  • Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on

    Parameters

    • value: boolean

    Returns any

useSmallestIdeal

  • get useSmallestIdeal(): boolean
  • set useSmallestIdeal(value: boolean): any

wrapU

  • get wrapU(): number
  • set wrapU(value: number): any
  • Value Type Description
    0 CLAMP_ADDRESSMODE
    1 WRAP_ADDRESSMODE
    2 MIRROR_ADDRESSMODE

    Returns number

  • Value Type Description
    0 CLAMP_ADDRESSMODE
    1 WRAP_ADDRESSMODE
    2 MIRROR_ADDRESSMODE

    Parameters

    • value: number

    Returns any

wrapV

  • get wrapV(): number
  • set wrapV(value: number): any
  • Value Type Description
    0 CLAMP_ADDRESSMODE
    1 WRAP_ADDRESSMODE
    2 MIRROR_ADDRESSMODE

    Returns number

  • Value Type Description
    0 CLAMP_ADDRESSMODE
    1 WRAP_ADDRESSMODE
    2 MIRROR_ADDRESSMODE

    Parameters

    • value: number

    Returns any

Methods

addControlSearch playground for addControl

  • Adds a new control to the root container

    Parameters

    • control: Control

      defines the control to add

    Returns AdvancedDynamicTexture

    the current texture

attachSearch playground for attach

  • attach(): void
  • Attach to all scene events required to support pointer events

    Returns void

attachToMeshSearch playground for attachToMesh

  • attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void
  • Connect the texture to a hosting mesh to enable interactions

    Parameters

    • mesh: AbstractMesh

      defines the mesh to attach to

    • Optional supportPointerMove: boolean

      defines a boolean indicating if pointer move events must be catched as well

    Returns void

checkTransformsAreIdenticalSearch playground for checkTransformsAreIdentical

clearSearch playground for clear

  • clear(): void
  • Clears the texture

    Returns void

cloneSearch playground for clone

createStyleSearch playground for createStyle

disposeSearch playground for dispose

  • dispose(): void
  • Release all resources

    Returns void

drawTextSearch playground for drawText

  • drawText(text: string, x: number | null | undefined, y: number | null | undefined, font: string, color: string | null, clearColor: string, invertY?: boolean, update?: boolean): void
  • Draws text onto the texture

    Parameters

    • text: string

      defines the text to be drawn

    • x: number | null | undefined

      defines the placement of the text from the left

    • y: number | null | undefined

      defines the placement of the text from the top when invertY is true and from the bottom when false

    • font: string

      defines the font to be used with font-style, font-size, font-name

    • color: string | null

      defines the color used for the text

    • clearColor: string

      defines the color for the canvas, use null to not overwrite canvas

    • Optional invertY: boolean

      defines the direction for the Y axis (default is true - y increases downwards)

    • Optional update: boolean

      defines whether texture is immediately update (default is true)

    Returns void

executeOnAllControlsSearch playground for executeOnAllControls

  • executeOnAllControls(func: (control: Control) => void, container?: Container): void
  • Function used to execute a function on all controls

    Parameters

    • func: (control: Control) => void

      defines the function to execute

    • Optional container: Container

      defines the container where controls belong. If null the root container will be used

    Returns void

getBaseSizeSearch playground for getBaseSize

  • Get the base size of the texture. It can be different from the size if the texture has been resized for POT for instance

    Returns ISize

    the base size

getChildrenSearch playground for getChildren

  • Returns an array containing the root container. This is mostly used to let the Inspector introspects the ADT

    Returns Array<Container>

    an array containing the rootContainer

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Get the current class name of the texture useful for serialization or dynamic coding.

    Returns string

    "AdvancedDynamicTexture"

getContextSearch playground for getContext

getDescendantsSearch playground for getDescendants

  • getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[]
  • Will return all controls that are inside this texture

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: (control: Control) => boolean

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • Parameters

          Returns boolean

    Returns Control[]

    all child controls

getInternalTextureSearch playground for getInternalTexture

getProjectedPositionSearch playground for getProjectedPosition

  • Get screen coordinates for a vector3

    Parameters

    • position: Vector3

      defines the position to project

    • worldMatrix: Matrix

      defines the world matrix to use

    Returns Vector2

    the projected position

getProjectedPositionWithZSearch playground for getProjectedPositionWithZ

  • Get screen coordinates for a vector3

    Parameters

    • position: Vector3

      defines the position to project

    • worldMatrix: Matrix

      defines the world matrix to use

    Returns Vector3

    the projected position with Z

getReflectionTextureMatrixSearch playground for getReflectionTextureMatrix

  • getReflectionTextureMatrix(): Matrix

getSceneSearch playground for getScene

  • Get the scene the texture belongs to.

    Returns Nullable<Scene>

    the scene or null if undefined

getSizeSearch playground for getSize

  • Get the size of the texture.

    Returns ISize

    the texture size.

getTextureMatrixSearch playground for getTextureMatrix

  • getTextureMatrix(uBase?: number): Matrix
  • Get the current texture matrix which includes the requested offsetting, tiling and rotation components.

    Parameters

    • Optional uBase: number

    Returns Matrix

    the transform matrix of the texture.

invalidateRectSearch playground for invalidateRect

  • invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void
  • Invalidates a rectangle area on the gui texture

    Parameters

    • invalidMinX: number

      left most position of the rectangle to invalidate in the texture

    • invalidMinY: number

      top most position of the rectangle to invalidate in the texture

    • invalidMaxX: number

      right most position of the rectangle to invalidate in the texture

    • invalidMaxY: number

      bottom most position of the rectangle to invalidate in the texture

    Returns void

isReadySearch playground for isReady

  • isReady(): boolean
  • Get if the texture is ready to be used (downloaded, converted, mip mapped...).

    Returns boolean

    true if fully ready

isReadyOrNotBlockingSearch playground for isReadyOrNotBlocking

  • isReadyOrNotBlocking(): boolean
  • Get if the texture is ready to be consumed (either it is ready or it is not blocking)

    Returns boolean

    true if ready or not blocking

markAsDirtySearch playground for markAsDirty

  • markAsDirty(): void
  • Marks the texture as dirty forcing a complete update

    Returns void

moveFocusToControlSearch playground for moveFocusToControl

  • Move the focus to a specific control

    Parameters

    Returns void

readPixelsSearch playground for readPixels

  • readPixels(faceIndex?: number, level?: number, buffer?: Nullable<ArrayBufferView>): Nullable<ArrayBufferView>
  • Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer. This will returns an RGBA array buffer containing either in values (0-255) or float values (0-1) depending of the underlying buffer type.

    Parameters

    • Optional faceIndex: number

      defines the face of the texture to read (in case of cube texture)

    • Optional level: number

      defines the LOD level of the texture to read (in case of Mip Maps)

    • Optional buffer: Nullable<ArrayBufferView>

      defines a user defined buffer to fill with data (can be null)

    Returns Nullable<ArrayBufferView>

    The Array buffer containing the pixels data.

registerClipboardEventsSearch playground for registerClipboardEvents

  • registerClipboardEvents(): void
  • Register the clipboard Events onto the canvas

    Returns void

releaseInternalTextureSearch playground for releaseInternalTexture

  • releaseInternalTexture(): void
  • Release and destroy the underlying lower level texture aka internalTexture.

    Returns void

removeControlSearch playground for removeControl

  • Removes a control from the root container

    Parameters

    • control: Control

      defines the control to remove

    Returns AdvancedDynamicTexture

    the current texture

scaleSearch playground for scale

  • scale(ratio: number): void
  • Scales the texture

    Parameters

    • ratio: number

      the scale factor to apply to both width and height

    Returns void

scaleToSearch playground for scaleTo

  • scaleTo(width: number, height: number): void
  • Resizes the texture

    Parameters

    • width: number

      the new width

    • height: number

      the new height

    Returns void

serializeSearch playground for serialize

  • serialize(): any
  • Serializes the dynamic texture. The scene should be ready before the dynamic texture is serialized

    Returns any

    a serialized dynamic texture object

toStringSearch playground for toString

  • toString(): string
  • Return a string representation of the texture.

    Returns string

    the texture as a string

unRegisterClipboardEventsSearch playground for unRegisterClipboardEvents

  • unRegisterClipboardEvents(): void
  • Unregister the clipboard Events from the canvas

    Returns void

updateSearch playground for update

  • update(invertY?: boolean, premulAlpha?: boolean): void
  • Updates the texture

    Parameters

    • Optional invertY: boolean

      defines the direction for the Y axis (default is true - y increases downwards)

    • Optional premulAlpha: boolean

      defines if alpha is stored as premultiplied (default is false)

    Returns void

updateSamplingModeSearch playground for updateSamplingMode

  • updateSamplingMode(samplingMode: number): void
  • Update the sampling mode of the texture. Default is Trilinear mode.

    Value Type Description
    1 NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR Nearest is: mag = nearest, min = nearest, mip = linear
    2 BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST Bilinear is: mag = linear, min = linear, mip = nearest
    3 TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR Trilinear is: mag = linear, min = linear, mip = linear
    4 NEAREST_NEAREST_MIPNEAREST
    5 NEAREST_LINEAR_MIPNEAREST
    6 NEAREST_LINEAR_MIPLINEAR
    7 NEAREST_LINEAR
    8 NEAREST_NEAREST
    9 LINEAR_NEAREST_MIPNEAREST
    10 LINEAR_NEAREST_MIPLINEAR
    11 LINEAR_LINEAR
    12 LINEAR_NEAREST

    mag: magnification filter (close to the viewer) min: minification filter (far from the viewer) mip: filter used between mip map levels

    Parameters

    • samplingMode: number

      Define the new sampling mode of the texture

    Returns void

updateURLSearch playground for updateURL

  • updateURL(url: string, buffer?: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob>, onLoad?: () => void): void
  • Update the url (and optional buffer) of this texture if url was null during construction.

    Parameters

    • url: string

      the url of the texture

    • Optional buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob>

      the buffer of the texture (defaults to null)

    • Optional onLoad: () => void

      callback called when the texture is loaded (defaults to null)

        • (): void
        • Returns void

    Returns void

Static CreateForMeshSearch playground for CreateForMesh

  • Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)

    Parameters

    • mesh: AbstractMesh

      defines the mesh which will receive the texture

    • Optional width: number

      defines the texture width (1024 by default)

    • Optional height: number

      defines the texture height (1024 by default)

    • Optional supportPointerMove: boolean

      defines a boolean indicating if the texture must capture move events (true by default)

    • Optional onlyAlphaTesting: boolean

      defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)

    • Optional invertY: boolean

      defines if the texture needs to be inverted on the y axis during loading (true by default)

    Returns AdvancedDynamicTexture

    a new AdvancedDynamicTexture

Static CreateForMeshTextureSearch playground for CreateForMeshTexture

  • Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture

    Parameters

    • mesh: AbstractMesh

      defines the mesh which will receive the texture

    • Optional width: number

      defines the texture width (1024 by default)

    • Optional height: number

      defines the texture height (1024 by default)

    • Optional supportPointerMove: boolean

      defines a boolean indicating if the texture must capture move events (true by default)

    • Optional invertY: boolean

      defines if the texture needs to be inverted on the y axis during loading (true by default)

    Returns AdvancedDynamicTexture

    a new AdvancedDynamicTexture

Static CreateFromBase64StringSearch playground for CreateFromBase64String

  • CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<() => void>, format?: number): Texture
  • Creates a texture from its base 64 representation.

    Parameters

    • data: string

      Define the base64 payload without the data: prefix

    • name: string

      Define the name of the texture in the scene useful fo caching purpose for instance

    • scene: Scene

      Define the scene the texture should belong to

    • Optional noMipmap: boolean

      Forces the texture to not create mip map information if true

    • Optional invertY: boolean

      define if the texture needs to be inverted on the y axis during loading

    • Optional samplingMode: number

      define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)

    • Optional onLoad: Nullable<() => void>

      define a callback triggered when the texture has been loaded

    • Optional onError: Nullable<() => void>

      define a callback triggered when an error occurred during the loading session

    • Optional format: number

      define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)

    Returns Texture

    the created texture

Static CreateFullscreenUISearch playground for CreateFullscreenUI

  • Creates a new AdvancedDynamicTexture in fullscreen mode. In this mode the texture will rely on a layer for its rendering. This allows it to be treated like any other layer. As such, if you have a multi camera setup, you can set the layerMask on the GUI as well. LayerMask is set through advancedTexture.layer.layerMask

    Parameters

    • name: string

      defines name for the texture

    • Optional foreground: boolean

      defines a boolean indicating if the texture must be rendered in foreground (default is true)

    • Optional scene: Nullable<Scene>

      defines the hsoting scene

    • Optional sampling: number

      defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)

    Returns AdvancedDynamicTexture

    a new AdvancedDynamicTexture

Static LoadFromDataStringSearch playground for LoadFromDataString

  • LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number): Texture
  • Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)

    Parameters

    • name: string

      Define the name of the texture in the scene useful fo caching purpose for instance

    • buffer: any

      define the buffer to load the texture from in case the texture is loaded from a buffer representation

    • scene: Scene

      Define the scene the texture should belong to

    • Optional deleteBuffer: boolean

      define if the buffer we are loading the texture from should be deleted after load

    • Optional noMipmap: boolean

      Forces the texture to not create mip map information if true

    • Optional invertY: boolean

      define if the texture needs to be inverted on the y axis during loading

    • Optional samplingMode: number

      define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)

    • Optional onLoad: Nullable<() => void>

      define a callback triggered when the texture has been loaded

    • Optional onError: Nullable<(message?: string, exception?: any) => void>

      define a callback triggered when an error occurred during the loading session

    • Optional format: number

      define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)

    Returns Texture

    the created texture

Static ParseSearch playground for Parse

  • Parse the JSON representation of a texture in order to recreate the texture in the given scene.

    Parameters

    • parsedTexture: any

      Define the JSON representation of the texture

    • scene: Scene

      Define the scene the parsed texture should be instantiated in

    • rootUrl: string

      Define the root url of the parsing sequence in the case of relative dependencies

    Returns Nullable<BaseTexture>

    The parsed texture if successful

Static WhenAllReadySearch playground for WhenAllReady

  • WhenAllReady(textures: BaseTexture[], callback: () => void): void
  • Helper function to be called back once a list of texture contains only ready textures.

    Parameters

    • textures: BaseTexture[]

      Define the list of textures to wait for

    • callback: () => void

      Define the callback triggered once the entire list will be ready

        • (): void
        • Returns void

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static method