API

Class RawCubeTexture

Raw cube texture where the raw buffers are passed in

Hierarchy (View Summary)

Index
  • Creates a cube texture where the raw buffers are passed in.

    Parameters

    • scene: Scene

      defines the scene the texture is attached to

    • data: Nullable<ArrayBufferView<ArrayBufferLike>[]>

      defines the array of data to use to create each face

    • size: number

      defines the size of the textures

    • format: number = Constants.TEXTUREFORMAT_RGBA

      defines the format of the data

    • type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE

      defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)

    • generateMipMaps: boolean = false

      defines if the engine should generate the mip levels

    • invertY: boolean = false

      defines if data must be stored with Y axis inverted

    • samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE

      defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)

    • compression: Nullable<string> = null

      defines the compression used (null by default)

    Returns RawCubeTexture

animations: Animation[] = []

Define the list of animation attached to the texture.

anisotropicFilteringLevel: number = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL

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.

boundingBoxPosition: Vector3 = ...

Gets or sets the center of the bounding box associated with the cube texture. It must define where the camera used to render the texture was set

delayLoadState: number = Constants.DELAYLOADSTATE_NONE

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

displayName: string

Define the display name of the texture, which is used as tree item name of the dedicated node in the inspector

invertZ: boolean = false

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

isRenderTarget: boolean = false

Define if the texture is a render target.

level: number = 1

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

metadata: any = null

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

name: string

Define the name of the texture.

onDisposeObservable: Observable<BaseTexture> = ...

An event triggered when the texture is disposed.

onLoadObservable: Observable<CubeTexture> = ...

Observable triggered once the texture has been loaded.

optimizeUVAllocation: boolean = true

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)

reservedDataStore: any = null

For internal use only. Please do not use.

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.

uniqueId: number

Gets or sets the unique id of the texture

url: string

The url of the texture

wrapR: number = Constants.TEXTURE_WRAP_ADDRESSMODE
ValueTypeDescription
0CLAMP_ADDRESSMODE
1WRAP_ADDRESSMODE
2MIRROR_ADDRESSMODE
DEFAULT_ANISOTROPIC_FILTERING_LEVEL: number = 4

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

  • get coordinatesMode(): number

    How a texture is mapped. Unused in thin texture mode.

    Returns number

  • set coordinatesMode(value: number): void

    How a texture is mapped.

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

    Parameters

    • value: number

    Returns void

  • get errorObject(): { exception?: any; message?: string } | undefined

    If a loading error occurred this object will be populated with information about the error.

    Returns { exception?: any; message?: string } | undefined

  • set onDispose(callback: () => void): void

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

    Parameters

    • callback: () => void

    Returns void

  • 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. Note that you can use GetTextureDataAsync instead, which will also support reading from a compressed texture (by rendering it to an intermediate RGBA texture and retrieving the bytes from it).

    Parameters

    • faceIndex: number = 0

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

    • level: number = 0

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

    • buffer: Nullable<ArrayBufferView<ArrayBufferLike>> = null

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

    • flushRenderer: boolean = true

      true to flush the renderer from the pending commands before reading the pixels

    • noDataConversion: boolean = false

      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

    • x: number = 0

      defines the region x coordinates to start reading from (default to 0)

    • y: number = 0

      defines the region y coordinates to start reading from (default to 0)

    • width: number = Number.MAX_VALUE

      defines the region width to read from (default to the texture size at level)

    • height: number = Number.MAX_VALUE

      defines the region width to read from (default to the texture size at level)

    Returns Nullable<Promise<ArrayBufferView<ArrayBufferLike>>>

    The Array buffer promise containing the pixels data.

  • Updates the raw cube texture.

    Parameters

    • data: ArrayBufferView<ArrayBufferLike>[]

      defines the data to store

    • format: number

      defines the data format

    • type: number

      defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    • compression: Nullable<string> = null

      defines the compression used (null by default)

    Returns void

  • Updates a raw cube texture with RGBD encoded data.

    Parameters

    • data: ArrayBufferView<ArrayBufferLike>[][]

      defines the array of data [mipmap][face] to use to create each face

    • sphericalPolynomial: Nullable<SphericalPolynomial> = null

      defines the spherical polynomial for irradiance

    • lodScale: number = 0.8

      defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness

    • lodOffset: number = 0

      defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness

    Returns Promise<void>

    a promise that resolves when the operation is complete

  • Update the sampling mode of the texture. Default is Trilinear mode.

    ValueTypeDescription
    1NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEARNearest is: mag = nearest, min = nearest, mip = linear
    2BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEARESTBilinear is: mag = linear, min = linear, mip = nearest
    3TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEARTrilinear is: mag = linear, min = linear, mip = linear
    4NEAREST_NEAREST_MIPNEAREST
    5NEAREST_LINEAR_MIPNEAREST
    6NEAREST_LINEAR_MIPLINEAR
    7NEAREST_LINEAR
    8NEAREST_NEAREST
    9LINEAR_NEAREST_MIPNEAREST
    10LINEAR_NEAREST_MIPLINEAR
    11LINEAR_LINEAR
    12LINEAR_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

    • generateMipMaps: boolean = false

      Define if the texture should generate mip maps or not. Default is false.

    Returns void

  • Update the url (and optional buffer) of this texture if url was null during construction.

    Parameters

    • url: string

      the url of the texture

    • forcedExtension: Nullable<string> = null

      defines the extension to use

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

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

    • prefiltered: boolean = false

      Defines whether the updated texture is prefiltered or not

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

      callback called if there was an error during the loading process (defaults to null)

    • extensions: Nullable<string[]> = null

      defines the suffixes add to the picture name in case six images are in use like _px.jpg...

    • delayLoad: boolean = false

      defines if the texture should be loaded now (false by default)

    • files: Nullable<string[]> = null

      defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz

    • buffer: Nullable<ArrayBufferView<ArrayBufferLike>> = null

      the buffer to use instead of loading from the url

    Returns void