Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ProceduralTexture

Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes calmpler' images. This is the base class of any Procedural texture and contains most of the shareable code.

see

https://doc.babylonjs.com/how_to/how_to_use_procedural_textures

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • Instantiates a new procedural texture. Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes called 'refMaps' or 'sampler' images. This is the base class of any Procedural texture and contains most of the shareable code.

    see

    https://doc.babylonjs.com/how_to/how_to_use_procedural_textures

    Parameters

    • name: string

      Define the name of the texture

    • size: TextureSize

      Define the size of the texture to create

    • fragment: any

      Define the fragment shader to use to generate the texture or null if it is defined later

    • scene: Nullable<Scene>

      Define the scene the texture belongs to

    • Optional fallbackTexture: Nullable<Texture>

      Define a fallback texture in case there were issues to create the custom texture

    • Optional generateMipMaps: boolean

      Define if the texture should creates mip maps or not

    • Optional isCube: boolean

      Define if the texture is a cube texture or not (this will render each faces of the cube)

    • Optional textureType: number

      The FBO internal texture type

    Returns ProceduralTexture

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.

autoClearSearch playground for autoClear

autoClear: boolean

Define if the texture must be cleared before rendering (default is true)

delayLoadStateSearch playground for delayLoadState

delayLoadState: number

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

homogeneousRotationInUVTransformSearch playground for homogeneousRotationInUVTransform

homogeneousRotationInUVTransform: boolean

Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling

inspectableCustomPropertiesSearch playground for inspectableCustomProperties

inspectableCustomProperties: Nullable<IInspectable[]>

List of inspectable custom properties (used by the Inspector)

see

https://doc.babylonjs.com/how_to/debug_layer#extensibility

invertZSearch playground for invertZ

invertZ: boolean

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

isEnabledSearch playground for isEnabled

isEnabled: boolean

Define if the texture is enabled or not (disabled texture will not render)

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.

nodeMaterialSourceSearch playground for nodeMaterialSource

nodeMaterialSource: Nullable<NodeMaterial>

Gets or sets the node material used to create this texture (null if the texture was manually created)

onBeforeGenerationObservableSearch playground for onBeforeGenerationObservable

onBeforeGenerationObservable: Observable<ProceduralTexture>

Event raised before the texture is generated

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<BaseTexture>

An event triggered when the texture is disposed.

onGeneratedSearch playground for onGenerated

onGenerated: () => void

Callback called when the texture is generated

Type declaration

    • (): void
    • Returns void

onGeneratedObservableSearch playground for onGeneratedObservable

onGeneratedObservable: Observable<ProceduralTexture>

Event raised when the texture is generated

onLoadObservableSearch playground for onLoadObservable

onLoadObservable: Observable<Texture>

Observable triggered once the texture has been loaded.

reservedDataStoreSearch playground for reservedDataStore

reservedDataStore: any

For internal use only. Please do not use.

uAngSearch playground for uAng

uAng: number

Define an offset on the texture to rotate around the u coordinates of the UVs The angle is defined in radians.

see

https://doc.babylonjs.com/how_to/more_materials

uOffsetSearch playground for uOffset

uOffset: number

Define an offset on the texture to offset the u coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#offsetting

uRotationCenterSearch playground for uRotationCenter

uRotationCenter: number

Defines the center of rotation (U)

uScaleSearch playground for uScale

uScale: number

Define an offset on the texture to scale the u coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#tiling

uniqueIdSearch playground for uniqueId

uniqueId: number

Gets or sets the unique id of the texture

urlSearch playground for url

url: Nullable<string>

Define the url of the texture.

vAngSearch playground for vAng

vAng: number

Define an offset on the texture to rotate around the v coordinates of the UVs The angle is defined in radians.

see

https://doc.babylonjs.com/how_to/more_materials

vOffsetSearch playground for vOffset

vOffset: number

Define an offset on the texture to offset the v coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#offsetting

vRotationCenterSearch playground for vRotationCenter

vRotationCenter: number

Defines the center of rotation (V)

vScaleSearch playground for vScale

vScale: number

Define an offset on the texture to scale the v coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#tiling

wAngSearch playground for wAng

wAng: number

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.

see

https://doc.babylonjs.com/how_to/more_materials

wRotationCenterSearch playground for wRotationCenter

wRotationCenter: number

Defines the center of rotation (W)

wrapRSearch playground for wrapR

wrapR: number
ValueTypeDescription
0CLAMP_ADDRESSMODE
1WRAP_ADDRESSMODE
2MIRROR_ADDRESSMODE

Static Readonly BILINEAR_SAMPLINGMODESearch playground for BILINEAR_SAMPLINGMODE

BILINEAR_SAMPLINGMODE: 2 = 2

Bilinear is mag = linear and min = linear and mip = nearest

Static Readonly CLAMP_ADDRESSMODESearch playground for CLAMP_ADDRESSMODE

CLAMP_ADDRESSMODE: 0 = 0

Texture is not repeating outside of 0..1 UVs

Static Readonly CUBIC_MODESearch playground for CUBIC_MODE

CUBIC_MODE: 3 = 3

Cubic coordinates mode

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.

Static Readonly EQUIRECTANGULAR_MODESearch playground for EQUIRECTANGULAR_MODE

EQUIRECTANGULAR_MODE: 7 = 7

Equirectangular coordinates mode

Static Readonly EXPLICIT_MODESearch playground for EXPLICIT_MODE

EXPLICIT_MODE: 0 = 0

Explicit coordinates mode

Static Readonly FIXED_EQUIRECTANGULAR_MIRRORED_MODESearch playground for FIXED_EQUIRECTANGULAR_MIRRORED_MODE

FIXED_EQUIRECTANGULAR_MIRRORED_MODE: 9 = 9

Equirectangular Fixed Mirrored coordinates mode

Static Readonly FIXED_EQUIRECTANGULAR_MODESearch playground for FIXED_EQUIRECTANGULAR_MODE

FIXED_EQUIRECTANGULAR_MODE: 8 = 8

Equirectangular Fixed coordinates mode

Static ForceSerializeBuffersSearch playground for ForceSerializeBuffers

ForceSerializeBuffers: boolean

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

INVCUBIC_MODE: 6 = 6

Inverse Cubic coordinates mode

Static Readonly LINEAR_LINEARSearch playground for LINEAR_LINEAR

LINEAR_LINEAR: 2 = 2

mag = linear and min = linear and mip = none

Static Readonly LINEAR_LINEAR_MIPLINEARSearch playground for LINEAR_LINEAR_MIPLINEAR

LINEAR_LINEAR_MIPLINEAR: 3 = 3

Trilinear is mag = linear and min = linear and mip = linear

Static Readonly LINEAR_LINEAR_MIPNEARESTSearch playground for LINEAR_LINEAR_MIPNEAREST

LINEAR_LINEAR_MIPNEAREST: 11 = 11

Bilinear is mag = linear and min = linear and mip = nearest

Static Readonly LINEAR_NEARESTSearch playground for LINEAR_NEAREST

LINEAR_NEAREST: 12 = 12

mag = linear and min = nearest and mip = none

Static Readonly LINEAR_NEAREST_MIPLINEARSearch playground for LINEAR_NEAREST_MIPLINEAR

LINEAR_NEAREST_MIPLINEAR: 10 = 10

mag = linear and min = nearest and mip = linear

Static Readonly LINEAR_NEAREST_MIPNEARESTSearch playground for LINEAR_NEAREST_MIPNEAREST

LINEAR_NEAREST_MIPNEAREST: 9 = 9

mag = linear and min = nearest and mip = nearest

Static Readonly MIRROR_ADDRESSMODESearch playground for MIRROR_ADDRESSMODE

MIRROR_ADDRESSMODE: 2 = 2

Texture is repeating and mirrored

Static Readonly NEAREST_LINEARSearch playground for NEAREST_LINEAR

NEAREST_LINEAR: 7 = 7

mag = nearest and min = linear and mip = none

Static Readonly NEAREST_LINEAR_MIPLINEARSearch playground for NEAREST_LINEAR_MIPLINEAR

NEAREST_LINEAR_MIPLINEAR: 6 = 6

mag = nearest and min = linear and mip = linear

Static Readonly NEAREST_LINEAR_MIPNEARESTSearch playground for NEAREST_LINEAR_MIPNEAREST

NEAREST_LINEAR_MIPNEAREST: 5 = 5

mag = nearest and min = linear and mip = nearest

Static Readonly NEAREST_NEARESTSearch playground for NEAREST_NEAREST

NEAREST_NEAREST: 1 = 1

mag = nearest and min = nearest and mip = none

Static Readonly NEAREST_NEAREST_MIPLINEARSearch playground for NEAREST_NEAREST_MIPLINEAR

NEAREST_NEAREST_MIPLINEAR: 8 = 8

nearest is mag = nearest and min = nearest and mip = linear

Static Readonly NEAREST_NEAREST_MIPNEARESTSearch playground for NEAREST_NEAREST_MIPNEAREST

NEAREST_NEAREST_MIPNEAREST: 4 = 4

mag = nearest and min = nearest and mip = nearest

Static Readonly NEAREST_SAMPLINGMODESearch playground for NEAREST_SAMPLINGMODE

NEAREST_SAMPLINGMODE: 1 = 1

nearest is mag = nearest and min = nearest and mip = linear

Static OnTextureLoadErrorObservableSearch playground for OnTextureLoadErrorObservable

OnTextureLoadErrorObservable: Observable<BaseTexture>

This observable will notify when any texture had a loading error

Static Readonly PLANAR_MODESearch playground for PLANAR_MODE

PLANAR_MODE: 2 = 2

Planar coordinates mode

Static Readonly PROJECTION_MODESearch playground for PROJECTION_MODE

PROJECTION_MODE: 4 = 4

Projection coordinates mode

Static Readonly SKYBOX_MODESearch playground for SKYBOX_MODE

SKYBOX_MODE: 5 = 5

Inverse Cubic coordinates mode

Static Readonly SPHERICAL_MODESearch playground for SPHERICAL_MODE

SPHERICAL_MODE: 1 = 1

Spherical coordinates mode

Static SerializeBuffersSearch playground for SerializeBuffers

SerializeBuffers: boolean

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 Readonly TRILINEAR_SAMPLINGMODESearch playground for TRILINEAR_SAMPLINGMODE

TRILINEAR_SAMPLINGMODE: 3 = 3

Trilinear is mag = linear and min = linear and mip = linear

Static UseSerializedUrlIfAnySearch playground for 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 Readonly WRAP_ADDRESSMODESearch playground for WRAP_ADDRESSMODE

WRAP_ADDRESSMODE: 1 = 1

Texture is repeating outside of 0..1 UVs

Accessors

canRescale

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

    Returns boolean

coordinatesIndex

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

coordinatesMode

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

    Returns number

  • 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 any

errorObject

  • 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

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

getAlphaFromRGB

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

invertY

  • get invertY(): boolean
  • Gets a boolean indicating if the texture needs to be inverted on the y axis during loading

    Returns boolean

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

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

isCube

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

loadingError

  • get loadingError(): boolean
  • Was there any loading error?

    Returns boolean

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

mimeType

  • get mimeType(): string | undefined
  • Returns the texture mime type if it was defined by a loader (undefined else)

    Returns string | undefined

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

refreshRate

  • get refreshRate(): number
  • set refreshRate(value: number): any
  • Define the refresh rate of the texture or the rendering frequency. Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...

    Returns number

  • Define the refresh rate of the texture or the rendering frequency. Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...

    Parameters

    • value: number

    Returns any

samplingMode

  • get samplingMode(): number
  • Get the current sampling mode associated with the texture.

    Returns number

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

wrapV

  • get wrapV(): number
  • set wrapV(value: number): any

Methods

_setEffectSearch playground for _setEffect

  • _setEffect(effect: Effect): void
  • hidden*

    Parameters

    Returns void

checkTransformsAreIdenticalSearch playground for checkTransformsAreIdentical

cloneSearch playground for clone

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

getContentSearch playground for getContent

  • getContent(): Nullable<Promise<ArrayBufferView>>
  • Gets texture content (Use this function wisely as reading from a texture can be slow)

    Returns Nullable<Promise<ArrayBufferView>>

    an ArrayBufferView promise (Uint8Array or Float32Array)

getEffectSearch playground for getEffect

  • The effect that is created when initializing the post process.

    Returns Effect

    The created effect corresponding the the postprocess.

getInternalTextureSearch playground for getInternalTexture

getReflectionTextureMatrixSearch playground for getReflectionTextureMatrix

  • getReflectionTextureMatrix(): Matrix

getRenderSizeSearch playground for getRenderSize

  • Get the size the texture is rendering at.

    Returns TextureSize

    the size (on cube texture it is always squared)

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

  • getTextureMatrix(uBase?: number): Matrix
  • 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.

isReadySearch playground for isReady

  • isReady(): boolean
  • Is the texture ready to be used ? (rendered at least once)

    Returns boolean

    true if ready, otherwise, false.

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, not blocking or if there was an error loading the texture

readPixelsSearch playground for readPixels

  • readPixels(faceIndex?: number, level?: number, buffer?: Nullable<ArrayBufferView>, flushRenderer?: boolean, noDataConversion?: boolean, x?: number, y?: number, width?: number, height?: number): Nullable<Promise<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)

    • 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)pe 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 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.

releaseInternalTextureSearch playground for releaseInternalTexture

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

    Returns void

renderSearch playground for render

  • render(useCameraPostProcess?: boolean): void
  • Render the texture to its associated render target.

    Parameters

    • Optional useCameraPostProcess: boolean

      Define if camera post process should be applied to the texture

    Returns void

resetSearch playground for reset

  • reset(): void
  • Resets the texture in order to recreate its associated resources. This can be called in case of context loss

    Returns void

resetRefreshCounterSearch playground for resetRefreshCounter

  • resetRefreshCounter(): void
  • Resets the refresh counter of the texture and start bak from scratch. Could be useful to regenerate the texture if it is setup to render only once.

    Returns void

resizeSearch playground for resize

  • resize(size: TextureSize, generateMipMaps: boolean): void
  • Resize the texture to new value.

    Parameters

    • size: TextureSize

      Define the new size the texture should have

    • generateMipMaps: boolean

      Define whether the new texture should create mip maps

    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 to a JSON representation we can easily use in the respective Parse function.

    Returns any

    The JSON representation of the texture

setColor3Search playground for setColor3

  • Set a vec3 in the shader from a Color3.

    Parameters

    • name: string

      Define the name of the uniform as defined in the shader

    • value: Color3

      Define the value to give to the uniform

    Returns ProceduralTexture

    the texture itself allowing "fluent" like uniform updates

setColor4Search playground for setColor4

  • Set a vec4 in the shader from a Color4.

    Parameters

    • name: string

      Define the name of the uniform as defined in the shader

    • value: Color4

      Define the value to give to the uniform

    Returns ProceduralTexture

    the texture itself allowing "fluent" like uniform updates

setFloatSearch playground for setFloat

  • Set a float in the shader.

    Parameters

    • name: string

      Define the name of the uniform as defined in the shader

    • value: number

      Define the value to give to the uniform

    Returns ProceduralTexture

    the texture itself allowing "fluent" like uniform updates

setFloatsSearch playground for setFloats

  • Set an array of floats in the shader.

    Parameters

    • name: string

      Define the name of the uniform as defined in the shader

    • value: number[]

      Define the value to give to the uniform

    Returns ProceduralTexture

    the texture itself allowing "fluent" like uniform updates

setFragmentSearch playground for setFragment

  • setFragment(fragment: any): void
  • Set the fragment shader to use in order to render the texture.

    Parameters

    • fragment: any

      This can be set to a path (into the shader store) or to a json object containing a fragmentElement property.

    Returns void

setIntSearch playground for setInt

  • Set a int in the shader.

    Parameters

    • name: string

      Define the name of the uniform as defined in the shader

    • value: number

      Define the value to give to the uniform

    Returns ProceduralTexture

    the texture itself allowing "fluent" like uniform updates

setMatrixSearch playground for setMatrix

  • Set a mat4 in the shader from a MAtrix.

    Parameters

    • name: string

      Define the name of the uniform as defined in the shader

    • value: Matrix

      Define the value to give to the uniform

    Returns ProceduralTexture

    the texture itself allowing "fluent" like uniform updates

setTextureSearch playground for setTexture

  • Set a texture in the shader program used to render.

    Parameters

    • name: string

      Define the name of the uniform samplers as defined in the shader

    • texture: Texture

      Define the texture to bind to this sampler

    Returns ProceduralTexture

    the texture itself allowing "fluent" like uniform updates

setVector2Search playground for setVector2

  • Set a vec2 in the shader from a Vector2.

    Parameters

    • name: string

      Define the name of the uniform as defined in the shader

    • value: Vector2

      Define the value to give to the uniform

    Returns ProceduralTexture

    the texture itself allowing "fluent" like uniform updates

setVector3Search playground for setVector3

  • Set a vec3 in the shader from a Vector3.

    Parameters

    • name: string

      Define the name of the uniform as defined in the shader

    • value: Vector3

      Define the value to give to the uniform

    Returns ProceduralTexture

    the texture itself allowing "fluent" like uniform updates

toStringSearch playground for toString

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

    Returns string

    the texture as a string

updateSamplingModeSearch playground for updateSamplingMode

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

    Returns void

updateURLSearch playground for updateURL

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

      the buffer of the texture (defaults to null)

    • Optional onLoad: () => void

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

        • (): void
        • Returns void

    • Optional forcedExtension: string

      defines the extension to use to pick the right loader

    Returns void

Static CreateFromBase64StringSearch playground for CreateFromBase64String

  • CreateFromBase64String(data: string, name: string, scene: Scene, noMipmapOrOptions?: boolean | ITextureCreationOptions, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<() => void>, format?: number, creationFlags?: number): Texture
  • 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 LoadFromDataStringSearch playground for LoadFromDataString

  • LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmapOrOptions?: boolean | ITextureCreationOptions, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number, creationFlags?: number): Texture
  • 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 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
  • Accessor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static property
  • Static method