API

Class InternalTexture

Class used to store data associated with WebGL texture data for the engine This class should not be used directly

Hierarchy (View Summary)

Index
baseDepth: number = 0

Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)

baseHeight: number = 0

Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)

baseWidth: number = 0

Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)

depth: number = 0

Gets the depth of the texture

format: number = -1

Gets the format of the texture (RGB, RGBA...)

generateMipMaps: boolean = false

Gets a boolean indicating if the texture needs mipmaps generation

height: number = 0

Gets the height of the texture

invertY: boolean = false

Gets a boolean indicating if the texture is inverted on Y axis

is2DArray: boolean = false

Defines if the texture contains 2D array data

is3D: boolean = false

Defines if the texture contains 3D data

isCube: boolean = false

Defines if the texture is a cube texture

isMultiview: boolean = false

Defines if the texture contains multiview data

isReady: boolean = false

Defines if the texture is ready

label?: string

General label used for debugging or storing a name.

mipLevelCount: number = 1

Gets the number of mip levels for this texture. Note: This property has the correct value only if the texture was created through createRawTexture, createRawTexture2DArray, or (on WebGPU) createRawTexture3D.

onErrorObservable: Observable<Partial<{ exception: any; message: string }>> = ...

Observable called when the texture load is raising an error

onLoadedObservable: Observable<InternalTexture> = ...

Observable called when the texture is loaded

onRebuildCallback: Nullable<
    (
        internalTexture: InternalTexture,
    ) => {
        isAsync: boolean;
        isReady: boolean;
        proxy: Nullable<InternalTexture | Promise<InternalTexture>>;
    },
> = null

If this callback is defined it will be called instead of the default _rebuild function

samples: number = 0

Gets the number of samples used by the texture (WebGL2+ only)

samplingMode: number = -1

Gets the sampling mode of the texture

type: number = -1

Gets the type of the texture (int, float...)

url: string = ""

Gets the URL used to load this texture

width: number = 0

Gets the width of the texture

  • get useMipMaps(): Nullable<boolean>

    Indicates to use the mip maps (if available on the texture). Thanks to this flag, you can instruct the sampler to not sample the mipmaps even if they exist (and if the sampling mode is set to a value that normally samples the mipmaps!) If useMipMaps is null, the value of generateMipMaps is returned by the getter (for backward compatibility)

    Returns Nullable<boolean>

  • set useMipMaps(value: Nullable<boolean>): void

    Indicates to use the mip maps (if available on the texture). Thanks to this flag, you can instruct the sampler to not sample the mipmaps even if they exist (and if the sampling mode is set to a value that normally samples the mipmaps!)

    Parameters

    Returns void

  • Sets all the parameters of the sampler

    Parameters

    • wrapU: number = Constants.TEXTURE_WRAP_ADDRESSMODE

      u address mode (default: TEXTURE_WRAP_ADDRESSMODE)

    • wrapV: number = Constants.TEXTURE_WRAP_ADDRESSMODE

      v address mode (default: TEXTURE_WRAP_ADDRESSMODE)

    • wrapR: number = Constants.TEXTURE_WRAP_ADDRESSMODE

      r address mode (default: TEXTURE_WRAP_ADDRESSMODE)

    • anisotropicFilteringLevel: number = 1

      anisotropic level (default: 1)

    • samplingMode: number = Constants.TEXTURE_BILINEAR_SAMPLINGMODE

      sampling mode (default: Constants.TEXTURE_BILINEAR_SAMPLINGMODE)

    • comparisonFunction: number = 0

      comparison function (default: 0 - no comparison function)

    Returns TextureSampler

    the current sampler instance

  • Change the size of the texture (not the size of the content)

    Parameters

    • width: number

      defines the new width

    • height: number

      defines the new height

    • depth: number = 1

      defines the new depth (1 by default)

    Returns void