Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RawCubeTexture

Raw cube texture where the raw buffers are passed in

Hierarchy

Implements

Index

Constructors

constructor

  • new RawCubeTexture(scene: Scene, data: Nullable<ArrayBufferView[]>, size: number, format?: number, type?: number, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, compression?: Nullable<string>): RawCubeTexture
  • 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[]>

      defines the array of data to use to create each face

    • size: number

      defines the size of the textures

    • Optional format: number

      defines the format of the data

    • Optional type: number

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

    • Optional generateMipMaps: boolean

      defines if the engine should generate the mip levels

    • Optional invertY: boolean

      defines if data must be stored with Y axis inverted

    • Optional samplingMode: number

      defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)

    • Optional compression: Nullable<string>

      defines the compression used (null by default)

    Returns RawCubeTexture

Properties

animationsSearch playground for animations

animations: Animation[]

Define the list of animation attached to the texture.

anisotropicFilteringLevelSearch playground for anisotropicFilteringLevel

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.

boundingBoxPositionSearch playground for boundingBoxPosition

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

see

https://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode

coordinatesIndexSearch playground for coordinatesIndex

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.

delayLoadStateSearch playground for delayLoadState

delayLoadState: number

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

getAlphaFromRGBSearch playground for getAlphaFromRGB

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.

invertZSearch playground for invertZ

invertZ: boolean

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

isRenderTargetSearch playground for isRenderTarget

isRenderTarget: boolean

Define if the texture is a render target.

levelSearch playground for level

level: number

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

metadataSearch playground for metadata

metadata: any

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

nameSearch playground for name

name: string

Define the name of the texture.

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<BaseTexture>

An event triggered when the texture is disposed.

onLoadObservableSearch playground for onLoadObservable

onLoadObservable: Observable<CubeTexture>

Observable triggered once the texture has been loaded.

reservedDataStoreSearch playground for reservedDataStore

reservedDataStore: any

For internal use only. Please do not use.

uniqueIdSearch playground for uniqueId

uniqueId: number

Gets or sets the unique id of the texture

urlSearch playground for url

url: string

The url of the texture

wrapRSearch playground for wrapR

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

Static DEFAULT_ANISOTROPIC_FILTERING_LEVELSearch playground for DEFAULT_ANISOTROPIC_FILTERING_LEVEL

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.

Accessors

boundingBoxSize

  • get boundingBoxSize(): Vector3
  • set boundingBoxSize(value: Vector3): any

canRescale

  • get canRescale(): boolean
  • Get if the texture can rescale.

    Returns boolean

coordinatesMode

  • get coordinatesMode(): number
  • set coordinatesMode(value: number): any
  • 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 any

gammaSpace

  • get gammaSpace(): boolean
  • set gammaSpace(gamma: boolean): any
  • 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 any

hasAlpha

  • get hasAlpha(): boolean
  • set hasAlpha(value: boolean): any
  • 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 any

irradianceTexture

  • 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

    Returns any

is2DArray

  • get is2DArray(): boolean
  • set is2DArray(value: boolean): any
  • 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 any

is3D

  • get is3D(): boolean
  • set is3D(value: boolean): any
  • 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 any

isBlocking

  • get isBlocking(): boolean
  • Define if the texture is preventinga material to render or not. If not and the texture is not ready, the engine will use a default black texture instead.

    Returns boolean

isCube

  • get isCube(): boolean
  • set isCube(value: boolean): any
  • 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 any

isRGBD

  • get isRGBD(): boolean
  • set isRGBD(value: boolean): any
  • 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 any

linearSpecularLOD

  • get linearSpecularLOD(): boolean
  • set linearSpecularLOD(value: boolean): any
  • 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 any

lodGenerationOffset

  • get lodGenerationOffset(): number
  • set lodGenerationOffset(value: number): any
  • 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 any

lodGenerationScale

  • get lodGenerationScale(): number
  • set lodGenerationScale(value: number): any
  • 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 any

noMipmap

  • get noMipmap(): boolean

onDispose

  • set onDispose(callback: () => void): any
  • Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns any

rotationY

  • get rotationY(): number
  • set rotationY(value: number): any
  • Gets texture matrix rotation angle around Y axis radians.

    Returns number

  • Sets texture matrix rotation angle around Y axis in radians.

    Parameters

    • value: number

    Returns any

textureFormat

  • get textureFormat(): number
  • Get the texture underlying format (RGB, RGBA...)

    Returns number

textureType

  • get textureType(): number
  • Get the texture underlying type (INT, FLOAT...)

    Returns number

uid

  • get uid(): string
  • Define the unique id of the texture in the scene.

    Returns string

wrapU

  • get wrapU(): number
  • set wrapU(value: number): any
  • 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 any

wrapV

  • get wrapV(): number
  • set wrapV(value: number): any
  • 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 any

Methods

checkTransformsAreIdenticalSearch playground for checkTransformsAreIdentical

  • Checks if the texture has the same transform matrix than another texture

    Parameters

    Returns boolean

    true if the transforms are the same, else false

cloneSearch playground for clone

  • Clones the raw cube texture.

    Returns CubeTexture

    a new cube texture

delayLoadSearch playground for delayLoad

  • delayLoad(forcedExtension?: string): void
  • Delays loading of the cube texture

    Parameters

    • Optional forcedExtension: string

      defines the extension to use

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Dispose the texture and release its associated resources.

    Returns void

getBaseSizeSearch 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

getClassNameSearch playground for getClassName

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

    Returns string

    "CubeTexture"

getInternalTextureSearch playground for getInternalTexture

getReflectionTextureMatrixSearch playground for getReflectionTextureMatrix

  • getReflectionTextureMatrix(): Matrix

getSceneSearch playground for getScene

  • Get the scene the texture belongs to.

    Returns Nullable<Scene>

    the scene or null if undefined

getSizeSearch playground for getSize

  • Get the size of the texture.

    Returns ISize

    the texture size.

getTextureMatrixSearch playground for getTextureMatrix

  • Get the texture transform matrix used to offset tile the texture for istance.

    Returns Matrix

    the transformation matrix

isReadySearch playground for isReady

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

    Returns boolean

    true if fully ready

isReadyOrNotBlockingSearch playground for isReadyOrNotBlocking

  • 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

readPixelsSearch playground for 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.

releaseInternalTextureSearch playground for releaseInternalTexture

  • releaseInternalTexture(): void
  • Release and destroy the underlying lower level texture aka internalTexture.

    Returns void

scaleSearch playground for scale

  • scale(ratio: number): void
  • Scales the texture if is canRescale()

    Parameters

    • ratio: number

      the resize factor we want to use to rescale

    Returns void

serializeSearch playground for serialize

  • serialize(): any
  • Serialize the texture into a JSON representation that can be parsed later on.

    Returns any

    the JSON representation of the texture

setReflectionTextureMatrixSearch playground for setReflectionTextureMatrix

  • setReflectionTextureMatrix(value: Matrix): void

toStringSearch playground for toString

  • toString(): string
  • Return a string representation of the texture.

    Returns string

    the texture as a string

updateSearch playground for update

  • update(data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression?: Nullable<string>): void
  • Updates the raw cube texture.

    Parameters

    • data: ArrayBufferView[]

      defines the data to store

    • format: number

      defines the data format

    • type: number

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

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    • Optional compression: Nullable<string>

      defines the compression used (null by default)

    Returns void

updateRGBDAsyncSearch playground for updateRGBDAsync

  • updateRGBDAsync(data: ArrayBufferView[][], sphericalPolynomial?: Nullable<SphericalPolynomial>, lodScale?: number, lodOffset?: number): Promise<void>
  • Updates a raw cube texture with RGBD encoded data.

    Parameters

    • data: ArrayBufferView[][]

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

    • Optional sphericalPolynomial: Nullable<SphericalPolynomial>

      defines the spherical polynomial for irradiance

    • Optional lodScale: number

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

    • Optional lodOffset: number

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

    Returns Promise<void>

    a promsie that resolves when the operation is complete

updateSamplingModeSearch playground for updateSamplingMode

  • 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

updateURLSearch playground for updateURL

  • updateURL(url: string, forcedExtension?: string, onLoad?: () => void, prefiltered?: boolean): 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 forcedExtension: string

      defines the extension to use

    • Optional onLoad: () => void

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

        • (): void
        • Returns void

    • Optional prefiltered: boolean

      Defines whether the updated texture is prefiltered or not

    Returns void

Static CreateFromImagesSearch playground for CreateFromImages

  • CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture
  • Creates a cube texture from an array of image urls

    Parameters

    • files: string[]

      defines an array of image urls

    • scene: Scene

      defines the hosting scene

    • Optional noMipmap: boolean

      specifies if mip maps are not used

    Returns CubeTexture

    a cube texture

Static CreateFromPrefilteredDataSearch playground for CreateFromPrefilteredData

  • CreateFromPrefilteredData(url: string, scene: Scene, forcedExtension?: any, createPolynomials?: boolean): CubeTexture
  • Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.

    Parameters

    • url: string

      defines the url of the prefiltered texture

    • scene: Scene

      defines the scene the texture is attached to

    • Optional forcedExtension: any

      defines the extension of the file if different from the url

    • Optional createPolynomials: boolean

      defines whether or not to create polynomial harmonics from the texture data if necessary

    Returns CubeTexture

    the prefiltered texture

Static ParseSearch playground for Parse

  • Parses text to create a cube texture

    Parameters

    • parsedTexture: any

      define the serialized text to read from

    • scene: Scene

      defines the hosting scene

    • rootUrl: string

      defines the root url of the cube texture

    Returns CubeTexture

    a cube texture

Static WhenAllReadySearch playground for WhenAllReady

  • WhenAllReady(textures: BaseTexture[], callback: () => void): 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: () => void

      Define the callback triggered once the entire list will be ready

        • (): void
        • Returns void

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static method