DynamicTexture

A class extending {BABYLON.Texture} allowing drawing on a texture

see

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

Hierarchy

Index

Constructors

constructor

  • new DynamicTexture(name: string, options: any, scene: Scene | null | undefined, generateMipMaps: boolean, samplingMode?: number, format?: number): DynamicTexture
  • Creates a {BABYLON.DynamicTexture}

    Parameters

    • name: string

      defines the name of the texture

    • options: any

      provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height

    • scene: Scene | null | undefined

      defines the scene where you want the texture

    • generateMipMaps: boolean

      defines the use of MinMaps or not (default is false)

    • Optional samplingMode: number

      defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)

    • Optional format: number

      defines the texture format to use (default is BABYLON.Engine.TEXTUREFORMAT_RGBA)

    Returns DynamicTexture

Properties

animations

animations: Animation[]

anisotropicFilteringLevel

anisotropicFilteringLevel: number

canRescale

canRescale: boolean

Gets the current state of canRescale

coordinatesIndex

coordinatesIndex: number

coordinatesMode

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

delayLoadState: number

gammaSpace

gammaSpace: boolean

getAlphaFromRGB

getAlphaFromRGB: boolean

hasAlpha

hasAlpha: boolean

invertZ

invertZ: boolean

is3D

is3D: boolean

isBlocking

isBlocking: boolean

isCube

isCube: boolean

isRGBD

isRGBD: boolean

Gets whether or not the texture contains RGBD data.

isRenderTarget

isRenderTarget: boolean

level

level: number

lodGenerationOffset

lodGenerationOffset: number

lodGenerationScale

lodGenerationScale: number

lodLevelInAlpha

lodLevelInAlpha: boolean

name

name: string

noMipmap

noMipmap: boolean

onDispose

onDispose: function

Type declaration

    • (): void
    • Returns void

onDisposeObservable

onDisposeObservable: Observable<BaseTexture>

An event triggered when the texture is disposed.

onLoadObservable

onLoadObservable: Observable<Texture>

samplingMode

samplingMode: number

sphericalPolynomial

sphericalPolynomial: Nullable<SphericalPolynomial>

textureFormat

textureFormat: number

textureType

textureType: number

uAng

uAng: number

uOffset

uOffset: number

uRotationCenter

uRotationCenter: number

Defines the center of rotation (U)

uScale

uScale: number

uid

uid: string

url

url: Nullable<string>

vAng

vAng: number

vOffset

vOffset: number

vRotationCenter

vRotationCenter: number

Defines the center of rotation (V)

vScale

vScale: number

wAng

wAng: number

wRotationCenter

wRotationCenter: number

Defines the center of rotation (W)

wrapR

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

wrapU

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

wrapV

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

Static BILINEAR_SAMPLINGMODE

BILINEAR_SAMPLINGMODE: number

Static CLAMP_ADDRESSMODE

CLAMP_ADDRESSMODE: number

Static CUBIC_MODE

CUBIC_MODE: number

Static DEFAULT_ANISOTROPIC_FILTERING_LEVEL

DEFAULT_ANISOTROPIC_FILTERING_LEVEL: number

Static EQUIRECTANGULAR_MODE

EQUIRECTANGULAR_MODE: number

Static EXPLICIT_MODE

EXPLICIT_MODE: number

Static FIXED_EQUIRECTANGULAR_MIRRORED_MODE

FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number

Static FIXED_EQUIRECTANGULAR_MODE

FIXED_EQUIRECTANGULAR_MODE: number

Static INVCUBIC_MODE

INVCUBIC_MODE: number

Static LINEAR_LINEAR

LINEAR_LINEAR: number

Static LINEAR_LINEAR_MIPLINEAR

LINEAR_LINEAR_MIPLINEAR: number

Static LINEAR_LINEAR_MIPNEAREST

LINEAR_LINEAR_MIPNEAREST: number

Static LINEAR_NEAREST

LINEAR_NEAREST: number

Static LINEAR_NEAREST_MIPLINEAR

LINEAR_NEAREST_MIPLINEAR: number

Static LINEAR_NEAREST_MIPNEAREST

LINEAR_NEAREST_MIPNEAREST: number

Static MIRROR_ADDRESSMODE

MIRROR_ADDRESSMODE: number

Static NEAREST_LINEAR

NEAREST_LINEAR: number

Static NEAREST_LINEAR_MIPLINEAR

NEAREST_LINEAR_MIPLINEAR: number

Static NEAREST_LINEAR_MIPNEAREST

NEAREST_LINEAR_MIPNEAREST: number

Static NEAREST_NEAREST

NEAREST_NEAREST: number

Static NEAREST_NEAREST_MIPLINEAR

NEAREST_NEAREST_MIPLINEAR: number

Static NEAREST_NEAREST_MIPNEAREST

NEAREST_NEAREST_MIPNEAREST: number

Static NEAREST_SAMPLINGMODE

NEAREST_SAMPLINGMODE: number

Static PLANAR_MODE

PLANAR_MODE: number

Static PROJECTION_MODE

PROJECTION_MODE: number

Static SKYBOX_MODE

SKYBOX_MODE: number

Static SPHERICAL_MODE

SPHERICAL_MODE: number

Static TRILINEAR_SAMPLINGMODE

TRILINEAR_SAMPLINGMODE: number

Static 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 WRAP_ADDRESSMODE

WRAP_ADDRESSMODE: number

Methods

clear

  • clear(): void
  • Clears the texture

    Returns void

clone

delayLoad

  • delayLoad(): void

dispose

  • dispose(): void

drawText

  • 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

getBaseSize

getClassName

  • getClassName(): string

getContext

  • getContext(): CanvasRenderingContext2D
  • Gets the context of the canvas used by the texture

    Returns CanvasRenderingContext2D

    the canvas context of the dynamic texture

getInternalTexture

getReflectionTextureMatrix

  • getReflectionTextureMatrix(): Matrix

getScene

getSize

getTextureMatrix

isReady

  • isReady(): boolean

isReadyOrNotBlocking

  • isReadyOrNotBlocking(): boolean

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.

releaseInternalTexture

  • releaseInternalTexture(): void

scale

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

    Parameters

    • ratio: number

      the scale factor to apply to both width and height

    Returns void

scaleTo

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

    Parameters

    • width: number

      the new width

    • height: number

      the new height

    Returns void

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

toString

  • toString(): string

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

updateSamplingMode

  • updateSamplingMode(samplingMode: number): void
  • 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

    Returns void

updateURL

  • updateURL(url: string, buffer?: Nullable<string | ArrayBuffer | HTMLImageElement | Blob>): 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)

    Returns void

Static CreateFromBase64String

  • CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<function>, onError?: Nullable<function>, format?: number): Texture
  • Parameters

    • data: string
    • name: string
    • scene: Scene
    • Optional noMipmap: boolean
    • Optional invertY: boolean
    • Optional samplingMode: number
    • Optional onLoad: Nullable<function>
    • Optional onError: Nullable<function>
    • Optional format: number

    Returns Texture

Static LoadFromDataString

  • LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<function>, onError?: Nullable<function>, format?: number): Texture
  • Parameters

    • name: string
    • buffer: any
    • scene: Scene
    • Optional deleteBuffer: boolean
    • Optional noMipmap: boolean
    • Optional invertY: boolean
    • Optional samplingMode: number
    • Optional onLoad: Nullable<function>
    • Optional onError: Nullable<function>
    • Optional format: number

    Returns Texture

Static Parse

Static WhenAllReady

  • WhenAllReady(textures: BaseTexture[], callback: function): void

Generated using TypeDoc