Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ThinEngine

The base engine class (root of all engines)

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • Creates a new engine

    Parameters

    • canvasOrContext: Nullable<HTMLCanvasElement | OffscreenCanvas | WebGLRenderingContext | WebGL2RenderingContext>

      defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which already used the WebGL context

    • Optional antialias: boolean

      defines enable antialiasing (default: false)

    • Optional options: EngineOptions

      defines further options to be sent to the getContext() function

    • Optional adaptToDeviceRatio: boolean

      defines whether to adapt to the device's viewport characteristics (default: false)

    Returns ThinEngine

Properties

cullBackFacesSearch playground for cullBackFaces

cullBackFaces: Nullable<boolean>

Gets or sets a boolean indicating if back faces must be culled. If false, front faces are culled instead (true by default) If non null, this takes precedence over the value from the material

disableUniformBuffersSearch playground for disableUniformBuffers

disableUniformBuffers: boolean

Gets or sets a boolean indicating that uniform buffers must be disabled even if they are supported

disableVertexArrayObjectsSearch playground for disableVertexArrayObjects

disableVertexArrayObjects: boolean

Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported

enableUnpackFlipYCachedSearch playground for enableUnpackFlipYCached

enableUnpackFlipYCached: boolean

In case you are sharing the context with other applications, it might be interested to not cache the unpack flip y state to ensure a consistent value would be set.

forcePOTTexturesSearch playground for forcePOTTextures

forcePOTTextures: boolean

Gets or sets a boolean that indicates if textures must be forced to power of 2 size even if not required

Readonly hasOriginBottomLeftSearch playground for hasOriginBottomLeft

hasOriginBottomLeft: true = true

Indicates that the origin of the texture/framebuffer space is the bottom left corner. If false, the origin is top left

hostInformationSearch playground for hostInformation

hostInformation: HostInformation

Gets information about the current host

isFullscreenSearch playground for isFullscreen

isFullscreen: boolean

Gets a boolean indicating if the engine is currently rendering in fullscreen mode

Readonly isNDCHalfZRangeSearch playground for isNDCHalfZRange

isNDCHalfZRange: false = false

Indicates if the z range in NDC space is 0..1 (value: true) or -1..1 (value: false)

onBeforeTextureInitObservableSearch playground for onBeforeTextureInitObservable

onBeforeTextureInitObservable: Observable<Texture>

Observable event triggered before each texture is initialized

onContextLostObservableSearch playground for onContextLostObservable

onContextLostObservable: Observable<ThinEngine>

Observable signaled when a context lost event is raised

onContextRestoredObservableSearch playground for onContextRestoredObservable

onContextRestoredObservable: Observable<ThinEngine>

Observable signaled when a context restored event is raised

Readonly onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<ThinEngine>

An event triggered when the engine is disposed.

premultipliedAlphaSearch playground for premultipliedAlpha

premultipliedAlpha: boolean

Defines whether the engine has been created with the premultipliedAlpha option on or not.

preventCacheWipeBetweenFramesSearch playground for preventCacheWipeBetweenFrames

preventCacheWipeBetweenFrames: boolean

Gets or sets a boolean indicating that cache can be kept between frames

renderEvenInBackgroundSearch playground for renderEvenInBackground

renderEvenInBackground: boolean

Gets or sets a boolean indicating if the engine must keep rendering even if the window is not in foreground

validateShaderProgramsSearch playground for validateShaderPrograms

validateShaderPrograms: boolean

Gets or sets a boolean indicating if the engine should validate programs after compilation

Static CollisionsEpsilonSearch playground for CollisionsEpsilon

CollisionsEpsilon: number

Gets or sets the epsilon value used by collision engine

Static ExceptionListSearch playground for ExceptionList

ExceptionList: ({ capture: string; captureConstraint: number; key: string; targets: string[] } | { capture: null; captureConstraint: null; key: string; targets: string[] })[]

Use this array to turn off some WebGL2 features on known buggy browsers version

Accessors

activeRenderLoops

  • get activeRenderLoops(): Array<() => void>
  • Gets the list of current active render loop functions

    Returns Array<() => void>

    an array with the current render loop functions

alphaState

  • get alphaState(): AlphaState
  • Gets the alpha state manager

    Returns AlphaState

currentViewport

  • get currentViewport(): Nullable<IViewportLike>
  • Gets the current viewport

    Returns Nullable<IViewportLike>

depthCullingState

  • get depthCullingState(): DepthCullingState
  • Gets the depth culling state manager

    Returns DepthCullingState

description

  • get description(): string
  • Returns a string describing the current engine

    Returns string

doNotHandleContextLost

  • get doNotHandleContextLost(): boolean
  • set doNotHandleContextLost(value: boolean): any

emptyCubeTexture

  • Gets the default empty cube texture

    Returns InternalTexture

emptyTexture

  • Gets the default empty texture

    Returns InternalTexture

emptyTexture2DArray

  • Gets the default empty 2D array texture

    Returns InternalTexture

emptyTexture3D

  • Gets the default empty 3D texture

    Returns InternalTexture

frameId

  • get frameId(): number
  • Gets the current frame id

    Returns number

framebufferDimensionsObject

  • set framebufferDimensionsObject(dimensions: Nullable<{ framebufferHeight: number; framebufferWidth: number }>): any
  • sets the object from which width and height will be taken from when getting render width and height Will fallback to the gl object

    Parameters

    • dimensions: Nullable<{ framebufferHeight: number; framebufferWidth: number }>

      the framebuffer width and height that will be used.

    Returns any

isStencilEnable

  • get isStencilEnable(): boolean
  • Returns true if the stencil buffer has been enabled through the creation option of the context.

    Returns boolean

isWebGPU

  • get isWebGPU(): boolean
  • Gets a boolean indicating if the engine runs in WebGPU or not.

    Returns boolean

name

  • get name(): string
  • set name(value: string): any
  • Gets or sets the name of the engine

    Returns string

  • Gets or sets the name of the engine

    Parameters

    • value: string

    Returns any

needPOTTextures

  • get needPOTTextures(): boolean
  • Gets a boolean indicating that only power of 2 textures are supported Please note that you can still use non power of 2 textures but in this case the engine will forcefully convert them

    Returns boolean

shaderPlatformName

  • get shaderPlatformName(): string
  • Gets the shader platform name used by the effects.

    Returns string

snapshotRendering

  • get snapshotRendering(): boolean
  • set snapshotRendering(activate: boolean): any
  • Enables or disables the snapshot rendering mode Note that the WebGL engine does not support snapshot rendering so setting the value won't have any effect for this engine

    Returns boolean

  • Enables or disables the snapshot rendering mode Note that the WebGL engine does not support snapshot rendering so setting the value won't have any effect for this engine

    Parameters

    • activate: boolean

    Returns any

snapshotRenderingMode

  • get snapshotRenderingMode(): number
  • set snapshotRenderingMode(mode: number): any
  • Gets or sets the snapshot rendering mode

    Returns number

  • Gets or sets the snapshot rendering mode

    Parameters

    • mode: number

    Returns any

stencilState

  • get stencilState(): StencilState
  • Gets the stencil state manager

    Returns StencilState

stencilStateComposer

  • get stencilStateComposer(): StencilStateComposer
  • Gets the stencil state composer

    Returns StencilStateComposer

supportsUniformBuffers

  • get supportsUniformBuffers(): boolean

useReverseDepthBuffer

  • get useReverseDepthBuffer(): boolean
  • set useReverseDepthBuffer(useReverse: boolean): any
  • Gets or sets a boolean indicating if depth buffer should be reverse, going from far to near. This can provide greater z depth for distant objects.

    Returns boolean

  • Gets or sets a boolean indicating if depth buffer should be reverse, going from far to near. This can provide greater z depth for distant objects.

    Parameters

    • useReverse: boolean

    Returns any

version

  • get version(): number
  • Returns the version of the engine

    Returns number

webGLVersion

  • get webGLVersion(): number
  • Gets version of the current webGL context Keep it for back compat - use version instead

    Returns number

Static HasMajorPerformanceCaveat

  • get HasMajorPerformanceCaveat(): boolean
  • Gets a boolean indicating if the engine can be instantiated on a performant device (ie. if a webGL context can be found and it does not use a slow implementation)

    Returns boolean

Static IsSupported

  • get IsSupported(): boolean
  • Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)

    Returns boolean

Static IsSupportedAsync

  • get IsSupportedAsync(): Promise<boolean>
Gets a Promise indicating if the engine can be instantiated (ie. if a webGL context can be found)

Returns Promise<boolean>

Static NpmPackage

  • get NpmPackage(): string
  • Returns the current npm package of the sdk

    Returns string

Static ShadersRepository

  • get ShadersRepository(): string
  • set ShadersRepository(value: string): any
  • Gets or sets the relative url used to load shaders if using the engine in non-minified mode

    Returns string

  • Gets or sets the relative url used to load shaders if using the engine in non-minified mode

    Parameters

    • value: string

    Returns any

Static Version

  • get Version(): string
  • Returns the current version of the framework

    Returns string

Methods

_createDepthStencilCubeTextureSearch playground for _createDepthStencilCubeTexture

  • Creates a depth stencil cube texture. This is only available in WebGL 2.

    Parameters

    • size: number

      The size of face edge in the cube texture.

    • options: DepthTextureCreationOptions

      The options defining the cube texture.

    • rtWrapper: RenderTargetWrapper

      The render target wrapper for which the depth/stencil texture must be created

    Returns InternalTexture

    The cube texture

applyStatesSearch playground for applyStates

  • applyStates(): void
  • Apply all cached states (depth, culling, stencil and alpha)

    Returns void

areAllComputeEffectsReadySearch playground for areAllComputeEffectsReady

  • areAllComputeEffectsReady(): boolean
  • Gets a boolean indicating if all created compute effects are ready

    Returns boolean

    true if all effects are ready

areAllEffectsReadySearch playground for areAllEffectsReady

  • areAllEffectsReady(): boolean
  • Gets a boolean indicating if all created effects are ready

    Returns boolean

    true if all effects are ready

attachContextLostEventSearch playground for attachContextLostEvent

  • attachContextLostEvent(callback: (event: WebGLContextEvent) => void): void
  • Attach a new callback raised when context lost event is fired

    Parameters

    • callback: (event: WebGLContextEvent) => void

      defines the callback to call

        • (event: WebGLContextEvent): void
        • Parameters

          • event: WebGLContextEvent

          Returns void

    Returns void

attachContextRestoredEventSearch playground for attachContextRestoredEvent

  • attachContextRestoredEvent(callback: (event: WebGLContextEvent) => void): void
  • Attach a new callback raised when context restored event is fired

    Parameters

    • callback: (event: WebGLContextEvent) => void

      defines the callback to call

        • (event: WebGLContextEvent): void
        • Parameters

          • event: WebGLContextEvent

          Returns void

    Returns void

beginFrameSearch playground for beginFrame

  • beginFrame(): void
  • Begin a new frame

    Returns void

bindArrayBufferSearch playground for bindArrayBuffer

  • Bind a webGL buffer to the webGL context

    Parameters

    Returns void

bindAttachmentsSearch playground for bindAttachments

  • bindAttachments(attachments: number[]): void
  • Select a subsets of attachments to draw to.

    Parameters

    • attachments: number[]

      gl attachments

    Returns void

bindBuffersSearch playground for bindBuffers

  • Bind a list of vertex buffers to the webGL context

    Parameters

    • vertexBuffers: {}

      defines the list of vertex buffers to bind

    • indexBuffer: Nullable<DataBuffer>

      defines the index buffer to bind

    • effect: Effect

      defines the effect associated with the vertex buffers

    • Optional overrideVertexBuffers: {}

      defines optional list of avertex buffers that overrides the entries in vertexBuffers

    Returns void

bindBuffersDirectlySearch playground for bindBuffersDirectly

  • bindBuffersDirectly(vertexBuffer: DataBuffer, indexBuffer: DataBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void
  • Bind webGl buffers directly to the webGL context

    Parameters

    • vertexBuffer: DataBuffer

      defines the vertex buffer to bind

    • indexBuffer: DataBuffer

      defines the index buffer to bind

    • vertexDeclaration: number[]

      defines the vertex declaration to use with the vertex buffer

    • vertexStrideSize: number

      defines the vertex stride of the vertex buffer

    • effect: Effect

      defines the effect associated with the vertex buffer

    Returns void

bindFramebufferSearch playground for bindFramebuffer

  • bindFramebuffer(texture: RenderTargetWrapper, faceIndex?: number, requiredWidth?: number, requiredHeight?: number, forceFullscreenViewport?: boolean, lodLevel?: number, layer?: number): void
  • Binds the frame buffer to the specified texture.

    Parameters

    • texture: RenderTargetWrapper

      The render target wrapper to render to

    • Optional faceIndex: number

      The face of the texture to render to in case of cube texture

    • Optional requiredWidth: number

      The width of the target to render to

    • Optional requiredHeight: number

      The height of the target to render to

    • Optional forceFullscreenViewport: boolean

      Forces the viewport to be the entire texture/screen if true

    • Optional lodLevel: number

      defines the lod level to bind to the frame buffer

    • Optional layer: number

      defines the 2d array index to bind to frame buffer to

    Returns void

bindInstancesBufferSearch playground for bindInstancesBuffer

  • Bind the content of a webGL buffer used with instantiation

    Parameters

    • instancesBuffer: DataBuffer

      defines the webGL buffer to bind

    • attributesInfo: InstancingAttributeInfo[]

      defines the offsets or attributes information used to determine where data must be stored in the buffer

    • Optional computeStride: boolean

      defines Whether to compute the strides from the info or use the default 0

    Returns void

bindSamplersSearch playground for bindSamplers

  • bindSamplers(effect: Effect): void
  • Binds an effect to the webGL context

    Parameters

    • effect: Effect

      defines the effect to bind

    Returns void

bindUniformBlockSearch playground for bindUniformBlock

  • bindUniformBlock(pipelineContext: IPipelineContext, blockName: string, index: number): void
  • Bind a specific block at a given index in a specific shader program

    Parameters

    • pipelineContext: IPipelineContext

      defines the pipeline context to use

    • blockName: string

      defines the block name

    • index: number

      defines the index where to bind the block

    Returns void

bindUniformBufferSearch playground for bindUniformBuffer

  • Bind an uniform buffer to the current webGL context

    Parameters

    Returns void

bindUniformBufferBaseSearch playground for bindUniformBufferBase

  • bindUniformBufferBase(buffer: DataBuffer, location: number, name: string): void
  • Bind a buffer to the current webGL context at a given location

    Parameters

    • buffer: DataBuffer

      defines the buffer to bind

    • location: number

      defines the index where to bind the buffer

    • name: string

      Name of the uniform variable to bind

    Returns void

bindVertexArrayObjectSearch playground for bindVertexArrayObject

buildTextureLayoutSearch playground for buildTextureLayout

  • buildTextureLayout(textureStatus: boolean[]): number[]
  • Creates a layout object to draw/clear on specific textures in a MRT

    Parameters

    • textureStatus: boolean[]

      textureStatus[i] indicates if the i-th is active

    Returns number[]

    A layout to be fed to the engine, calling bindAttachments.

clearSearch playground for clear

  • clear(color: Nullable<IColor4Like>, backBuffer: boolean, depth: boolean, stencil?: boolean): void
  • Clear the current render buffer or the current render target (if any is set up)

    Parameters

    • color: Nullable<IColor4Like>

      defines the color to use

    • backBuffer: boolean

      defines if the back buffer must be cleared

    • depth: boolean

      defines if the depth buffer must be cleared

    • Optional stencil: boolean

      defines if the stencil buffer must be cleared

    Returns void

clearInternalTexturesCacheSearch playground for clearInternalTexturesCache

  • clearInternalTexturesCache(): void
  • Clears the list of texture accessible through engine. This can help preventing texture load conflict due to name collision.

    Returns void

computeDispatchSearch playground for computeDispatch

  • computeDispatch(effect: ComputeEffect, context: IComputeContext, bindings: ComputeBindingList, x: number, y?: number, z?: number, bindingsMapping?: ComputeBindingMapping): void
  • Dispatches a compute shader

    Parameters

    • effect: ComputeEffect

      The compute effect

    • context: IComputeContext

      The compute context

    • bindings: ComputeBindingList

      The list of resources to bind to the shader

    • x: number

      The number of workgroups to execute on the X dimension

    • Optional y: number

      The number of workgroups to execute on the Y dimension

    • Optional z: number

      The number of workgroups to execute on the Z dimension

    • Optional bindingsMapping: ComputeBindingMapping

      list of bindings mapping (key is property name, value is binding location)

    Returns void

createCanvasSearch playground for createCanvas

  • createCanvas(width: number, height: number): ICanvas
  • Create a canvas. This method is overridden by other engines

    Parameters

    • width: number

      width

    • height: number

      height

    Returns ICanvas

    ICanvas interface

createCanvasImageSearch playground for createCanvasImage

  • Create an image to use with canvas

    Returns IImage

    IImage interface

createComputeContextSearch playground for createComputeContext

  • createComputeContext(): IComputeContext | undefined
  • Creates a new compute context

    Returns IComputeContext | undefined

    the new context

createComputeEffectSearch playground for createComputeEffect

  • Creates a new compute effect

    Parameters

    Returns ComputeEffect

    The new compute effect

createComputePipelineContextSearch playground for createComputePipelineContext

  • Creates a new compute pipeline context

    Returns IComputePipelineContext

    the new pipeline

createCubeTextureSearch playground for createCubeTexture

  • createCubeTexture(rootUrl: string, scene: Nullable<Scene>, files: Nullable<string[]>, noMipmap: boolean | undefined, onLoad: Nullable<(data?: any) => void>, onError: Nullable<(message?: string, exception?: any) => void>, format: number | undefined, forcedExtension: any, createPolynomials: boolean, lodScale: number, lodOffset: number, fallback: Nullable<InternalTexture>, loaderOptions: any, useSRGBBuffer: boolean): InternalTexture
  • createCubeTexture(rootUrl: string, scene: Nullable<Scene>, files: Nullable<string[]>, noMipmap: boolean, onLoad: Nullable<(data?: any) => void>, onError: Nullable<(message?: string, exception?: any) => void>, format: number | undefined, forcedExtension: any): InternalTexture
  • createCubeTexture(rootUrl: string, scene: Nullable<Scene>, files: Nullable<string[]>, noMipmap: boolean, onLoad: Nullable<(data?: any) => void>, onError: Nullable<(message?: string, exception?: any) => void>, format: number | undefined, forcedExtension: any, createPolynomials: boolean, lodScale: number, lodOffset: number): InternalTexture
  • Creates a cube texture

    Parameters

    • rootUrl: string

      defines the url where the files to load is located

    • scene: Nullable<Scene>

      defines the current scene

    • files: Nullable<string[]>

      defines the list of files to load (1 per face)

    • noMipmap: boolean | undefined

      defines a boolean indicating that no mipmaps shall be generated (false by default)

    • onLoad: Nullable<(data?: any) => void>

      defines an optional callback raised when the texture is loaded

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

      defines an optional callback raised if there is an issue to load the texture

    • format: number | undefined

      defines the format of the data

    • forcedExtension: any

      defines the extension to use to pick the right loader

    • createPolynomials: boolean

      if a polynomial sphere should be created for the cube texture

    • lodScale: number

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

    • lodOffset: number

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

    • fallback: Nullable<InternalTexture>

      defines texture to use while falling back when (compressed) texture file not found.

    • loaderOptions: any

      options to be passed to the loader

    • useSRGBBuffer: boolean

      defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).

    Returns InternalTexture

    the cube texture as an InternalTexture

  • Creates a cube texture

    Parameters

    • rootUrl: string

      defines the url where the files to load is located

    • scene: Nullable<Scene>

      defines the current scene

    • files: Nullable<string[]>

      defines the list of files to load (1 per face)

    • noMipmap: boolean

      defines a boolean indicating that no mipmaps shall be generated (false by default)

    • onLoad: Nullable<(data?: any) => void>

      defines an optional callback raised when the texture is loaded

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

      defines an optional callback raised if there is an issue to load the texture

    • format: number | undefined

      defines the format of the data

    • forcedExtension: any

      defines the extension to use to pick the right loader

    Returns InternalTexture

    the cube texture as an InternalTexture

  • Creates a cube texture

    Parameters

    • rootUrl: string

      defines the url where the files to load is located

    • scene: Nullable<Scene>

      defines the current scene

    • files: Nullable<string[]>

      defines the list of files to load (1 per face)

    • noMipmap: boolean

      defines a boolean indicating that no mipmaps shall be generated (false by default)

    • onLoad: Nullable<(data?: any) => void>

      defines an optional callback raised when the texture is loaded

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

      defines an optional callback raised if there is an issue to load the texture

    • format: number | undefined

      defines the format of the data

    • forcedExtension: any

      defines the extension to use to pick the right loader

    • createPolynomials: boolean

      if a polynomial sphere should be created for the cube texture

    • lodScale: number

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

    • lodOffset: number

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

    Returns InternalTexture

    the cube texture as an InternalTexture

createDepthStencilTextureSearch playground for createDepthStencilTexture

  • Creates a depth stencil texture. This is only available in WebGL 2 or with the depth texture extension available.

    Parameters

    Returns InternalTexture

    The texture

createDrawContextSearch playground for createDrawContext

  • createDrawContext(): IDrawContext | undefined
  • Creates a new draw context

    Returns IDrawContext | undefined

    the new context

createDynamicTextureSearch playground for createDynamicTexture

  • createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture
  • Creates a dynamic texture

    Parameters

    • width: number

      defines the width of the texture

    • height: number

      defines the height of the texture

    • generateMipMaps: boolean

      defines if the engine should generate the mip levels

    • samplingMode: number

      defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)

    Returns InternalTexture

    the dynamic texture inside an InternalTexture

createDynamicUniformBufferSearch playground for createDynamicUniformBuffer

createDynamicVertexBufferSearch playground for createDynamicVertexBuffer

  • Creates a dynamic vertex buffer

    Parameters

    • data: DataArray

      the data for the dynamic vertex buffer

    Returns DataBuffer

    the new WebGL dynamic buffer

createEffectSearch playground for createEffect

  • Create a new effect (used to store vertex/fragment shaders)

    Parameters

    • baseName: any

      defines the base name of the effect (The name of file without .fragment.fx or .vertex.fx)

    • attributesNamesOrOptions: string[] | IEffectCreationOptions

      defines either a list of attribute names or an IEffectCreationOptions object

    • uniformsNamesOrEngine: string[] | ThinEngine

      defines either a list of uniform names or the engine to use

    • Optional samplers: string[]

      defines an array of string used to represent textures

    • Optional defines: string

      defines the string containing the defines to use to compile the shaders

    • Optional fallbacks: IEffectFallbacks

      defines the list of potential fallbacks to use if shader compilation fails

    • Optional onCompiled: Nullable<(effect: Effect) => void>

      defines a function to call when the effect creation is successful

    • Optional onError: Nullable<(effect: Effect, errors: string) => void>

      defines a function to call when the effect creation has failed

    • Optional indexParameters: any

      defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)

    • Optional shaderLanguage: ShaderLanguage

      the language the shader is written in (default: GLSL)

    Returns Effect

    the new Effect

createExternalTextureSearch playground for createExternalTexture

  • Creates an external texture

    Parameters

    Returns Nullable<ExternalTexture>

    the external texture, or null if external textures are not supported by the engine

createIndexBufferSearch playground for createIndexBuffer

  • Creates a new index buffer

    Parameters

    • indices: IndicesArray

      defines the content of the index buffer

    • Optional updatable: boolean

      defines if the index buffer must be updatable

    Returns DataBuffer

    a new webGL buffer

createMaterialContextSearch playground for createMaterialContext

  • createMaterialContext(): IMaterialContext | undefined
  • Creates a new material context

    Returns IMaterialContext | undefined

    the new context

createMultipleRenderTargetSearch playground for createMultipleRenderTarget

createPipelineContextSearch playground for createPipelineContext

  • Creates a new pipeline context

    Parameters

    • shaderProcessingContext: Nullable<ShaderProcessingContext>

      defines the shader processing context used during the processing if available

    Returns IPipelineContext

    the new pipeline

createPrefilteredCubeTextureSearch playground for createPrefilteredCubeTexture

  • Create a cube texture from prefiltered data (ie. the mipmaps contain ready to use data for PBR reflection)

    Parameters

    • rootUrl: string

      defines the url where the file to load is located

    • scene: Nullable<Scene>

      defines the current scene

    • lodScale: number

      defines scale to apply to the mip map selection

    • lodOffset: number

      defines offset to apply to the mip map selection

    • Optional onLoad: Nullable<(internalTexture: Nullable<InternalTexture>) => void>

      defines an optional callback raised when the texture is loaded

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

      defines an optional callback raised if there is an issue to load the texture

    • Optional format: number

      defines the format of the data

    • Optional forcedExtension: any

      defines the extension to use to pick the right loader

    • Optional createPolynomials: boolean

      defines wheter or not to create polynomails harmonics for the texture

    Returns InternalTexture

    the cube texture as an InternalTexture

createRawCubeTextureSearch playground for createRawCubeTexture

  • createRawCubeTexture(data: Nullable<ArrayBufferView[]>, size: number, format: number, type: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string>): InternalTexture
  • Creates a new raw cube texture

    Parameters

    • data: Nullable<ArrayBufferView[]>

      defines the array of data to use to create each face

    • size: number

      defines the size of the textures

    • format: number

      defines the format of the data

    • type: number

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

    • generateMipMaps: boolean

      defines if the engine should generate the mip levels

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    • samplingMode: number

      defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)

    • compression: Nullable<string>

      defines the compression used (null by default)

    Returns InternalTexture

    the cube texture as an InternalTexture

createRawCubeTextureFromUrlSearch playground for createRawCubeTextureFromUrl

  • createRawCubeTextureFromUrl(url: string, scene: Nullable<Scene>, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>, mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>, onLoad: Nullable<() => void>, onError: Nullable<(message?: string, exception?: any) => void>): InternalTexture
  • createRawCubeTextureFromUrl(url: string, scene: Nullable<Scene>, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>, mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>, onLoad: Nullable<() => void>, onError: Nullable<(message?: string, exception?: any) => void>, samplingMode: number, invertY: boolean): InternalTexture
  • Creates a new raw cube texture from a specified url

    Parameters

    • url: string

      defines the url where the data is located

    • scene: Nullable<Scene>

      defines the current scene

    • size: number

      defines the size of the textures

    • format: number

      defines the format of the data

    • type: number

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

    • noMipmap: boolean

      defines if the engine should avoid generating the mip levels

    • callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>

      defines a callback used to extract texture data from loaded data

        • (ArrayBuffer: ArrayBuffer): Nullable<ArrayBufferView[]>
        • Parameters

          • ArrayBuffer: ArrayBuffer

          Returns Nullable<ArrayBufferView[]>

    • mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>

      defines to provide an optional tool to generate mip levels

    • onLoad: Nullable<() => void>

      defines a callback called when texture is loaded

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

      defines a callback called if there is an error

    Returns InternalTexture

    the cube texture as an InternalTexture

  • Creates a new raw cube texture from a specified url

    Parameters

    • url: string

      defines the url where the data is located

    • scene: Nullable<Scene>

      defines the current scene

    • size: number

      defines the size of the textures

    • format: number

      defines the format of the data

    • type: number

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

    • noMipmap: boolean

      defines if the engine should avoid generating the mip levels

    • callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>

      defines a callback used to extract texture data from loaded data

        • (ArrayBuffer: ArrayBuffer): Nullable<ArrayBufferView[]>
        • Parameters

          • ArrayBuffer: ArrayBuffer

          Returns Nullable<ArrayBufferView[]>

    • mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>

      defines to provide an optional tool to generate mip levels

    • onLoad: Nullable<() => void>

      defines a callback called when texture is loaded

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

      defines a callback called if there is an error

    • samplingMode: number

      defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    Returns InternalTexture

    the cube texture as an InternalTexture

createRawShaderProgramSearch playground for createRawShaderProgram

  • Directly creates a webGL program

    Parameters

    • pipelineContext: IPipelineContext

      defines the pipeline context to attach to

    • vertexCode: string

      defines the vertex shader code to use

    • fragmentCode: string

      defines the fragment shader code to use

    • Optional context: WebGLRenderingContext

      defines the webGL context to use (if not set, the current one will be used)

    • Optional transformFeedbackVaryings: Nullable<string[]>

      defines the list of transform feedback varyings to use

    Returns WebGLProgram

    the new webGL program

createRawTextureSearch playground for createRawTexture

  • createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string>, type: number, creationFlags?: number, useSRGBBuffer?: boolean): InternalTexture
  • Creates a raw texture

    Parameters

    • data: Nullable<ArrayBufferView>

      defines the data to store in the texture

    • width: number

      defines the width of the texture

    • height: number

      defines the height of the texture

    • format: number

      defines the format of the data

    • generateMipMaps: boolean

      defines if the engine should generate the mip levels

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    • samplingMode: number

      defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)

    • compression: Nullable<string>

      defines the compression used (null by default)

    • type: number

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

    • Optional creationFlags: number

      specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)

    • Optional useSRGBBuffer: boolean

      defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).

    Returns InternalTexture

    the raw texture inside an InternalTexture

createRawTexture2DArraySearch playground for createRawTexture2DArray

  • createRawTexture2DArray(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string>, textureType: number, creationFlags?: number): InternalTexture
  • Creates a new raw 2D array texture

    Parameters

    • data: Nullable<ArrayBufferView>

      defines the data used to create the texture

    • width: number

      defines the width of the texture

    • height: number

      defines the height of the texture

    • depth: number

      defines the number of layers of the texture

    • format: number

      defines the format of the texture

    • generateMipMaps: boolean

      defines if the engine must generate mip levels

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    • samplingMode: number

      defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)

    • compression: Nullable<string>

      defines the compressed used (can be null)

    • textureType: number

      defines the compressed used (can be null)

    • Optional creationFlags: number

      specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)

    Returns InternalTexture

    a new raw 2D array texture (stored in an InternalTexture)

createRawTexture3DSearch playground for createRawTexture3D

  • createRawTexture3D(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string>, textureType: number, creationFlags?: number): InternalTexture
  • Creates a new raw 3D texture

    Parameters

    • data: Nullable<ArrayBufferView>

      defines the data used to create the texture

    • width: number

      defines the width of the texture

    • height: number

      defines the height of the texture

    • depth: number

      defines the depth of the texture

    • format: number

      defines the format of the texture

    • generateMipMaps: boolean

      defines if the engine must generate mip levels

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    • samplingMode: number

      defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)

    • compression: Nullable<string>

      defines the compressed used (can be null)

    • textureType: number

      defines the compressed used (can be null)

    • Optional creationFlags: number

      specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)

    Returns InternalTexture

    a new raw 3D texture (stored in an InternalTexture)

createRenderTargetCubeTextureSearch playground for createRenderTargetCubeTexture

  • Creates a new render target cube wrapper

    Parameters

    • size: number

      defines the size of the texture

    • Optional options: Partial<RenderTargetCreationOptions>

      defines the options used to create the texture

    Returns RenderTargetWrapper

    a new render target cube wrapper

createRenderTargetTextureSearch playground for createRenderTargetTexture

  • Creates a new render target texture

    Parameters

    Returns RenderTargetWrapper

    a new render target wrapper ready to render texture

createShaderProgramSearch playground for createShaderProgram

  • Creates a webGL program

    Parameters

    • pipelineContext: IPipelineContext

      defines the pipeline context to attach to

    • vertexCode: string

      defines the vertex shader code to use

    • fragmentCode: string

      defines the fragment shader code to use

    • defines: Nullable<string>

      defines the string containing the defines to use to compile the shaders

    • Optional context: WebGLRenderingContext

      defines the webGL context to use (if not set, the current one will be used)

    • Optional transformFeedbackVaryings: Nullable<string[]>

      defines the list of transform feedback varyings to use

    Returns WebGLProgram

    the new webGL program

createStorageBufferSearch playground for createStorageBuffer

  • Creates a storage buffer

    Parameters

    • data: DataArray | number

      the data for the storage buffer or the size of the buffer

    • creationFlags: number

      flags to use when creating the buffer (see Constants.BUFFER_CREATIONFLAG_XXX). The BUFFER_CREATIONFLAG_STORAGE flag will be automatically added

    Returns DataBuffer

    the new buffer

createTextureSearch playground for createTexture

  • Usually called from Texture.ts. Passed information to create a WebGLTexture

    Parameters

    • url: Nullable<string>

      defines a value which contains one of the following:

      • A conventional http URL, e.g. 'http://...' or 'file://...'
      • A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
      • An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
    • noMipmap: boolean

      defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file

    • invertY: boolean

      when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)

    • scene: Nullable<ISceneLike>

      needed for loading to the correct scene

    • Optional samplingMode: number

      mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)

    • Optional onLoad: Nullable<(texture: InternalTexture) => void>

      optional callback to be called upon successful completion

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

      optional callback to be called upon failure

    • Optional buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap>

      a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob

    • Optional fallback: Nullable<InternalTexture>

      an internal argument in case the function must be called again, due to etc1 not having alpha capabilities

    • Optional format: Nullable<number>

      internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures

    • Optional forcedExtension: Nullable<string>

      defines the extension to use to pick the right loader

    • Optional mimeType: string

      defines an optional mime type

    • Optional loaderOptions: any

      options to be passed to the loader

    • Optional creationFlags: number

      specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)

    • Optional useSRGBBuffer: boolean

      defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).

    Returns InternalTexture

    a InternalTexture for assignment back into BABYLON.Texture

createUniformBufferSearch playground for createUniformBuffer

createVertexBufferSearch playground for createVertexBuffer

  • Creates a vertex buffer

    Parameters

    • data: DataArray

      the data for the vertex buffer

    Returns DataBuffer

    the new WebGL static buffer

disableAttributeByIndexSearch playground for disableAttributeByIndex

  • disableAttributeByIndex(attributeLocation: number): void
  • Disable the attribute corresponding to the location in parameter

    Parameters

    • attributeLocation: number

      defines the attribute location of the attribute to disable

    Returns void

disableInstanceAttributeSearch playground for disableInstanceAttribute

  • disableInstanceAttribute(attributeLocation: number): void
  • Disable the instance attribute corresponding to the location in parameter

    Parameters

    • attributeLocation: number

      defines the attribute location of the attribute to disable

    Returns void

disableInstanceAttributeByNameSearch playground for disableInstanceAttributeByName

  • disableInstanceAttributeByName(name: string): void
  • Disable the instance attribute corresponding to the name in parameter

    Parameters

    • name: string

      defines the name of the attribute to disable

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Dispose and release all associated resources

    Returns void

drawSearch playground for draw

  • draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void
  • Send a draw order

    Parameters

    • useTriangles: boolean

      defines if triangles must be used to draw (else wireframe will be used)

    • indexStart: number

      defines the starting index

    • indexCount: number

      defines the number of index to draw

    • Optional instancesCount: number

      defines the number of instances to draw (if instantiation is enabled)

    Returns void

drawArraysTypeSearch playground for drawArraysType

  • drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void
  • Draw a list of unindexed primitives

    Parameters

    • fillMode: number

      defines the primitive to use

    • verticesStart: number

      defines the index of first vertex to draw

    • verticesCount: number

      defines the count of vertices to draw

    • Optional instancesCount: number

      defines the number of instances to draw (if instantiation is enabled)

    Returns void

drawElementsTypeSearch playground for drawElementsType

  • drawElementsType(fillMode: number, indexStart: number, indexCount: number, instancesCount?: number): void
  • Draw a list of indexed primitives

    Parameters

    • fillMode: number

      defines the primitive to use

    • indexStart: number

      defines the starting index

    • indexCount: number

      defines the number of index to draw

    • Optional instancesCount: number

      defines the number of instances to draw (if instantiation is enabled)

    Returns void

drawPointCloudsSearch playground for drawPointClouds

  • drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void
  • Draw a list of points

    Parameters

    • verticesStart: number

      defines the index of first vertex to draw

    • verticesCount: number

      defines the count of vertices to draw

    • Optional instancesCount: number

      defines the number of instances to draw (if instantiation is enabled)

    Returns void

drawUnIndexedSearch playground for drawUnIndexed

  • drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void
  • Draw a list of unindexed primitives

    Parameters

    • useTriangles: boolean

      defines if triangles must be used to draw (else wireframe will be used)

    • verticesStart: number

      defines the index of first vertex to draw

    • verticesCount: number

      defines the count of vertices to draw

    • Optional instancesCount: number

      defines the number of instances to draw (if instantiation is enabled)

    Returns void

enableEffectSearch playground for enableEffect

  • Activates an effect, making it the current one (ie. the one used for rendering)

    Parameters

    • effect: Nullable<Effect | DrawWrapper>

      defines the effect to activate

    Returns void

endFrameSearch playground for endFrame

  • endFrame(): void
  • Enf the current frame

    Returns void

flushFramebufferSearch playground for flushFramebuffer

  • flushFramebuffer(): void
  • Force a webGL flush (ie. a flush of all waiting webGL commands)

    Returns void

generateMipmapsSearch playground for generateMipmaps

  • Generates the mipmaps for a texture

    Parameters

    Returns void

getAlphaEquationSearch playground for getAlphaEquation

  • getAlphaEquation(): number
  • Gets the current alpha equation.

    Returns number

    the current alpha equation

getAlphaModeSearch playground for getAlphaMode

  • getAlphaMode(): number

getAttributesSearch playground for getAttributes

  • getAttributes(pipelineContext: IPipelineContext, attributesNames: string[]): number[]
  • Gets the list of active attributes for a given webGL program

    Parameters

    • pipelineContext: IPipelineContext

      defines the pipeline context to use

    • attributesNames: string[]

      defines the list of attribute names to get

    Returns number[]

    an array of indices indicating the offset of each attribute

getAudioContextSearch playground for getAudioContext

  • getAudioContext(): Nullable<AudioContext>
  • Gets the audio context specified in engine initialization options

    Returns Nullable<AudioContext>

    an Audio Context

getAudioDestinationSearch playground for getAudioDestination

  • getAudioDestination(): Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode>
  • Gets the audio destination specified in engine initialization options

    Returns Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode>

    an audio destination node

getCapsSearch playground for getCaps

  • Gets the object containing all engine capabilities

    Returns EngineCapabilities

    the EngineCapabilities object

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Gets a string identifying the name of the class

    Returns string

    "Engine" string

getColorWriteSearch playground for getColorWrite

  • getColorWrite(): boolean
  • Gets a boolean indicating if color writing is enabled

    Returns boolean

    the current color writing state

getCreationOptionsSearch playground for getCreationOptions

  • Gets the options used for engine creation

    Returns EngineOptions

    EngineOptions object

getErrorSearch playground for getError

  • getError(): number

getGlInfoSearch playground for getGlInfo

  • getGlInfo(): { renderer: string; vendor: string; version: string }
  • Gets an object containing information about the current webGL context

    Returns { renderer: string; vendor: string; version: string }

    an object containing the vendor, the renderer and the version of the current webGL context

    • renderer: string
    • vendor: string
    • version: string

getHardwareScalingLevelSearch playground for getHardwareScalingLevel

  • getHardwareScalingLevel(): number
  • Gets the current hardware scaling level. By default the hardware scaling level is computed from the window device ratio. if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.

    Returns number

    a number indicating the current hardware scaling level

getHostDocumentSearch playground for getHostDocument

  • Gets host document

    Returns Nullable<Document>

    the host document object

getHostWindowSearch playground for getHostWindow

  • Gets host window

    Returns Nullable<Window>

    the host window object

getInfoSearch playground for getInfo

  • getInfo(): { renderer: string; vendor: string; version: string }
  • Gets an object containing information about the current engine context

    Returns { renderer: string; vendor: string; version: string }

    an object containing the vendor, the renderer and the version of the current engine context

    • renderer: string
    • vendor: string
    • version: string

getLoadedTexturesCacheSearch playground for getLoadedTexturesCache

  • Gets the list of loaded textures

    Returns InternalTexture[]

    an array containing all loaded textures

getRenderHeightSearch playground for getRenderHeight

  • getRenderHeight(useScreen?: boolean): number
  • Gets the current render height

    Parameters

    • Optional useScreen: boolean

      defines if screen size must be used (or the current render target if any)

    Returns number

    a number defining the current render height

getRenderWidthSearch playground for getRenderWidth

  • getRenderWidth(useScreen?: boolean): number
  • Gets the current render width

    Parameters

    • Optional useScreen: boolean

      defines if screen size must be used (or the current render target if any)

    Returns number

    a number defining the current render width

getRenderingCanvasSearch playground for getRenderingCanvas

  • Gets the HTML canvas attached with the current webGL context

    Returns Nullable<HTMLCanvasElement>

    a HTML canvas

getUniformsSearch playground for getUniforms

  • Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names

    Parameters

    • pipelineContext: IPipelineContext

      defines the pipeline context to use

    • uniformsNames: string[]

      defines the list of uniform names

    Returns Nullable<WebGLUniformLocation>[]

    an array of webGL uniform locations

getZOffsetSearch playground for getZOffset

  • getZOffset(): number
  • Gets the current value of the zOffset Factor

    Returns number

    the current zOffset Factor state

getZOffsetUnitsSearch playground for getZOffsetUnits

  • getZOffsetUnits(): number
  • Gets the current value of the zOffset Units

    Returns number

    the current zOffset Units state

inlineShaderCodeSearch playground for inlineShaderCode

  • inlineShaderCode(code: string): string
  • Inline functions in shader code that are marked to be inlined

    Parameters

    • code: string

      code to inline

    Returns string

    inlined code

readFromStorageBufferSearch playground for readFromStorageBuffer

  • readFromStorageBuffer(storageBuffer: DataBuffer, offset?: number, size?: number, buffer?: ArrayBufferView): Promise<ArrayBufferView>
  • Read data from a storage buffer

    Parameters

    • storageBuffer: DataBuffer

      The storage buffer to read from

    • Optional offset: number

      The offset in the storage buffer to start reading from (default: 0)

    • Optional size: number

      The number of bytes to read from the storage buffer (default: capacity of the buffer)

    • Optional buffer: ArrayBufferView

      The buffer to write the data we have read from the storage buffer to (optional)

    Returns Promise<ArrayBufferView>

    If not undefined, returns the (promise) buffer (as provided by the 4th parameter) filled with the data, else it returns a (promise) Uint8Array with the data read from the storage buffer

readPixelsSearch playground for readPixels

  • readPixels(x: number, y: number, width: number, height: number, hasAlpha?: boolean, flushRenderer?: boolean): Promise<ArrayBufferView>
  • Reads pixels from the current frame buffer. Please note that this function can be slow

    Parameters

    • x: number

      defines the x coordinate of the rectangle where pixels must be read

    • y: number

      defines the y coordinate of the rectangle where pixels must be read

    • width: number

      defines the width of the rectangle where pixels must be read

    • height: number

      defines the height of the rectangle where pixels must be read

    • Optional hasAlpha: boolean

      defines whether the output should have alpha or not (defaults to true)

    • Optional flushRenderer: boolean

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

    Returns Promise<ArrayBufferView>

    a ArrayBufferView promise (Uint8Array) containing RGBA colors

recordVertexArrayObjectSearch playground for recordVertexArrayObject

releaseComputeEffectsSearch playground for releaseComputeEffects

  • releaseComputeEffects(): void
  • Forces the engine to release all cached compute effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled

    Returns void

releaseEffectsSearch playground for releaseEffects

  • releaseEffects(): void
  • Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled

    Returns void

releaseVertexArrayObjectSearch playground for releaseVertexArrayObject

  • Release and free the memory of a vertex array object

    Parameters

    Returns void

resetTextureCacheSearch playground for resetTextureCache

  • resetTextureCache(): void
  • Reset the texture cache to empty state

    Returns void

resizeSearch playground for resize

  • resize(forceSetSize?: boolean): void
  • Resize the view according to the canvas' size

    Parameters

    • Optional forceSetSize: boolean

      true to force setting the sizes of the underlying canvas

    Returns void

restoreDefaultFramebufferSearch playground for restoreDefaultFramebuffer

  • restoreDefaultFramebuffer(): void
  • Unbind the current render target and bind the default framebuffer

    Returns void

restoreSingleAttachmentSearch playground for restoreSingleAttachment

  • restoreSingleAttachment(): void
  • Restores the webgl state to only draw on the main color attachment when the frame buffer associated is the canvas frame buffer

    Returns void

restoreSingleAttachmentForRenderTargetSearch playground for restoreSingleAttachmentForRenderTarget

  • restoreSingleAttachmentForRenderTarget(): void
  • Restores the webgl state to only draw on the main color attachment when the frame buffer associated is not the canvas frame buffer

    Returns void

runRenderLoopSearch playground for runRenderLoop

  • runRenderLoop(renderFunction: () => void): void
  • Register and execute a render loop. The engine can have more than one render function

    Parameters

    • renderFunction: () => void

      defines the function to continuously execute

        • (): void
        • Returns void

    Returns void

setAlphaConstantsSearch playground for setAlphaConstants

  • setAlphaConstants(r: number, g: number, b: number, a: number): void
  • Sets alpha constants used by some alpha blending modes

    Parameters

    • r: number

      defines the red component

    • g: number

      defines the green component

    • b: number

      defines the blue component

    • a: number

      defines the alpha component

    Returns void

setAlphaEquationSearch playground for setAlphaEquation

  • setAlphaEquation(equation: number): void
  • Sets the current alpha equation

    Parameters

    • equation: number

      defines the equation to use (one of the Engine.ALPHA_EQUATION_XXX)

    Returns void

setAlphaModeSearch playground for setAlphaMode

  • setAlphaMode(mode: number, noDepthWriteChange?: boolean): void

setArraySearch playground for setArray

  • Set the value of an uniform to an array of number

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • array: number[] | Float32Array

      defines the array of number to store

    Returns boolean

    true if the value was set

setArray2Search playground for setArray2

  • Set the value of an uniform to an array of number (stored as vec2)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • array: number[] | Float32Array

      defines the array of number to store

    Returns boolean

    true if the value was set

setArray3Search playground for setArray3

  • Set the value of an uniform to an array of number (stored as vec3)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • array: number[] | Float32Array

      defines the array of number to store

    Returns boolean

    true if the value was set

setArray4Search playground for setArray4

  • Set the value of an uniform to an array of number (stored as vec4)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • array: number[] | Float32Array

      defines the array of number to store

    Returns boolean

    true if the value was set

setColorWriteSearch playground for setColorWrite

  • setColorWrite(enable: boolean): void
  • Enable or disable color writing

    Parameters

    • enable: boolean

      defines the state to set

    Returns void

setExternalTextureSearch playground for setExternalTexture

  • Sets an internal texture to the according uniform.

    Parameters

    Returns void

setFloatSearch playground for setFloat

  • Set the value of an uniform to a number (float)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • value: number

      defines the float number to store

    Returns boolean

    true if the value was transferred

setFloat2Search playground for setFloat2

  • Set the value of an uniform to a vec2

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • x: number

      defines the 1st component of the value

    • y: number

      defines the 2nd component of the value

    Returns boolean

    true if the value was set

setFloat3Search playground for setFloat3

  • Set the value of an uniform to a vec3

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • x: number

      defines the 1st component of the value

    • y: number

      defines the 2nd component of the value

    • z: number

      defines the 3rd component of the value

    Returns boolean

    true if the value was set

setFloat4Search playground for setFloat4

  • Set the value of an uniform to a vec4

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • x: number

      defines the 1st component of the value

    • y: number

      defines the 2nd component of the value

    • z: number

      defines the 3rd component of the value

    • w: number

      defines the 4th component of the value

    Returns boolean

    true if the value was set

setHardwareScalingLevelSearch playground for setHardwareScalingLevel

  • setHardwareScalingLevel(level: number): void
  • Defines the hardware scaling level. By default the hardware scaling level is computed from the window device ratio. if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.

    Parameters

    • level: number

      defines the level to use

    Returns void

setIntSearch playground for setInt

  • Set the value of an uniform to a number (int)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • value: number

      defines the int number to store

    Returns boolean

    true if the value was set

setInt2Search playground for setInt2

  • Set the value of an uniform to a int2

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • x: number

      defines the 1st component of the value

    • y: number

      defines the 2nd component of the value

    Returns boolean

    true if the value was set

setInt3Search playground for setInt3

  • Set the value of an uniform to a int3

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • x: number

      defines the 1st component of the value

    • y: number

      defines the 2nd component of the value

    • z: number

      defines the 3rd component of the value

    Returns boolean

    true if the value was set

setInt4Search playground for setInt4

  • Set the value of an uniform to a int4

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • x: number

      defines the 1st component of the value

    • y: number

      defines the 2nd component of the value

    • z: number

      defines the 3rd component of the value

    • w: number

      defines the 4th component of the value

    Returns boolean

    true if the value was set

setIntArraySearch playground for setIntArray

  • Set the value of an uniform to an array of int32

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • array: Int32Array

      defines the array of int32 to store

    Returns boolean

    true if the value was set

setIntArray2Search playground for setIntArray2

  • Set the value of an uniform to an array of int32 (stored as vec2)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • array: Int32Array

      defines the array of int32 to store

    Returns boolean

    true if the value was set

setIntArray3Search playground for setIntArray3

  • Set the value of an uniform to an array of int32 (stored as vec3)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • array: Int32Array

      defines the array of int32 to store

    Returns boolean

    true if the value was set

setIntArray4Search playground for setIntArray4

  • Set the value of an uniform to an array of int32 (stored as vec4)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • array: Int32Array

      defines the array of int32 to store

    Returns boolean

    true if the value was set

setMatricesSearch playground for setMatrices

  • Set the value of an uniform to an array of float32 (stored as matrices)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • matrices: Float32Array

      defines the array of float32 to store

    Returns boolean

    true if the value was set

setMatrix2x2Search playground for setMatrix2x2

  • Set the value of an uniform to a matrix (2x2)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • matrix: Float32Array

      defines the Float32Array representing the 2x2 matrix to store

    Returns boolean

    true if the value was set

setMatrix3x3Search playground for setMatrix3x3

  • Set the value of an uniform to a matrix (3x3)

    Parameters

    • uniform: Nullable<WebGLUniformLocation>

      defines the webGL uniform location where to store the value

    • matrix: Float32Array

      defines the Float32Array representing the 3x3 matrix to store

    Returns boolean

    true if the value was set

setSizeSearch playground for setSize

  • setSize(width: number, height: number, forceSetSize?: boolean): boolean
  • Force a specific size of the canvas

    Parameters

    • width: number

      defines the new canvas' width

    • height: number

      defines the new canvas' height

    • Optional forceSetSize: boolean

      true to force setting the sizes of the underlying canvas

    Returns boolean

    true if the size was changed

setStateSearch playground for setState

  • setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean, cullBackFaces?: boolean, stencil?: IStencilState, zOffsetUnits?: number): void
  • Set various states to the webGL context

    Parameters

    • culling: boolean

      defines culling state: true to enable culling, false to disable it

    • Optional zOffset: number

      defines the value to apply to zOffset (0 by default)

    • Optional force: boolean

      defines if states must be applied even if cache is up to date

    • Optional reverseSide: boolean

      defines if culling must be reversed (CCW if false, CW if true)

    • Optional cullBackFaces: boolean

      true to cull back faces, false to cull front faces (if culling is enabled)

    • Optional stencil: IStencilState

      stencil states to set

    • Optional zOffsetUnits: number

      defines the value to apply to zOffsetUnits (0 by default)

    Returns void

setStorageBufferSearch playground for setStorageBuffer

  • Sets a storage buffer in the shader

    Parameters

    • name: string

      Defines the name of the storage buffer as defined in the shader

    • buffer: Nullable<StorageBuffer>

      Defines the value to give to the uniform

    Returns void

setTextureSearch playground for setTexture

  • Sets a texture to the according uniform.

    Parameters

    Returns void

setTextureArraySearch playground for setTextureArray

  • Sets an array of texture to the webGL context

    Parameters

    • channel: number

      defines the channel where the texture array must be set

    • uniform: Nullable<WebGLUniformLocation>

      defines the associated uniform location

    • textures: ThinTexture[]

      defines the array of textures to bind

    • name: string

      name of the channel

    Returns void

setTextureSamplerSearch playground for setTextureSampler

  • Sets a texture sampler to the according uniform.

    Parameters

    Returns void

setViewportSearch playground for setViewport

  • setViewport(viewport: IViewportLike, requiredWidth?: number, requiredHeight?: number): void
  • Set the WebGL's viewport

    Parameters

    • viewport: IViewportLike

      defines the viewport element to be used

    • Optional requiredWidth: number

      defines the width required for rendering. If not provided the rendering canvas' width is used

    • Optional requiredHeight: number

      defines the height required for rendering. If not provided the rendering canvas' height is used

    Returns void

setZOffsetSearch playground for setZOffset

  • setZOffset(value: number): void
  • Set the z offset Factor to apply to current rendering

    Parameters

    • value: number

      defines the offset to apply

    Returns void

setZOffsetUnitsSearch playground for setZOffsetUnits

  • setZOffsetUnits(value: number): void
  • Set the z offset Units to apply to current rendering

    Parameters

    • value: number

      defines the offset to apply

    Returns void

snapshotRenderingResetSearch playground for snapshotRenderingReset

  • snapshotRenderingReset(): void
  • Creates a new snapshot at the next frame using the current snapshotRenderingMode

    Returns void

stopRenderLoopSearch playground for stopRenderLoop

  • stopRenderLoop(renderFunction?: () => void): void
  • stop executing a render loop function and remove it from the execution array

    Parameters

    • Optional renderFunction: () => void

      defines the function to be removed. If not provided all functions will be removed.

        • (): void
        • Returns void

    Returns void

unBindFramebufferSearch playground for unBindFramebuffer

  • unBindFramebuffer(texture: RenderTargetWrapper, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void
  • Unbind the current render target texture from the webGL context

    Parameters

    • texture: RenderTargetWrapper

      defines the render target wrapper to unbind

    • Optional disableGenerateMipMaps: boolean

      defines a boolean indicating that mipmaps must not be generated

    • Optional onBeforeUnbind: () => void

      defines a function which will be called before the effective unbind

        • (): void
        • Returns void

    Returns void

unBindMultiColorAttachmentFramebufferSearch playground for unBindMultiColorAttachmentFramebuffer

  • unBindMultiColorAttachmentFramebuffer(rtWrapper: RenderTargetWrapper, disableGenerateMipMaps: boolean, onBeforeUnbind?: () => void): void
  • Unbind a list of render target textures from the webGL context This is used only when drawBuffer extension or webGL2 are active

    Parameters

    • rtWrapper: RenderTargetWrapper

      defines the render target wrapper to unbind

    • disableGenerateMipMaps: boolean

      defines a boolean indicating that mipmaps must not be generated

    • Optional onBeforeUnbind: () => void

      defines a function which will be called before the effective unbind

        • (): void
        • Returns void

    Returns void

unbindAllAttributesSearch playground for unbindAllAttributes

  • unbindAllAttributes(): void
  • Unbind all vertex attributes from the webGL context

    Returns void

unbindAllTexturesSearch playground for unbindAllTextures

  • unbindAllTextures(): void
  • Unbind all textures from the webGL context

    Returns void

unbindInstanceAttributesSearch playground for unbindInstanceAttributes

  • unbindInstanceAttributes(): void
  • Unbind all instance attributes

    Returns void

updateAndBindInstancesBufferSearch playground for updateAndBindInstancesBuffer

  • Update the content of a webGL buffer used with instantiation and bind it to the webGL context

    Parameters

    • instancesBuffer: DataBuffer

      defines the webGL buffer to update and bind

    • data: Float32Array

      defines the data to store in the buffer

    • offsetLocations: number[] | InstancingAttributeInfo[]

      defines the offsets or attributes information used to determine where data must be stored in the buffer

    Returns void

updateArrayBufferSearch playground for updateArrayBuffer

  • updateArrayBuffer(data: Float32Array): void
  • update the bound buffer with the given data

    Parameters

    • data: Float32Array

      defines the data to update

    Returns void

updateDynamicIndexBufferSearch playground for updateDynamicIndexBuffer

  • Update a dynamic index buffer

    Parameters

    • indexBuffer: DataBuffer

      defines the target index buffer

    • indices: IndicesArray

      defines the data to update

    • Optional offset: number

      defines the offset in the target index buffer where update should start

    Returns void

updateDynamicTextureSearch playground for updateDynamicTexture

  • Update the content of a dynamic texture

    Parameters

    • texture: Nullable<InternalTexture>

      defines the texture to update

    • source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas | ICanvas

      defines the source containing the data

    • Optional invertY: boolean

      defines if data must be stored with Y axis inverted

    • Optional premulAlpha: boolean

      defines if alpha is stored as premultiplied

    • Optional format: number

      defines the format of the data

    • Optional forceBindTexture: boolean

      if the texture should be forced to be bound eg. after a graphics context loss (Default: false)

    • Optional allowGPUOptimization: boolean

      true to allow some specific GPU optimizations (subject to engine feature "allowGPUOptimizationsForGUI" being true)

    Returns void

updateDynamicVertexBufferSearch playground for updateDynamicVertexBuffer

  • updateDynamicVertexBuffer(vertexBuffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void
  • Updates a dynamic vertex buffer.

    Parameters

    • vertexBuffer: DataBuffer

      the vertex buffer to update

    • data: DataArray

      the data used to update the vertex buffer

    • Optional byteOffset: number

      the byte offset of the data

    • Optional byteLength: number

      the byte length of the data

    Returns void

updateMultipleRenderTargetTextureSampleCountSearch playground for updateMultipleRenderTargetTextureSampleCount

  • updateMultipleRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number, initializeBuffers?: boolean): number
  • Update the sample count for a given multiple render target texture

    see

    https://doc.babylonjs.com/features/webgl2#multisample-render-targets

    Parameters

    • rtWrapper: Nullable<RenderTargetWrapper>

      defines the render target wrapper to update

    • samples: number

      defines the sample count to set

    • Optional initializeBuffers: boolean

      if set to true, the engine will make an initializing call of drawBuffers

    Returns number

    the effective sample count (could be 0 if multisample render targets are not supported)

updateRawCubeTextureSearch playground for updateRawCubeTexture

  • updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean): void
  • updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>): void
  • updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>, level: number): void
  • Update a raw cube texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • 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

    Returns void

  • Update a raw cube texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • 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

    • compression: Nullable<string>

      defines the compression used (null by default)

    Returns void

  • Update a raw cube texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • 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

    • compression: Nullable<string>

      defines the compression used (null by default)

    • level: number

      defines which level of the texture to update

    Returns void

updateRawTextureSearch playground for updateRawTexture

  • Update a raw texture

    Parameters

    • texture: Nullable<InternalTexture>

      defines the texture to update

    • data: Nullable<ArrayBufferView>

      defines the data to store in the texture

    • format: number

      defines the format of the data

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    Returns void

  • Update a raw texture

    Parameters

    • texture: Nullable<InternalTexture>

      defines the texture to update

    • data: Nullable<ArrayBufferView>

      defines the data to store in the texture

    • format: number

      defines the format of the data

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    • compression: Nullable<string>

      defines the compression used (null by default)

    • type: number

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

    • useSRGBBuffer: boolean

      defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).

    Returns void

updateRawTexture2DArraySearch playground for updateRawTexture2DArray

  • updateRawTexture2DArray(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void
  • updateRawTexture2DArray(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void
  • Update a raw 2D array texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: Nullable<ArrayBufferView>

      defines the data to store

    • format: number

      defines the data format

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    Returns void

  • Update a raw 2D array texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: Nullable<ArrayBufferView>

      defines the data to store

    • format: number

      defines the data format

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    • compression: Nullable<string>

      defines the used compression (can be null)

    • textureType: number

      defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)

    Returns void

updateRawTexture3DSearch playground for updateRawTexture3D

  • updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void
  • updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void
  • Update a raw 3D texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: Nullable<ArrayBufferView>

      defines the data to store

    • format: number

      defines the data format

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    Returns void

  • Update a raw 3D texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: Nullable<ArrayBufferView>

      defines the data to store

    • format: number

      defines the data format

    • invertY: boolean

      defines if data must be stored with Y axis inverted

    • compression: Nullable<string>

      defines the used compression (can be null)

    • textureType: number

      defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)

    Returns void

updateRenderTargetTextureSampleCountSearch playground for updateRenderTargetTextureSampleCount

updateStorageBufferSearch playground for updateStorageBuffer

  • updateStorageBuffer(buffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void
  • Updates a storage buffer

    Parameters

    • buffer: DataBuffer

      the storage buffer to update

    • data: DataArray

      the data used to update the storage buffer

    • Optional byteOffset: number

      the byte offset of the data

    • Optional byteLength: number

      the byte length of the data

    Returns void

updateTextureDataSearch playground for updateTextureData

  • updateTextureData(texture: InternalTexture, imageData: ArrayBufferView, xOffset: number, yOffset: number, width: number, height: number, faceIndex?: number, lod?: number, generateMipMaps?: boolean): void
  • Update a portion of an internal texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • imageData: ArrayBufferView

      defines the data to store into the texture

    • xOffset: number

      defines the x coordinates of the update rectangle

    • yOffset: number

      defines the y coordinates of the update rectangle

    • width: number

      defines the width of the update rectangle

    • height: number

      defines the height of the update rectangle

    • Optional faceIndex: number

      defines the face index if texture is a cube (0 by default)

    • Optional lod: number

      defines the lod level to update (0 by default)

    • Optional generateMipMaps: boolean

      defines whether to generate mipmaps or not

    Returns void

updateTextureDimensionsSearch playground for updateTextureDimensions

  • updateTextureDimensions(texture: InternalTexture, width: number, height: number, depth?: number): void
  • Update the dimensions of a texture

    Parameters

    • texture: InternalTexture

      texture to update

    • width: number

      new width of the texture

    • height: number

      new height of the texture

    • Optional depth: number

      new depth of the texture

    Returns void

updateTextureSamplingModeSearch playground for updateTextureSamplingMode

  • updateTextureSamplingMode(samplingMode: number, texture: InternalTexture, generateMipMaps?: boolean): void
  • Update the sampling mode of a given texture

    Parameters

    • samplingMode: number

      defines the required sampling mode

    • texture: InternalTexture

      defines the texture to update

    • Optional generateMipMaps: boolean

      defines whether to generate mipmaps for the texture

    Returns void

updateTextureWrappingModeSearch playground for updateTextureWrappingMode

  • Update the sampling mode of a given texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • wrapU: Nullable<number>

      defines the texture wrap mode of the u coordinates

    • Optional wrapV: Nullable<number>

      defines the texture wrap mode of the v coordinates

    • Optional wrapR: Nullable<number>

      defines the texture wrap mode of the r coordinates

    Returns void

updateUniformBufferSearch playground for updateUniformBuffer

  • updateUniformBuffer(uniformBuffer: DataBuffer, elements: FloatArray, offset?: number, count?: number): void
  • Parameters

    • uniformBuffer: DataBuffer

      defines the target uniform buffer

    • elements: FloatArray

      defines the content to update

    • Optional offset: number

      defines the offset in the uniform buffer where update should start

    • Optional count: number

      defines the size of the data to update

    Returns void

updateVideoTextureSearch playground for updateVideoTexture

  • Update a video texture

    Parameters

    Returns void

wipeCachesSearch playground for wipeCaches

  • wipeCaches(bruteForce?: boolean): void
  • Force the entire cache to be cleared You should not have to use this function unless your engine needs to share the webGL context with another engine

    Parameters

    • Optional bruteForce: boolean

      defines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)

    Returns void

Static CeilingPOTSearch playground for CeilingPOT

  • CeilingPOT(x: number): number
  • Find the next highest power of two.

    Parameters

    • x: number

      Number to start search from.

    Returns number

    Next highest power of two.

Static FloorPOTSearch playground for FloorPOT

  • FloorPOT(x: number): number
  • Find the next lowest power of two.

    Parameters

    • x: number

      Number to start search from.

    Returns number

    Next lowest power of two.

Static GetExponentOfTwoSearch playground for GetExponentOfTwo

  • GetExponentOfTwo(value: number, max: number, mode?: number): number
  • Get the closest exponent of two

    Parameters

    • value: number

      defines the value to approximate

    • max: number

      defines the maximum value to return

    • Optional mode: number

      defines how to define the closest value

    Returns number

    closest exponent of two of the given value

Static NearestPOTSearch playground for NearestPOT

  • NearestPOT(x: number): number
  • Find the nearest power of two.

    Parameters

    • x: number

      Number to start search from.

    Returns number

    Next nearest power of two.

Static QueueNewFrameSearch playground for QueueNewFrame

  • QueueNewFrame(func: () => void, requester?: any): number
  • Queue a new function into the requested animation frame pool (ie. this function will be executed byt the browser for the next frame)

    Parameters

    • func: () => void

      the function to be called

        • (): void
        • Returns void

    • Optional requester: any

      the object that will request the next frame. Falls back to window.

    Returns number

    frame number

Static isSupportedSearch playground for isSupported

  • isSupported(): boolean
  • Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)

    ignorenaming

    Returns boolean

    true if the engine can be created

Legend

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