AdvancedDynamicTexture

Class used to create texture to support 2D GUI elements

see

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

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Find examples in Playground
  • new AdvancedDynamicTexture(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number): 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)

    Returns AdvancedDynamicTexture

Properties

animations

Find examples in Playground
animations: Animation[]

Define the list of animation attached to the texture.

anisotropicFilteringLevel

Find examples in Playground
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.

background

Find examples in Playground
background: string

Gets or sets the background color

canRescale

Find examples in Playground
canRescale: boolean

Gets the current state of canRescale

clipboardData

Find examples in Playground
clipboardData: string

Gets or set information about clipboardData

coordinatesIndex

Find examples in Playground
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.

coordinatesMode

Find examples in Playground
coordinatesMode: 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

delayLoadState

Find examples in Playground
delayLoadState: number

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

focusedControl

Find examples in Playground
focusedControl: Nullable<IFocusableControl>

Gets or sets the current focused control

gammaSpace

Find examples in Playground
gammaSpace: 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

getAlphaFromRGB

Find examples in Playground
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.

hasAlpha

Find examples in Playground
hasAlpha: boolean

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

idealHeight

Find examples in Playground
idealHeight: number

Gets or sets the ideal height used to design controls. The GUI will then rescale everything accordingly

see

http://doc.babylonjs.com/how_to/gui#adaptive-scaling

idealWidth

Find examples in Playground
idealWidth: number

Gets or sets the ideal width used to design controls. The GUI will then rescale everything accordingly

see

http://doc.babylonjs.com/how_to/gui#adaptive-scaling

inspectableCustomProperties

Find examples in Playground
inspectableCustomProperties: Nullable<IInspectable[]>

List of inspectable custom properties (used by the Inspector)

see

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

invertY

Find examples in Playground
invertY: boolean

Gets a boolean indicating if the texture needs to be inverted on the y axis during loading

invertZ

Find examples in Playground
invertZ: boolean

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

is3D

Find examples in Playground
is3D: boolean

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

isBlocking

Find examples in Playground
isBlocking: 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.

isCube

Find examples in Playground
isCube: boolean

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

isForeground

Find examples in Playground
isForeground: boolean

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

isRGBD

Find examples in Playground
isRGBD: boolean

Gets whether or not the texture contains RGBD data.

isRenderTarget

Find examples in Playground
isRenderTarget: boolean

Define if the texture is a render target.

layer

Find examples in Playground
layer: Nullable<Layer>

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

level

Find examples in Playground
level: number

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

lodGenerationOffset

Find examples in Playground
lodGenerationOffset: number

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

lodGenerationScale

Find examples in Playground
lodGenerationScale: number

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

metadata

Find examples in Playground
metadata: any

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

name

Find examples in Playground
name: string

Define the name of the texture.

noMipmap

Find examples in Playground
noMipmap: boolean

Are mip maps generated for this texture or not.

onBeginLayoutObservable

Find examples in Playground
onBeginLayoutObservable: Observable<AdvancedDynamicTexture>

BABYLON.Observable event triggered before layout is evaluated

onBeginRenderObservable

Find examples in Playground
onBeginRenderObservable: Observable<AdvancedDynamicTexture>

BABYLON.Observable event triggered before the texture is rendered

onClipboardObservable

Find examples in Playground
onClipboardObservable: Observable<ClipboardInfo>

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

onControlPickedObservable

Find examples in Playground
onControlPickedObservable: Observable<Control>

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

onDispose

Find examples in Playground
onDispose: function

Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.

Type declaration

    • (): void
    • Returns void

onDisposeObservable

Find examples in Playground
onDisposeObservable: Observable<BaseTexture>

An event triggered when the texture is disposed.

onEndLayoutObservable

Find examples in Playground
onEndLayoutObservable: Observable<AdvancedDynamicTexture>

BABYLON.Observable event triggered after the layout was evaluated

onEndRenderObservable

Find examples in Playground
onEndRenderObservable: Observable<AdvancedDynamicTexture>

BABYLON.Observable event triggered after the texture was rendered

onLoadObservable

Find examples in Playground
onLoadObservable: Observable<Texture>

Observable triggered once the texture has been loaded.

premulAlpha

Find examples in Playground
premulAlpha: boolean

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

renderAtIdealSize

Find examples in Playground
renderAtIdealSize: boolean

Gets or sets a boolean indicating if adaptive scaling must be used

see

http://doc.babylonjs.com/how_to/gui#adaptive-scaling

renderScale

Find examples in Playground
renderScale: 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

reservedDataStore

Find examples in Playground
reservedDataStore: any

For internal use only. Please do not use.

rootContainer

Find examples in Playground
rootContainer: Container

Gets the root container control

samplingMode

Find examples in Playground
samplingMode: number

Get the current sampling mode associated with the texture.

sphericalPolynomial

Find examples in Playground
sphericalPolynomial: Nullable<SphericalPolynomial>

Get the polynomial representation of the texture data. This is mainly use as a fast way to recover IBL Diffuse irradiance data.

see

https://learnopengl.com/PBR/IBL/Diffuse-irradiance

textureFormat

Find examples in Playground
textureFormat: number

Get the texture underlying format (RGB, RGBA...)

textureType

Find examples in Playground
textureType: number

Get the texture underlying type (INT, FLOAT...)

uAng

Find examples in Playground
uAng: number

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

see

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

uOffset

Find examples in Playground
uOffset: number

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

see

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

uRotationCenter

Find examples in Playground
uRotationCenter: number

Defines the center of rotation (U)

uScale

Find examples in Playground
uScale: number

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

see

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

uid

Find examples in Playground
uid: string

Define the unique id of the texture in the scene.

uniqueId

Find examples in Playground
uniqueId: number

Gets or sets the unique id of the texture

url

Find examples in Playground
url: Nullable<string>

Define the url of the texture.

useInvalidateRectOptimization

Find examples in Playground
useInvalidateRectOptimization: boolean

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

useSmallestIdeal

Find examples in Playground
useSmallestIdeal: boolean

Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set

see

http://doc.babylonjs.com/how_to/gui#adaptive-scaling

vAng

Find examples in Playground
vAng: number

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

see

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

vOffset

Find examples in Playground
vOffset: number

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

see

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

vRotationCenter

Find examples in Playground
vRotationCenter: number

Defines the center of rotation (V)

vScale

Find examples in Playground
vScale: number

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

see

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

wAng

Find examples in Playground
wAng: number

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

see

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

wRotationCenter

Find examples in Playground
wRotationCenter: number

Defines the center of rotation (W)

wrapR

Find examples in Playground
wrapR: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

wrapU

Find examples in Playground
wrapU: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

wrapV

Find examples in Playground
wrapV: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

Static BILINEAR_SAMPLINGMODE

Find examples in Playground
BILINEAR_SAMPLINGMODE: number

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

Static CLAMP_ADDRESSMODE

Find examples in Playground
CLAMP_ADDRESSMODE: number

Texture is not repeating outside of 0..1 UVs

Static CUBIC_MODE

Find examples in Playground
CUBIC_MODE: number

Cubic coordinates mode

Static DEFAULT_ANISOTROPIC_FILTERING_LEVEL

Find examples in Playground
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 EQUIRECTANGULAR_MODE

Find examples in Playground
EQUIRECTANGULAR_MODE: number

Equirectangular coordinates mode

Static EXPLICIT_MODE

Find examples in Playground
EXPLICIT_MODE: number

Explicit coordinates mode

Static FIXED_EQUIRECTANGULAR_MIRRORED_MODE

Find examples in Playground
FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number

Equirectangular Fixed Mirrored coordinates mode

Static FIXED_EQUIRECTANGULAR_MODE

Find examples in Playground
FIXED_EQUIRECTANGULAR_MODE: number

Equirectangular Fixed coordinates mode

Static INVCUBIC_MODE

Find examples in Playground
INVCUBIC_MODE: number

Inverse Cubic coordinates mode

Static LINEAR_LINEAR

Find examples in Playground
LINEAR_LINEAR: number

mag = linear and min = linear and mip = none

Static LINEAR_LINEAR_MIPLINEAR

Find examples in Playground
LINEAR_LINEAR_MIPLINEAR: number

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

Static LINEAR_LINEAR_MIPNEAREST

Find examples in Playground
LINEAR_LINEAR_MIPNEAREST: number

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

Static LINEAR_NEAREST

Find examples in Playground
LINEAR_NEAREST: number

mag = linear and min = nearest and mip = none

Static LINEAR_NEAREST_MIPLINEAR

Find examples in Playground
LINEAR_NEAREST_MIPLINEAR: number

mag = linear and min = nearest and mip = linear

Static LINEAR_NEAREST_MIPNEAREST

Find examples in Playground
LINEAR_NEAREST_MIPNEAREST: number

mag = linear and min = nearest and mip = nearest

Static MIRROR_ADDRESSMODE

Find examples in Playground
MIRROR_ADDRESSMODE: number

Texture is repeating and mirrored

Static NEAREST_LINEAR

Find examples in Playground
NEAREST_LINEAR: number

mag = nearest and min = linear and mip = none

Static NEAREST_LINEAR_MIPLINEAR

Find examples in Playground
NEAREST_LINEAR_MIPLINEAR: number

mag = nearest and min = linear and mip = linear

Static NEAREST_LINEAR_MIPNEAREST

Find examples in Playground
NEAREST_LINEAR_MIPNEAREST: number

mag = nearest and min = linear and mip = nearest

Static NEAREST_NEAREST

Find examples in Playground
NEAREST_NEAREST: number

mag = nearest and min = nearest and mip = none

Static NEAREST_NEAREST_MIPLINEAR

Find examples in Playground
NEAREST_NEAREST_MIPLINEAR: number

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

Static NEAREST_NEAREST_MIPNEAREST

Find examples in Playground
NEAREST_NEAREST_MIPNEAREST: number

mag = nearest and min = nearest and mip = nearest

Static NEAREST_SAMPLINGMODE

Find examples in Playground
NEAREST_SAMPLINGMODE: number

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

Static PLANAR_MODE

Find examples in Playground
PLANAR_MODE: number

Planar coordinates mode

Static PROJECTION_MODE

Find examples in Playground
PROJECTION_MODE: number

Projection coordinates mode

Static SKYBOX_MODE

Find examples in Playground
SKYBOX_MODE: number

Inverse Cubic coordinates mode

Static SPHERICAL_MODE

Find examples in Playground
SPHERICAL_MODE: number

Spherical coordinates mode

Static TRILINEAR_SAMPLINGMODE

Find examples in Playground
TRILINEAR_SAMPLINGMODE: number

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

Static UseSerializedUrlIfAny

Find examples in Playground
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 WRAP_ADDRESSMODE

Find examples in Playground
WRAP_ADDRESSMODE: number

Texture is repeating outside of 0..1 UVs

Methods

addControl

Find examples in Playground
  • Adds a new control to the root container

    Parameters

    • control: Control

      defines the control to add

    Returns AdvancedDynamicTexture

    the current texture

attach

Find examples in Playground
  • attach(): void
  • Attach to all scene events required to support pointer events

    Returns void

attachToMesh

Find examples in Playground
  • 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

clear

Find examples in Playground
  • clear(): void

clone

Find examples in Playground

createStyle

Find examples in Playground

dispose

Find examples in Playground
  • dispose(): void

drawText

Find examples in Playground
  • drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void
  • Draws text onto the texture

    Parameters

    • text: string

      defines the text to be drawn

    • x: number

      defines the placement of the text from the left

    • y: number

      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

      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

executeOnAllControls

Find examples in Playground
  • executeOnAllControls(func: function, container?: Container): void
  • Function used to execute a function on all controls

    Parameters

    • func: function

      defines the function to execute

    • Optional container: Container

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

    Returns void

getBaseSize

Find examples in Playground
  • 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

getChildren

Find examples in Playground
  • 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

getClassName

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

    Returns string

    "AdvancedDynamicTexture"

getContext

Find examples in Playground
  • getContext(): CanvasRenderingContext2D
  • Gets the context of the canvas used by the texture

    Returns CanvasRenderingContext2D

    the canvas context of the dynamic texture

getDescendants

Find examples in Playground
  • getDescendants(directDescendantsOnly?: boolean, predicate?: function): 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: function

      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

getInternalTexture

Find examples in Playground

getProjectedPosition

Find examples in Playground
  • 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

getReflectionTextureMatrix

Find examples in Playground
  • getReflectionTextureMatrix(): Matrix

getScene

Find examples in Playground

getSize

Find examples in Playground

getTextureMatrix

Find examples in Playground

invalidateRect

Find examples in Playground
  • 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

isReady

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

    Returns boolean

    true if fully ready

isReadyOrNotBlocking

Find examples in Playground
  • 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

markAsDirty

Find examples in Playground
  • markAsDirty(): void
  • Marks the texture as dirty forcing a complete update

    Returns void

moveFocusToControl

Find examples in Playground
  • Move the focus to a specific control

    Parameters

    Returns void

readPixels

Find examples in Playground
  • 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.

registerClipboardEvents

Find examples in Playground
  • registerClipboardEvents(): void
  • Register the clipboard Events onto the canvas

    Returns void

releaseInternalTexture

Find examples in Playground
  • releaseInternalTexture(): void

removeControl

Find examples in Playground
  • Removes a control from the root container

    Parameters

    • control: Control

      defines the control to remove

    Returns AdvancedDynamicTexture

    the current texture

scale

Find examples in Playground
  • scale(ratio: number): void

scaleTo

Find examples in Playground
  • scaleTo(width: number, height: number): void
  • Resizes the texture

    Parameters

    • width: number

      the new width

    • height: number

      the new height

    Returns void

serialize

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

    Returns any

    a serialized dynamic texture object

toString

Find examples in Playground
  • toString(): string
  • Return a string representation of the texture.

    Returns string

    the texture as a string

unRegisterClipboardEvents

Find examples in Playground
  • unRegisterClipboardEvents(): void
  • Unregister the clipboard Events from the canvas

    Returns void

update

Find examples in Playground
  • 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

updateSamplingMode

Find examples in Playground
  • 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

updateURL

Find examples in Playground
  • updateURL(url: string, buffer?: Nullable<string | ArrayBuffer | HTMLImageElement | Blob>, onLoad?: function): 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 | HTMLImageElement | Blob>

      the buffer of the texture (defaults to null)

    • Optional onLoad: function

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

        • (): void
        • Returns void

    Returns void

Static CreateForMesh

Find examples in Playground
  • 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)

    Returns AdvancedDynamicTexture

    a new AdvancedDynamicTexture

Static CreateFromBase64String

Find examples in Playground
  • CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<function>, onError?: Nullable<function>, 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<function>

      define a callback triggered when the texture has been loaded

    • Optional onError: Nullable<function>

      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 CreateFullscreenUI

Find examples in Playground
  • 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 LoadFromDataString

Find examples in Playground
  • LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<function>, onError?: Nullable<function>, 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<function>

      define a callback triggered when the texture has been loaded

    • Optional onError: Nullable<function>

      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 Parse

Find examples in Playground
  • 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 WhenAllReady

Find examples in Playground
  • WhenAllReady(textures: BaseTexture[], callback: function): 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: function

      Define the callback triggered once the entire list will be ready

        • (): void
        • Returns void

    Returns void

Generated using TypeDoc