Class AdvancedDynamicTexture
Hierarchy
- DynamicTexture
- AdvancedDynamicTexture
Index
Constructors
Properties
- animations
- anisotropic
Filtering Level - applyYInversion
On Update - check
Pointer Every Frame - delay
Load State - homogeneous
Rotation InUVTransform - inspectable
Custom Properties - invertZ
- is
Render Target - level
- metadata
- name
- on
Begin Layout Observable - on
Begin Render Observable - on
Clipboard Observable - on
Control Picked Observable - on
Dispose Observable - on
End Layout Observable - on
End Render Observable - on
Gui Ready Observable - on
Load Observable - optimizeUVAllocation
- parse
Content - premul
Alpha - reserved
Data Store - snippet
Id - spherical
Polynomial - u
Ang - u
Offset - u
Rotation Center - u
Scale - unique
Id - url
- v
Ang - v
Offset - v
Rotation Center - v
Scale - w
Ang - w
Rotation Center - wrapR
- AllowGPUOptimizations
- BILINEAR_
SAMPLINGMODE - CLAMP_
ADDRESSMODE - CUBIC_
MODE - DEFAULT_
ANISOTROPIC_ FILTERING_ LEVEL - EQUIRECTANGULAR_
MODE - EXPLICIT_
MODE - FIXED_
EQUIRECTANGULAR_ MIRRORED_ MODE - FIXED_
EQUIRECTANGULAR_ MODE - Force
Serialize Buffers - INVCUBIC_
MODE - LINEAR_
LINEAR - LINEAR_
LINEAR_ MIPLINEAR - LINEAR_
LINEAR_ MIPNEAREST - LINEAR_
NEAREST - LINEAR_
NEAREST_ MIPLINEAR - LINEAR_
NEAREST_ MIPNEAREST - MIRROR_
ADDRESSMODE - NEAREST_
LINEAR - NEAREST_
LINEAR_ MIPLINEAR - NEAREST_
LINEAR_ MIPNEAREST - NEAREST_
NEAREST - NEAREST_
NEAREST_ MIPLINEAR - NEAREST_
NEAREST_ MIPNEAREST - NEAREST_
SAMPLINGMODE - On
Texture Load Error Observable - PLANAR_
MODE - PROJECTION_
MODE - SKYBOX_
MODE - SPHERICAL_
MODE - Serialize
Buffers - Snippet
Url - TRILINEAR_
SAMPLINGMODE - Use
Serialized Url If Any - WRAP_
ADDRESSMODE
Accessors
- background
- can
Rescale - clipboard
Data - coordinates
Index - coordinates
Mode - error
Object - focused
Control - gamma
Space - get
Alpha FromRGB - has
Alpha - ideal
Height - ideal
Ratio - ideal
Width - invertY
- irradiance
Texture - is2DArray
- is3D
- is
Blocking - is
Cube - is
Foreground - isRGBD
- layer
- linear
SpecularLOD - loading
Error - lod
Generation Offset - lod
Generation Scale - mime
Type - no
Mipmap - num
Layout Calls - num
Render Calls - on
Dispose - render
At Ideal Size - render
Scale - root
Container - sampling
Mode - texture
Format - texture
Type - uid
- use
Invalidate Rect Optimization - use
Smallest Ideal - wrapU
- wrapV
Methods
- add
Control - attach
- attach
To Mesh - check
Transforms Are Identical - clear
- clone
- create
Style - dispose
- draw
Text - execute
On All Controls - force
Spherical Polynomials Recompute - get
Base Size - get
Children - get
Class Name - get
Context - get
Control By Name - get
Controls By Type - get
Descendants - get
Internal Texture - get
Projected Position - get
Projected Position WithZ - get
Reflection Texture Matrix - get
Scene - get
Size - get
Texture Matrix - gui
Is Ready - invalidate
Rect - is
Ready - is
Ready Or Not Blocking - mark
As Dirty - move
Focus To Control - move
To Non Overlapped Position - parse
From Snippet Async - parse
FromURLAsync - parse
Serialized Object - pick
- read
Pixels - register
Clipboard Events - release
Internal Texture - remove
Control - scale
- scale
To - serialize
- serialize
Content - to
String - un
Register Clipboard Events - update
- update
Sampling Mode - updateURL
- Create
For Mesh - Create
For Mesh Texture - Create
From Base64 String - Create
FullscreenUI - Load
From Data String - Parse
- Parse
From File Async - Parse
From Snippet Async - When
All Ready
Constructors
constructor
Creates a new AdvancedDynamicTexture
Parameters
name: string
defines the name of the texture
Optional width: number
defines the width of the texture
Optional height: number
defines the height of the texture
Optional 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
Define the list of animation attached to the texture.
anisotropic Filtering LevelSearch playground for anisotropicFilteringLevel
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.
applyYInversion On UpdateSearch playground for applyYInversionOnUpdate
Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
check Pointer Every FrameSearch playground for checkPointerEveryFrame
If set to true, every scene render will trigger a pointer event for the GUI if it is linked to a mesh or has controls linked to a mesh. This will allow you to catch the pointer moving around the GUI due to camera or mesh movements, but it has a performance cost.
delay Load StateSearch playground for delayLoadState
Define the current state of the loading sequence when in delayed load mode.
homogeneous Rotation InUVTransformSearch playground for homogeneousRotationInUVTransform
Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling
inspectable Custom PropertiesSearch playground for inspectableCustomProperties
List of inspectable custom properties (used by the Inspector)
invertZSearch playground for invertZ
Is Z inverted in the texture (useful in a cube texture).
is Render TargetSearch playground for isRenderTarget
Define if the texture is a render target.
levelSearch playground for level
Intensity or strength of the texture. It is commonly used by materials to fine tune the intensity of the texture
metadataSearch playground for metadata
Gets or sets an object used to store user defined information.
nameSearch playground for name
Define the name of the texture.
on Begin Layout ObservableSearch playground for onBeginLayoutObservable
BABYLON.Observable event triggered before layout is evaluated
on Begin Render ObservableSearch playground for onBeginRenderObservable
BABYLON.Observable event triggered before the texture is rendered
on Clipboard ObservableSearch playground for onClipboardObservable
BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
on Control Picked ObservableSearch playground for onControlPickedObservable
BABYLON.Observable event triggered each time a pointer down is intercepted by a control
on Dispose ObservableSearch playground for onDisposeObservable
An event triggered when the texture is disposed.
on End Layout ObservableSearch playground for onEndLayoutObservable
BABYLON.Observable event triggered after the layout was evaluated
on End Render ObservableSearch playground for onEndRenderObservable
BABYLON.Observable event triggered after the texture was rendered
on Gui Ready ObservableSearch playground for onGuiReadyObservable
BABYLON.Observable that fires when the GUI is ready
on Load ObservableSearch playground for onLoadObservable
Observable triggered once the texture has been loaded.
optimizeUVAllocationSearch playground for optimizeUVAllocation
Gets or sets a boolean indicating that the texture should try to reduce shader code if there is no UV manipulation. (ie. when texture.getTextureMatrix().isIdentityAs3x2() returns true)
parse ContentSearch playground for parseContent
Type declaration
Recreate the content of the ADT from a JSON object
Parameters
serializedObject: any
define the JSON serialized object to restore from
Optional scaleToSize: boolean
defines whether to scale to texture to the saved size
Returns void
premul AlphaSearch playground for premulAlpha
Gets or sets a boolean defining if alpha is stored as premultiplied
reserved Data StoreSearch playground for reservedDataStore
For internal use only. Please do not use.
snippet IdSearch playground for snippetId
Snippet ID if the content was created from the snippet server
spherical PolynomialSearch playground for sphericalPolynomial
Get the polynomial representation of the texture data. This is mainly use as a fast way to recover IBL Diffuse irradiance data.
u AngSearch playground for uAng
Define an offset on the texture to rotate around the u coordinates of the UVs The angle is defined in radians.
u OffsetSearch playground for uOffset
Define an offset on the texture to offset the u coordinates of the UVs
u Rotation CenterSearch playground for uRotationCenter
Defines the center of rotation (U)
u ScaleSearch playground for uScale
Define an offset on the texture to scale the u coordinates of the UVs
unique IdSearch playground for uniqueId
Gets or sets the unique id of the texture
urlSearch playground for url
Define the url of the texture.
v AngSearch playground for vAng
Define an offset on the texture to rotate around the v coordinates of the UVs The angle is defined in radians.
v OffsetSearch playground for vOffset
Define an offset on the texture to offset the v coordinates of the UVs
v Rotation CenterSearch playground for vRotationCenter
Defines the center of rotation (V)
v ScaleSearch playground for vScale
Define an offset on the texture to scale the v coordinates of the UVs
w AngSearch playground for wAng
Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture) The angle is defined in radians.
w Rotation CenterSearch playground for wRotationCenter
Defines the center of rotation (W)
wrapRSearch playground for wrapR
Value | Type | Description |
---|---|---|
0 | CLAMP_ADDRESSMODE | |
1 | WRAP_ADDRESSMODE | |
2 | MIRROR_ADDRESSMODE |
Static AllowGPUOptimizationsSearch playground for AllowGPUOptimizations
Indicates if some optimizations can be performed in GUI GPU management (the downside is additional memory/GPU texture memory used)
Static Readonly BILINEAR_ SAMPLINGMODESearch playground for BILINEAR_SAMPLINGMODE
Bilinear is mag = linear and min = linear and no mip
Static Readonly CLAMP_ ADDRESSMODESearch playground for CLAMP_ADDRESSMODE
Texture is not repeating outside of 0..1 UVs
Static Readonly CUBIC_ MODESearch playground for CUBIC_MODE
Cubic coordinates mode
Static DEFAULT_ ANISOTROPIC_ FILTERING_ LEVELSearch playground for DEFAULT_ANISOTROPIC_FILTERING_LEVEL
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 coordinates mode
Static Readonly EXPLICIT_ MODESearch playground for EXPLICIT_MODE
Explicit coordinates mode
Static Readonly FIXED_ EQUIRECTANGULAR_ MIRRORED_ MODESearch playground for FIXED_EQUIRECTANGULAR_MIRRORED_MODE
Equirectangular Fixed Mirrored coordinates mode
Static Readonly FIXED_ EQUIRECTANGULAR_ MODESearch playground for FIXED_EQUIRECTANGULAR_MODE
Equirectangular Fixed coordinates mode
Static Force Serialize BuffersSearch playground for ForceSerializeBuffers
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
Inverse Cubic coordinates mode
Static Readonly LINEAR_ LINEARSearch playground for LINEAR_LINEAR
mag = linear and min = linear and mip = none
Static Readonly LINEAR_ LINEAR_ MIPLINEARSearch playground for LINEAR_LINEAR_MIPLINEAR
Trilinear is mag = linear and min = linear and mip = linear
Static Readonly LINEAR_ LINEAR_ MIPNEARESTSearch playground for LINEAR_LINEAR_MIPNEAREST
Bilinear is mag = linear and min = linear and mip = nearest
Static Readonly LINEAR_ NEARESTSearch playground for LINEAR_NEAREST
mag = linear and min = nearest and mip = none
Static Readonly LINEAR_ NEAREST_ MIPLINEARSearch playground for LINEAR_NEAREST_MIPLINEAR
mag = linear and min = nearest and mip = linear
Static Readonly LINEAR_ NEAREST_ MIPNEARESTSearch playground for LINEAR_NEAREST_MIPNEAREST
mag = linear and min = nearest and mip = nearest
Static Readonly MIRROR_ ADDRESSMODESearch playground for MIRROR_ADDRESSMODE
Texture is repeating and mirrored
Static Readonly NEAREST_ LINEARSearch playground for NEAREST_LINEAR
mag = nearest and min = linear and mip = none
Static Readonly NEAREST_ LINEAR_ MIPLINEARSearch playground for NEAREST_LINEAR_MIPLINEAR
mag = nearest and min = linear and mip = linear
Static Readonly NEAREST_ LINEAR_ MIPNEARESTSearch playground for NEAREST_LINEAR_MIPNEAREST
mag = nearest and min = linear and mip = nearest
Static Readonly NEAREST_ NEARESTSearch playground for NEAREST_NEAREST
mag = nearest and min = nearest and mip = none
Static Readonly NEAREST_ NEAREST_ MIPLINEARSearch playground for NEAREST_NEAREST_MIPLINEAR
nearest is mag = nearest and min = nearest and mip = linear
Static Readonly NEAREST_ NEAREST_ MIPNEARESTSearch playground for NEAREST_NEAREST_MIPNEAREST
mag = nearest and min = nearest and mip = nearest
Static Readonly NEAREST_ SAMPLINGMODESearch playground for NEAREST_SAMPLINGMODE
nearest is mag = nearest and min = nearest and no mip
Static On Texture Load Error ObservableSearch playground for OnTextureLoadErrorObservable
This observable will notify when any texture had a loading error
Static Readonly PLANAR_ MODESearch playground for PLANAR_MODE
Planar coordinates mode
Static Readonly PROJECTION_ MODESearch playground for PROJECTION_MODE
Projection coordinates mode
Static Readonly SKYBOX_ MODESearch playground for SKYBOX_MODE
Inverse Cubic coordinates mode
Static Readonly SPHERICAL_ MODESearch playground for SPHERICAL_MODE
Spherical coordinates mode
Static Serialize BuffersSearch playground for SerializeBuffers
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 Snippet UrlSearch playground for SnippetUrl
Define the Uurl to load snippets
Static Readonly TRILINEAR_ SAMPLINGMODESearch playground for TRILINEAR_SAMPLINGMODE
Trilinear is mag = linear and min = linear and mip = linear
Static Use Serialized Url If AnySearch playground for UseSerializedUrlIfAny
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
Texture is repeating outside of 0..1 UVs
Accessors
background
Gets or sets the background color
Returns string
Gets or sets the background color
Parameters
value: string
Returns void
can Rescale
Gets the current state of canRescale
Returns boolean
clipboard Data
Gets or set information about clipboardData
Returns string
Gets or set information about clipboardData
Parameters
value: string
Returns void
coordinates Index
Define the UV channel to use starting from 0 and defaulting to 0. This is part of the texture as textures usually maps to one uv set.
Returns number
Define the UV channel to use starting from 0 and defaulting to 0. This is part of the texture as textures usually maps to one uv set.
Parameters
value: number
Returns void
coordinates Mode
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 void
error Object
If a loading error occurred this object will be populated with information about the error.
Returns undefined | { exception?: any; message?: string }
focused Control
Gets or sets the current focused control
Returns Nullable<IFocusableControl>
Gets or sets the current focused control
Parameters
control: Nullable<IFocusableControl>
Returns void
gamma Space
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 void
get Alpha FromRGB
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.
Returns 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.
Parameters
value: boolean
Returns void
has Alpha
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 void
ideal Height
Gets or sets the ideal height used to design controls. The GUI will then rescale everything accordingly
Returns number
Gets or sets the ideal height used to design controls. The GUI will then rescale everything accordingly
Parameters
value: number
Returns void
ideal Ratio
Gets the ratio used when in "ideal mode"
Returns number
ideal Width
Gets or sets the ideal width used to design controls. The GUI will then rescale everything accordingly
Returns number
Gets or sets the ideal width used to design controls. The GUI will then rescale everything accordingly
Parameters
value: number
Returns void
invertY
Gets a boolean indicating if the texture needs to be inverted on the y axis during loading
Returns boolean
irradiance Texture
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
value: Nullable<BaseTexture>
Returns void
is2DArray
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 void
is3D
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 void
is Blocking
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 void
is Cube
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 void
is Foreground
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 void
isRGBD
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 void
layer
linear SpecularLOD
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 void
loading Error
Was there any loading error?
Returns boolean
lod Generation Offset
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 void
lod Generation Scale
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 void
mime Type
Returns the texture mime type if it was defined by a loader (undefined else)
Returns undefined | string
no Mipmap
Are mip maps generated for this texture or not.
Returns boolean
num Layout Calls
Gets the number of layout calls made the last time the ADT has been rendered
Returns number
num Render Calls
Gets the number of render calls made the last time the ADT has been rendered
Returns number
on Dispose
Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.
Parameters
callback: (() => void)
Returns void
Returns void
render At Ideal Size
Gets or sets a boolean indicating if adaptive scaling must be used
Returns boolean
Gets or sets a boolean indicating if adaptive scaling must be used
Parameters
value: boolean
Returns void
render Scale
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 void
root Container
Gets the root container control
Returns Container
sampling Mode
Get the current sampling mode associated with the texture.
Returns number
texture Format
Get the texture underlying format (RGB, RGBA...)
Returns number
texture Type
Get the texture underlying type (INT, FLOAT...)
Returns number
uid
Define the unique id of the texture in the scene.
Returns string
use Invalidate Rect Optimization
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 void
use Smallest Ideal
Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
Returns boolean
Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
Parameters
value: boolean
Returns void
wrapU
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 void
wrapV
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 void
Methods
add ControlSearch 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 to all scene events required to support pointer events
Returns void
attach To MeshSearch playground for attachToMesh
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
check Transforms Are IdenticalSearch playground for checkTransformsAreIdentical
clearSearch playground for clear
Clears the texture
Returns void
cloneSearch playground for clone
Clones the ADT
Parameters
Optional newName: string
defines the name of the new ADT
Returns AdvancedDynamicTexture
the clone of the ADT
create StyleSearch playground for createStyle
Helper function used to create a new style
Returns Style
a new style
disposeSearch playground for dispose
Release all resources
Returns void
draw TextSearch playground for drawText
Draws text onto the texture
Parameters
text: string
defines the text to be drawn
x: undefined | null | number
defines the placement of the text from the left
y: undefined | null | 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: null | string
defines the color used for the text
clearColor: null | 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
execute On All ControlsSearch playground for executeOnAllControls
force Spherical Polynomials RecomputeSearch playground for forceSphericalPolynomialsRecompute
Force recomputation of spherical polynomials. Can be useful if you generate a cubemap multiple times (from a probe for eg) and you need the proper polynomials each time
Returns void
get Base SizeSearch 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
get ChildrenSearch playground for getChildren
Returns an array containing the root container. This is mostly used to let the Inspector introspects the ADT
Returns Container[]
an array containing the rootContainer
get Class NameSearch playground for getClassName
Get the current class name of the texture useful for serialization or dynamic coding.
Returns string
"AdvancedDynamicTexture"
get ContextSearch playground for getContext
Gets the context of the canvas used by the texture
Returns ICanvasRenderingContext
the canvas context of the dynamic texture
get Control By NameSearch playground for getControlByName
get Controls By TypeSearch playground for getControlsByType
Will return all controls with the given type name
Parameters
typeName: string
defines the type name to search for
Returns Control[]
an array of all controls found
get DescendantsSearch playground for getDescendants
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
control: Control
Returns boolean
Returns Control[]
all child controls
get Internal TextureSearch playground for getInternalTexture
Get the underlying lower level texture from Babylon.
Returns Nullable<InternalTexture>
the internal texture
get Projected PositionSearch playground for getProjectedPosition
get Projected Position WithZSearch playground for getProjectedPositionWithZ
get Reflection Texture MatrixSearch playground for getReflectionTextureMatrix
Get the current matrix used to apply reflection. This is useful to rotate an environment texture for instance.
Returns Matrix
The reflection texture transform
get SceneSearch playground for getScene
get SizeSearch playground for getSize
Get the size of the texture.
Returns ISize
the texture size.
get Texture MatrixSearch playground for getTextureMatrix
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.
gui Is ReadySearch playground for guiIsReady
Returns true if all the GUI components are ready to render
Returns boolean
invalidate RectSearch playground for invalidateRect
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
is ReadySearch playground for isReady
Get if the texture is ready to be used (downloaded, converted, mip mapped...).
Returns boolean
true if fully ready
is Ready Or Not BlockingSearch playground for isReadyOrNotBlocking
Get if the texture is ready to be consumed (either it is ready or it is not blocking)
Returns boolean
true if ready, not blocking or if there was an error loading the texture
mark As DirtySearch playground for markAsDirty
Marks the texture as dirty forcing a complete update
Returns void
move Focus To ControlSearch playground for moveFocusToControl
Move the focus to a specific control
Parameters
control: IFocusableControl
defines the control which will receive the focus
Returns void
move To Non Overlapped PositionSearch playground for moveToNonOverlappedPosition
Moves overlapped controls towards a position where it is not overlapping anymore. Please note that this method alters linkOffsetXInPixels and linkOffsetYInPixels.
Parameters
Optional overlapGroup: number | Control[]
the overlap group which will be processed or undefined to process all overlap groups
Optional deltaStep: number
the step size (speed) to reach the target non overlapping position (default 0.1)
Optional repelFactor: number
how much is the control repelled by other controls
Returns void
parse From Snippet AsyncSearch playground for parseFromSnippetAsync
Recreate the content of the ADT from a snippet saved by the GUI editor
Parameters
snippetId: string
defines the snippet to load
Optional scaleToSize: boolean
defines whether to scale to texture to the saved size
Returns Promise<AdvancedDynamicTexture>
a promise that will resolve on success
parse FromURLAsyncSearch playground for parseFromURLAsync
Recreate the content of the ADT from a url json
Parameters
url: string
defines the url to load
Optional scaleToSize: boolean
defines whether to scale to texture to the saved size
Returns Promise<AdvancedDynamicTexture>
a promise that will resolve on success
parse Serialized ObjectSearch playground for parseSerializedObject
Recreate the content of the ADT from a JSON object
Parameters
serializedObject: any
define the JSON serialized object to restore from
Optional scaleToSize: boolean
defines whether to scale to texture to the saved size
Returns void
pickSearch playground for pick
This function will run a pointer event on this ADT and will trigger any pointer events on any controls This will work on a fullscreen ADT only. For mesh based ADT, simulate pointer events using the scene directly.
Parameters
x: number
pointer X on the canvas for the picking
y: number
pointer Y on the canvas for the picking
Optional pi: Nullable<PointerInfoPre>
optional pointer information
Returns void
read PixelsSearch playground for readPixels
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)
Optional flushRenderer: boolean
true to flush the renderer from the pending commands before reading the pixels
Optional noDataConversion: boolean
false to convert the data to Uint8Array (if texture type is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture
Optional x: number
defines the region x coordinates to start reading from (default to 0)
Optional y: number
defines the region y coordinates to start reading from (default to 0)
Optional width: number
defines the region width to read from (default to the texture size at level)
Optional height: number
defines the region width to read from (default to the texture size at level)
Returns Nullable<Promise<ArrayBufferView>>
The Array buffer promise containing the pixels data.
register Clipboard EventsSearch playground for registerClipboardEvents
Register the clipboard Events onto the canvas
Returns void
release Internal TextureSearch playground for releaseInternalTexture
Release and destroy the underlying lower level texture aka internalTexture.
Returns void
remove ControlSearch 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
Scales the texture
Parameters
ratio: number
the scale factor to apply to both width and height
Returns void
scale ToSearch playground for scaleTo
Resizes the texture
Parameters
width: number
the new width
height: number
the new height
Returns void
serializeSearch playground for serialize
Serializes the dynamic texture. The scene should be ready before the dynamic texture is serialized
Returns any
a serialized dynamic texture object
serialize ContentSearch playground for serializeContent
Serializes the entire GUI system
Returns any
an object with the JSON serialized data
to StringSearch playground for toString
Return a string representation of the texture.
Returns string
the texture as a string
un Register Clipboard EventsSearch playground for unRegisterClipboardEvents
Unregister the clipboard Events from the canvas
Returns void
updateSearch playground for update
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)
Optional allowGPUOptimization: boolean
true to allow some specific GPU optimizations (subject to engine feature "allowGPUOptimizationsForGUI" being true)
Returns void
update Sampling ModeSearch playground for updateSamplingMode
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
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 | ArrayBufferView | Blob | ArrayBuffer | HTMLImageElement | ImageBitmap>
the buffer of the texture (defaults to null)
Optional onLoad: (() => void)
callback called when the texture is loaded (defaults to null)
Returns void
Optional forcedExtension: string
defines the extension to use to pick the right loader
Returns void
Static Create For MeshSearch 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)
Optional materialSetupCallback: ((mesh: AbstractMesh, uniqueId: string, texture: AdvancedDynamicTexture, onlyAlphaTesting: boolean) => void)
defines a custom way of creating and setting up the material on the mesh
Parameters
mesh: AbstractMesh
uniqueId: string
texture: AdvancedDynamicTexture
onlyAlphaTesting: boolean
Returns void
Returns AdvancedDynamicTexture
a new AdvancedDynamicTexture
Static Create For Mesh TextureSearch 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 Create From Base64 StringSearch playground for CreateFromBase64String
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 noMipmapOrOptions: boolean | ITextureCreationOptions
defines if the texture will require mip maps or not or set of all options to create the texture
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 fetching 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...)
Optional creationFlags: number
specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
Returns Texture
the created texture
Static Create FullscreenUISearch 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 hosting scene
Optional sampling: number
defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
Optional adaptiveScaling: boolean
defines whether to automatically scale root to match hardwarescaling (false by default)
Returns AdvancedDynamicTexture
a new AdvancedDynamicTexture
Static Load From Data StringSearch playground for LoadFromDataString
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 noMipmapOrOptions: boolean | ITextureCreationOptions
defines if the texture will require mip maps or not or set of all options to create the texture
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 fetching 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...)
Optional creationFlags: number
specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
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 Parse From File AsyncSearch playground for ParseFromFileAsync
Recreate the content of the ADT from a url json
Parameters
url: string
defines the url to load
Optional scaleToSize: boolean
defines whether to scale to texture to the saved size
Optional appendToAdt: AdvancedDynamicTexture
if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
Returns Promise<AdvancedDynamicTexture>
a promise that will resolve on success
Static Parse From Snippet AsyncSearch playground for ParseFromSnippetAsync
Recreate the content of the ADT from a snippet saved by the GUI editor
Parameters
snippetId: string
defines the snippet to load
Optional scaleToSize: boolean
defines whether to scale to texture to the saved size
Optional appendToAdt: AdvancedDynamicTexture
if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
Returns Promise<AdvancedDynamicTexture>
a promise that will resolve on success
Static When All ReadySearch playground for WhenAllReady
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
Returns void
Returns void
Class used to create texture to support 2D GUI elements
https://doc.babylonjs.com/features/featuresDeepDive/gui/gui