NullEngine

The null engine class provides support for headless version of babylon.js. This can be used in server side scenario or for testing purposes

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

Find examples in Playground

Properties

activeView

Find examples in Playground
activeView: Nullable<EngineView>

Gets the current engine view

see

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

customAnimationFrameRequester

Find examples in Playground
customAnimationFrameRequester: Nullable<ICustomAnimationFrameRequester>

If set, will be used to request the next animation frame for the render loop

disableManifestCheck

Find examples in Playground
disableManifestCheck: boolean

Gets or sets a boolean to enable/disable checking manifest if IndexedDB support is enabled (js will always consider the database is up to date)

disablePerformanceMonitorInBackground

Find examples in Playground
disablePerformanceMonitorInBackground: boolean

Turn this value on if you want to pause FPS computation when in background

enableOfflineSupport

Find examples in Playground
enableOfflineSupport: boolean

Gets or sets a boolean to enable/disable IndexedDB support and avoid XHR on .manifest

inputElement

Find examples in Playground
inputElement: Nullable<HTMLElement>

Gets or sets the HTML element to use for attaching events

isInVRExclusivePointerMode

Find examples in Playground
isInVRExclusivePointerMode: boolean

Gets a boolean indicating that the engine is currently in VR exclusive mode for the pointers

see

https://docs.microsoft.com/en-us/microsoft-edge/webvr/essentials#mouse-input

isPointerLock

Find examples in Playground
isPointerLock: boolean

Gets a boolean indicating if the pointer is currently locked

loadingScreen

Find examples in Playground
loadingScreen: ILoadingScreen

Sets the current loading screen object

see

http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen

loadingUIBackgroundColor

Find examples in Playground
loadingUIBackgroundColor: string

Sets the current loading screen background color

see

http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen

loadingUIText

Find examples in Playground
loadingUIText: string

Sets the current loading screen text

see

http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen

onAfterShaderCompilationObservable

Find examples in Playground
onAfterShaderCompilationObservable: Observable<Engine>

Observable raised when the engine has jsut compiled a shader

onBeforeShaderCompilationObservable

Find examples in Playground
onBeforeShaderCompilationObservable: Observable<Engine>

Observable raised when the engine is about to compile a shader

onBeginFrameObservable

Find examples in Playground
onBeginFrameObservable: Observable<Engine>

Observable raised when the engine begins a new frame

onCanvasBlurObservable

Find examples in Playground
onCanvasBlurObservable: Observable<Engine>

Observable event triggered each time the canvas loses focus

onCanvasFocusObservable

Find examples in Playground
onCanvasFocusObservable: Observable<Engine>

Observable event triggered each time the canvas gains focus

onCanvasPointerOutObservable

Find examples in Playground
onCanvasPointerOutObservable: Observable<PointerEvent>

Observable event triggered each time the canvas receives pointerout event

onEndFrameObservable

Find examples in Playground
onEndFrameObservable: Observable<Engine>

Observable raised when the engine ends the current frame

onNewSceneAddedObservable

Find examples in Playground
onNewSceneAddedObservable: Observable<Scene>

Event raised when a new scene is created

onResizeObservable

Find examples in Playground
onResizeObservable: Observable<Engine>

Observable event triggered each time the rendering canvas is resized

onVRDisplayChangedObservable

Find examples in Playground
onVRDisplayChangedObservable: Observable<IDisplayChangedEventArgs>

Observable signaled when VR display mode changes

onVRRequestPresentComplete

Find examples in Playground
onVRRequestPresentComplete: Observable<boolean>

Observable signaled when VR request present is complete

onVRRequestPresentStart

Find examples in Playground
onVRRequestPresentStart: Observable<Engine>

Observable signaled when VR request present starts

performanceMonitor

Find examples in Playground
performanceMonitor: PerformanceMonitor

Gets the performance monitor attached to this engine

see

http://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation

postProcesses

Find examples in Playground
postProcesses: PostProcess[]

Gets the list of created postprocesses

scenes

Find examples in Playground
scenes: Scene[]

Gets the list of created scenes

views

Find examples in Playground
views: EngineView[]

Gets or sets the list of views

Optional vrPresentationAttributes

Find examples in Playground
vrPresentationAttributes: IVRPresentationAttributes

Gets or sets the presentation attributes used to configure VR rendering

Static ALPHA_ADD

Find examples in Playground
ALPHA_ADD: number

Defines that alpha blending to SRC ALPHA * SRC + DEST

Static ALPHA_COMBINE

Find examples in Playground
ALPHA_COMBINE: number

Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST

Static ALPHA_DISABLE

Find examples in Playground
ALPHA_DISABLE: number

Defines that alpha blending is disabled

Static ALPHA_INTERPOLATE

Find examples in Playground
ALPHA_INTERPOLATE: number

Defines that alpha blending to CST * SRC + (1 - CST) * DEST

Static ALPHA_MAXIMIZED

Find examples in Playground
ALPHA_MAXIMIZED: number

Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST

Static ALPHA_MULTIPLY

Find examples in Playground
ALPHA_MULTIPLY: number

Defines that alpha blending to SRC * DEST

Static ALPHA_ONEONE

Find examples in Playground
ALPHA_ONEONE: number

Defines that alpha blending to SRC + DEST

Static ALPHA_PREMULTIPLIED

Find examples in Playground
ALPHA_PREMULTIPLIED: number

Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST

Static ALPHA_PREMULTIPLIED_PORTERDUFF

Find examples in Playground
ALPHA_PREMULTIPLIED_PORTERDUFF: number

Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA

Static ALPHA_SCREENMODE

Find examples in Playground
ALPHA_SCREENMODE: number

Defines that alpha blending to SRC + (1 - SRC) * DEST Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA

Static ALPHA_SUBTRACT

Find examples in Playground
ALPHA_SUBTRACT: number

Defines that alpha blending to DEST - SRC * DEST

Static ALWAYS

Find examples in Playground
ALWAYS: number

Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn

Static AudioEngineFactory

Find examples in Playground
AudioEngineFactory: function

Default AudioEngine factory responsible of creating the Audio Engine. By default, this will create a BabylonJS Audio Engine if the workload has been embedded.

Type declaration

Static DECR

Find examples in Playground
DECR: number

Passed to stencilOperation to specify that stencil value must be decremented

Static DECR_WRAP

Find examples in Playground
DECR_WRAP: number

Passed to stencilOperation to specify that stencil value must be decremented with wrapping

Static DELAYLOADSTATE_LOADED

Find examples in Playground
DELAYLOADSTATE_LOADED: number

Defines that the ressource was successfully delay loaded

Static DELAYLOADSTATE_LOADING

Find examples in Playground
DELAYLOADSTATE_LOADING: number

Defines that the ressource is currently delay loading

Static DELAYLOADSTATE_NONE

Find examples in Playground
DELAYLOADSTATE_NONE: number

Defines that the ressource is not delayed

Static DELAYLOADSTATE_NOTLOADED

Find examples in Playground
DELAYLOADSTATE_NOTLOADED: number

Defines that the ressource is delayed and has not started loading

Static EQUAL

Find examples in Playground
EQUAL: number

Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value

Static GEQUAL

Find examples in Playground
GEQUAL: number

Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value

Static GREATER

Find examples in Playground
GREATER: number

Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value

Static INCR

Find examples in Playground
INCR: number

Passed to stencilOperation to specify that stencil value must be incremented

Static INCR_WRAP

Find examples in Playground
INCR_WRAP: number

Passed to stencilOperation to specify that stencil value must be incremented with wrapping

Static INVERT

Find examples in Playground
INVERT: number

Passed to stencilOperation to specify that stencil value must be inverted

Static Instances

Find examples in Playground
Instances: Engine[]

Gets the list of created engines

Static KEEP

Find examples in Playground
KEEP: number

Passed to stencilOperation to specify that stencil value must be kept

Static LEQUAL

Find examples in Playground
LEQUAL: number

Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value

Static LESS

Find examples in Playground
LESS: number

Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value

Static LastCreatedEngine

Find examples in Playground
LastCreatedEngine: Nullable<Engine>

Gets the latest created engine

Static LastCreatedScene

Find examples in Playground
LastCreatedScene: Nullable<Scene>

Gets the latest created scene

Static NEVER

Find examples in Playground
NEVER: number

Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn

Static NOTEQUAL

Find examples in Playground
NOTEQUAL: number

Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value

Static NpmPackage

Find examples in Playground
NpmPackage: string

Returns the current npm package of the sdk

Static OfflineProviderFactory

Find examples in Playground
OfflineProviderFactory: function

Default offline support factory responsible of creating a tool used to store data locally. By default, this will create a Database object if the workload has been embedded.

Type declaration

    • (urlToScene: string, callbackManifestChecked: function, disableManifestCheck: boolean): IOfflineProvider
    • Parameters

      • urlToScene: string
      • callbackManifestChecked: function
          • (checked: boolean): any
          • Parameters

            • checked: boolean

            Returns any

      • disableManifestCheck: boolean

      Returns IOfflineProvider

Static REPLACE

Find examples in Playground
REPLACE: number

Passed to stencilOperation to specify that stencil value must be replaced

Static SCALEMODE_CEILING

Find examples in Playground
SCALEMODE_CEILING: number

Defines that texture rescaling will use a ceil to find the closer power of 2 size

Static SCALEMODE_FLOOR

Find examples in Playground
SCALEMODE_FLOOR: number

Defines that texture rescaling will use a floor to find the closer power of 2 size

Static SCALEMODE_NEAREST

Find examples in Playground
SCALEMODE_NEAREST: number

Defines that texture rescaling will look for the nearest power of 2 size

Static TEXTUREFORMAT_ALPHA

Find examples in Playground
TEXTUREFORMAT_ALPHA: number

ALPHA

Static TEXTUREFORMAT_LUMINANCE

Find examples in Playground
TEXTUREFORMAT_LUMINANCE: number

LUMINANCE

Static TEXTUREFORMAT_LUMINANCE_ALPHA

Find examples in Playground
TEXTUREFORMAT_LUMINANCE_ALPHA: number

LUMINANCE_ALPHA

Static TEXTUREFORMAT_R

Find examples in Playground
TEXTUREFORMAT_R: number

RED (2nd reference)

Static TEXTUREFORMAT_RED

Find examples in Playground
TEXTUREFORMAT_RED: number

RED

Static TEXTUREFORMAT_RED_INTEGER

Find examples in Playground
TEXTUREFORMAT_RED_INTEGER: number

RED_INTEGER

Static TEXTUREFORMAT_RG

Find examples in Playground
TEXTUREFORMAT_RG: number

RG

Static TEXTUREFORMAT_RGB

Find examples in Playground
TEXTUREFORMAT_RGB: number

RGB

Static TEXTUREFORMAT_RGBA

Find examples in Playground
TEXTUREFORMAT_RGBA: number

RGBA

Static TEXTUREFORMAT_RGBA_INTEGER

Find examples in Playground
TEXTUREFORMAT_RGBA_INTEGER: number

RGBA_INTEGER

Static TEXTUREFORMAT_RGB_INTEGER

Find examples in Playground
TEXTUREFORMAT_RGB_INTEGER: number

RGB_INTEGER

Static TEXTUREFORMAT_RG_INTEGER

Find examples in Playground
TEXTUREFORMAT_RG_INTEGER: number

RG_INTEGER

Static TEXTUREFORMAT_R_INTEGER

Find examples in Playground
TEXTUREFORMAT_R_INTEGER: number

RED_INTEGER (2nd reference)

Static TEXTURETYPE_BYTE

Find examples in Playground
TEXTURETYPE_BYTE: number

BYTE

Static TEXTURETYPE_FLOAT

Find examples in Playground
TEXTURETYPE_FLOAT: number

FLOAT

Static TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV

Find examples in Playground
TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV: number

FLOAT_32_UNSIGNED_INT_24_8_REV

Static TEXTURETYPE_HALF_FLOAT

Find examples in Playground
TEXTURETYPE_HALF_FLOAT: number

HALF_FLOAT

Static TEXTURETYPE_INT

Find examples in Playground
TEXTURETYPE_INT: number

INT

Static TEXTURETYPE_SHORT

Find examples in Playground
TEXTURETYPE_SHORT: number

SHORT

Static TEXTURETYPE_UNSIGNED_BYTE

Find examples in Playground
TEXTURETYPE_UNSIGNED_BYTE: number

UNSIGNED_BYTE

Static TEXTURETYPE_UNSIGNED_INT

Find examples in Playground
TEXTURETYPE_UNSIGNED_INT: number

UNSIGNED_BYTE (2nd reference)

Static TEXTURETYPE_UNSIGNED_INTEGER

Find examples in Playground
TEXTURETYPE_UNSIGNED_INTEGER: number

UNSIGNED_INT

Static TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV

Find examples in Playground
TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV: number

UNSIGNED_INT_10F_11F_11F_REV

Static TEXTURETYPE_UNSIGNED_INT_24_8

Find examples in Playground
TEXTURETYPE_UNSIGNED_INT_24_8: number

UNSIGNED_INT_24_8

Static TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV

Find examples in Playground
TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV: number

UNSIGNED_INT_2_10_10_10_REV

Static TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV

Find examples in Playground
TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV: number

UNSIGNED_INT_5_9_9_9_REV

Static TEXTURETYPE_UNSIGNED_SHORT

Find examples in Playground
TEXTURETYPE_UNSIGNED_SHORT: number

UNSIGNED_SHORT

Static TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4

Find examples in Playground
TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4: number

UNSIGNED_SHORT_4_4_4_4

Static TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1

Find examples in Playground
TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1: number

UNSIGNED_SHORT_5_5_5_1

Static TEXTURETYPE_UNSIGNED_SHORT_5_6_5

Find examples in Playground
TEXTURETYPE_UNSIGNED_SHORT_5_6_5: number

UNSIGNED_SHORT_5_6_5

Static TEXTURE_BILINEAR_SAMPLINGMODE

Find examples in Playground
TEXTURE_BILINEAR_SAMPLINGMODE: number

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

Static TEXTURE_CLAMP_ADDRESSMODE

Find examples in Playground
TEXTURE_CLAMP_ADDRESSMODE: number

Texture is not repeating outside of 0..1 UVs

Static TEXTURE_CUBIC_MODE

Find examples in Playground
TEXTURE_CUBIC_MODE: number

Cubic coordinates mode

Static TEXTURE_EQUIRECTANGULAR_MODE

Find examples in Playground
TEXTURE_EQUIRECTANGULAR_MODE: number

Equirectangular coordinates mode

Static TEXTURE_EXPLICIT_MODE

Find examples in Playground
TEXTURE_EXPLICIT_MODE: number

Explicit coordinates mode

Static TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE

Find examples in Playground
TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number

Equirectangular Fixed Mirrored coordinates mode

Static TEXTURE_FIXED_EQUIRECTANGULAR_MODE

Find examples in Playground
TEXTURE_FIXED_EQUIRECTANGULAR_MODE: number

Equirectangular Fixed coordinates mode

Static TEXTURE_INVCUBIC_MODE

Find examples in Playground
TEXTURE_INVCUBIC_MODE: number

Inverse Cubic coordinates mode

Static TEXTURE_LINEAR_LINEAR

Find examples in Playground
TEXTURE_LINEAR_LINEAR: number

mag = linear and min = linear and mip = none

Static TEXTURE_LINEAR_LINEAR_MIPLINEAR

Find examples in Playground
TEXTURE_LINEAR_LINEAR_MIPLINEAR: number

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

Static TEXTURE_LINEAR_LINEAR_MIPNEAREST

Find examples in Playground
TEXTURE_LINEAR_LINEAR_MIPNEAREST: number

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

Static TEXTURE_LINEAR_NEAREST

Find examples in Playground
TEXTURE_LINEAR_NEAREST: number

mag = linear and min = nearest and mip = none

Static TEXTURE_LINEAR_NEAREST_MIPLINEAR

Find examples in Playground
TEXTURE_LINEAR_NEAREST_MIPLINEAR: number

mag = linear and min = nearest and mip = linear

Static TEXTURE_LINEAR_NEAREST_MIPNEAREST

Find examples in Playground
TEXTURE_LINEAR_NEAREST_MIPNEAREST: number

mag = linear and min = nearest and mip = nearest

Static TEXTURE_MIRROR_ADDRESSMODE

Find examples in Playground
TEXTURE_MIRROR_ADDRESSMODE: number

Texture is repeating and mirrored

Static TEXTURE_NEAREST_LINEAR

Find examples in Playground
TEXTURE_NEAREST_LINEAR: number

mag = nearest and min = linear and mip = none

Static TEXTURE_NEAREST_LINEAR_MIPLINEAR

Find examples in Playground
TEXTURE_NEAREST_LINEAR_MIPLINEAR: number

mag = nearest and min = linear and mip = linear

Static TEXTURE_NEAREST_LINEAR_MIPNEAREST

Find examples in Playground
TEXTURE_NEAREST_LINEAR_MIPNEAREST: number

mag = nearest and min = linear and mip = nearest

Static TEXTURE_NEAREST_NEAREST

Find examples in Playground
TEXTURE_NEAREST_NEAREST: number

mag = nearest and min = nearest and mip = none

Static TEXTURE_NEAREST_NEAREST_MIPLINEAR

Find examples in Playground
TEXTURE_NEAREST_NEAREST_MIPLINEAR: number

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

Static TEXTURE_NEAREST_NEAREST_MIPNEAREST

Find examples in Playground
TEXTURE_NEAREST_NEAREST_MIPNEAREST: number

mag = nearest and min = nearest and mip = nearest

Static TEXTURE_NEAREST_SAMPLINGMODE

Find examples in Playground
TEXTURE_NEAREST_SAMPLINGMODE: number

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

Static TEXTURE_PLANAR_MODE

Find examples in Playground
TEXTURE_PLANAR_MODE: number

Planar coordinates mode

Static TEXTURE_PROJECTION_MODE

Find examples in Playground
TEXTURE_PROJECTION_MODE: number

Projection coordinates mode

Static TEXTURE_SKYBOX_MODE

Find examples in Playground
TEXTURE_SKYBOX_MODE: number

Skybox coordinates mode

Static TEXTURE_SPHERICAL_MODE

Find examples in Playground
TEXTURE_SPHERICAL_MODE: number

Spherical coordinates mode

Static TEXTURE_TRILINEAR_SAMPLINGMODE

Find examples in Playground
TEXTURE_TRILINEAR_SAMPLINGMODE: number

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

Static TEXTURE_WRAP_ADDRESSMODE

Find examples in Playground
TEXTURE_WRAP_ADDRESSMODE: number

Texture is repeating outside of 0..1 UVs

Static Version

Find examples in Playground
Version: string

Returns the current version of the framework

Static _RescalePostProcessFactory

Find examples in Playground
_RescalePostProcessFactory: Nullable<function>

Method called to create the default rescale post process on each engine.

Static audioEngine

Find examples in Playground
audioEngine: IAudioEngine

Gets the audio engine

see

http://doc.babylonjs.com/how_to/playing_sounds_and_music

ignorenaming

Methods

_deletePipelineContext

Find examples in Playground

_renderLoop

Find examples in Playground
  • _renderLoop(): void

areAllEffectsReady

Find examples in Playground
  • areAllEffectsReady(): boolean
  • Gets a boolean indicating if all created effects are ready

    Returns boolean

    true if all effects are ready

beginFrame

Find examples in Playground
  • beginFrame(): void

beginOcclusionQuery

Find examples in Playground

beginTransformFeedback

Find examples in Playground
  • beginTransformFeedback(usePoints: boolean): void
  • Begins a transform feedback operation

    Parameters

    • usePoints: boolean

      defines if points or triangles must be used

    Returns void

bindBuffers

Find examples in Playground
  • bindBuffers(vertexBuffers: object, indexBuffer: DataBuffer, effect: Effect): void
  • Bind webGl buffers directly to the webGL context

    Parameters

    • vertexBuffers: object

      defines the vertex buffer to bind

    • indexBuffer: DataBuffer

      defines the index buffer to bind

    • effect: Effect

      defines the effect associated with the vertex buffer

    Returns void

bindFramebuffer

Find examples in Playground
  • bindFramebuffer(texture: InternalTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number, forceFullscreenViewport?: boolean): void
  • Binds the frame buffer to the specified texture.

    Parameters

    • texture: InternalTexture

      The texture to render to or null for the default canvas

    • 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

    Returns void

bindMultiviewFramebuffer

Find examples in Playground

bindSamplers

Find examples in Playground
  • bindSamplers(effect: Effect): void
  • Binds an effect to the webGL context

    Parameters

    • effect: Effect

      defines the effect to bind

    Returns void

bindTransformFeedback

Find examples in Playground

bindTransformFeedbackBuffer

Find examples in Playground

bindUniformBlock

Find examples in Playground
  • 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

bindUniformBuffer

Find examples in Playground

bindUniformBufferBase

Find examples in Playground
  • bindUniformBufferBase(buffer: DataBuffer, location: number): 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

    Returns void

cacheStencilState

Find examples in Playground
  • cacheStencilState(): void

clear

Find examples in Playground
  • clear(color: 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: 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

createDynamicUniformBuffer

Find examples in Playground

createDynamicVertexBuffer

Find examples in Playground
  • Creates a dynamic vertex buffer

    Parameters

    • vertices: FloatArray

      the data for the dynamic vertex buffer

    Returns DataBuffer

    the new WebGL dynamic buffer

createEffectForParticles

Find examples in Playground
  • createEffectForParticles(fragmentName: string, uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: function, onError?: function): Effect
  • Create an effect to use with particle systems. Please note that some parameters like animation sheets or not being billboard are not supported in this configuration

    Parameters

    • fragmentName: string

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

    • uniformsNames: string[]

      defines a list of attribute names

    • samplers: string[]

      defines an array of string used to represent textures

    • defines: string

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

    • Optional fallbacks: EffectFallbacks

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

    • Optional onCompiled: function

      defines a function to call when the effect creation is successful

        • Parameters

          Returns void

    • Optional onError: function

      defines a function to call when the effect creation has failed

        • (effect: Effect, errors: string): void
        • Parameters

          • effect: Effect
          • errors: string

          Returns void

    Returns Effect

    the new Effect

createIndexBuffer

Find examples in Playground
  • Creates a new index buffer

    Parameters

    • indices: IndicesArray

      defines the content of the index buffer

    Returns DataBuffer

    a new webGL buffer

createInstancesBuffer

Find examples in Playground
  • createInstancesBuffer(capacity: number): DataBuffer
  • Creates a webGL buffer to use with instanciation

    Parameters

    • capacity: number

      defines the size of the buffer

    Returns DataBuffer

    the webGL buffer

createMultiviewRenderTargetTexture

Find examples in Playground
  • createMultiviewRenderTargetTexture(width: number, height: number): InternalTexture

createQuery

Find examples in Playground
  • Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)

    Returns WebGLQuery

    the new query

createRawCubeTexture

Find examples in Playground
  • 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

createRawCubeTextureFromUrl

Find examples in Playground
  • createRawCubeTextureFromUrl(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: function, mipmapGenerator: Nullable<function>, onLoad: Nullable<function>, onError: Nullable<function>): InternalTexture
  • createRawCubeTextureFromUrl(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: function, mipmapGenerator: Nullable<function>, onLoad: Nullable<function>, onError: Nullable<function>, 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: 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: function

      defines a callback used to extract texture data from loaded data

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

          • ArrayBuffer: ArrayBuffer

          Returns Nullable<ArrayBufferView[]>

    • mipmapGenerator: Nullable<function>

      defines to provide an optional tool to generate mip levels

    • onLoad: Nullable<function>

      defines a callback called when texture is loaded

    • onError: Nullable<function>

      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: 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: function

      defines a callback used to extract texture data from loaded data

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

          • ArrayBuffer: ArrayBuffer

          Returns Nullable<ArrayBufferView[]>

    • mipmapGenerator: Nullable<function>

      defines to provide an optional tool to generate mip levels

    • onLoad: Nullable<function>

      defines a callback called when texture is loaded

    • onError: Nullable<function>

      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

createRawTexture

Find examples in Playground
  • createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string>, type: number): 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)

    Returns InternalTexture

    the raw texture inside an InternalTexture

createRawTexture2DArray

Find examples in Playground
  • createRawTexture2DArray(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string>, textureType: 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)

    Returns InternalTexture

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

createRawTexture3D

Find examples in Playground
  • createRawTexture3D(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string>, textureType: 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)

    Returns InternalTexture

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

createRenderTargetTexture

Find examples in Playground
  • Creates a new render target texture

    Parameters

    • size: any

      defines the size of the texture

    • options: boolean | RenderTargetCreationOptions

      defines the options used to create the texture

    Returns InternalTexture

    a new render target texture stored in an InternalTexture

createShaderProgram

Find examples in Playground
  • createShaderProgram(pipelineContext: IPipelineContext, vertexCode: string, fragmentCode: string, defines: string, context?: WebGLRenderingContext): WebGLProgram

createTexture

Find examples in Playground
  • Usually called from Texture.ts. Passed information to create a WebGLTexture

    Parameters

    • urlArg: 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: Scene

      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<function>

      optional callback to be called upon successful completion

    • Optional onError: Nullable<function>

      optional callback to be called upon failure

    • Optional buffer: Nullable<ArrayBuffer | HTMLImageElement>

      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: InternalTexture

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

    • Optional format: number

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

    Returns InternalTexture

    a InternalTexture for assignment back into BABYLON.Texture

createTransformFeedback

Find examples in Playground

createUniformBuffer

Find examples in Playground

createVertexBuffer

Find examples in Playground
  • Creates a vertex buffer

    Parameters

    • vertices: FloatArray

      the data for the vertex buffer

    Returns DataBuffer

    the new WebGL static buffer

deleteInstancesBuffer

Find examples in Playground
  • deleteInstancesBuffer(buffer: WebGLBuffer): void
  • Delete a webGL buffer used with instanciation

    Parameters

    • buffer: WebGLBuffer

      defines the webGL buffer to delete

    Returns void

deleteQuery

Find examples in Playground

deleteTransformFeedback

Find examples in Playground

disableScissor

Find examples in Playground
  • disableScissor(): void

disableVR

Find examples in Playground
  • disableVR(): void

displayLoadingUI

Find examples in Playground
  • displayLoadingUI(): void

dispose

Find examples in Playground
  • dispose(): void

draw

Find examples in Playground
  • 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 instanciation is enabled)

    Returns void

drawArraysType

Find examples in Playground
  • 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 instanciation is enabled)

    Returns void

drawElementsType

Find examples in Playground
  • 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 instanciation is enabled)

    Returns void

enableEffect

Find examples in Playground
  • enableEffect(effect: Effect): void
  • Activates an effect, mkaing it the current one (ie. the one used for rendering)

    Parameters

    • effect: Effect

      defines the effect to activate

    Returns void

enableScissor

Find examples in Playground
  • enableScissor(x: number, y: number, width: number, height: number): void
  • Enable scissor test on a specific rectangle (ie. render will only be executed on a specific portion of the screen)

    Parameters

    • x: number

      defines the x-coordinate of the top left corner of the clear rectangle

    • y: number

      defines the y-coordinate of the corner of the clear rectangle

    • width: number

      defines the width of the clear rectangle

    • height: number

      defines the height of the clear rectangle

    Returns void

enableVR

Find examples in Playground

endFrame

Find examples in Playground
  • endFrame(): void

endOcclusionQuery

Find examples in Playground
  • endOcclusionQuery(algorithmType: number): Engine

endTimeQuery

Find examples in Playground
  • endTimeQuery(token: _TimeToken): int
  • Ends a time query

    Parameters

    • token: _TimeToken

      defines the token used to measure the time span

    Returns int

    the time spent (in ns)

endTransformFeedback

Find examples in Playground
  • endTransformFeedback(): void

enterFullscreen

Find examples in Playground
  • enterFullscreen(requestPointerLock: boolean): void
  • Enters full screen mode

    Parameters

    • requestPointerLock: boolean

      defines if a pointer lock should be requested from the user

    Returns void

enterPointerlock

Find examples in Playground
  • enterPointerlock(): void

exitFullscreen

Find examples in Playground
  • exitFullscreen(): void

exitPointerlock

Find examples in Playground
  • exitPointerlock(): void

generateMipMapsForCubemap

Find examples in Playground
  • generateMipMapsForCubemap(texture: InternalTexture, unbind?: boolean): void
  • Force the mipmap generation for the given render target texture

    Parameters

    • texture: InternalTexture

      defines the render target texture to use

    • Optional unbind: boolean

      defines whether or not to unbind the texture after generation. Defaults to true.

    Returns void

getAspectRatio

Find examples in Playground
  • Gets current aspect ratio

    Parameters

    • viewportOwner: IViewportOwnerLike

      defines the camera to use to get the aspect ratio

    • Optional useScreen: boolean

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

    Returns number

    a number defining the aspect ratio

getAttributes

Find examples in Playground
  • getAttributes(pipelineContext: IPipelineContext, attributesNames: string[]): number[]
  • Gets the lsit 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

getDeltaTime

Find examples in Playground
  • getDeltaTime(): number
  • Gets the time spent between current and previous frame

    Returns number

    a number representing the delta time in ms

getDepthFunction

Find examples in Playground

getDepthWrite

Find examples in Playground
  • getDepthWrite(): boolean
  • Gets a boolean indicating if depth writing is enabled

    Returns boolean

    the current depth writing state

getFps

Find examples in Playground
  • getFps(): number
  • Gets the current framerate

    Returns number

    a number representing the framerate

getFragmentShaderSource

Find examples in Playground
  • getFragmentShaderSource(program: WebGLProgram): Nullable<string>
  • Gets the source code of the fragment shader associated with a specific webGL program

    Parameters

    • program: WebGLProgram

      defines the program to use

    Returns Nullable<string>

    a string containing the source code of the fragment shader associated with the program

getHardwareScalingLevel

Find examples in Playground
  • 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

getInputElement

Find examples in Playground
  • getInputElement(): Nullable<HTMLElement>

getInputElementClientRect

Find examples in Playground
  • getInputElementClientRect(): Nullable<ClientRect>

getLockstepMaxSteps

Find examples in Playground
  • getLockstepMaxSteps(): number

getQueryResult

Find examples in Playground
  • Gets the value of a given query

    Parameters

    Returns number

    the value of the query

getRenderHeight

Find examples in Playground
  • 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

getRenderWidth

Find examples in Playground
  • 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

getRenderingCanvasClientRect

Find examples in Playground
  • getRenderingCanvasClientRect(): Nullable<ClientRect>

getScreenAspectRatio

Find examples in Playground
  • getScreenAspectRatio(): number

getStencilBuffer

Find examples in Playground
  • getStencilBuffer(): boolean
  • Gets a boolean indicating if stencil buffer is enabled

    Returns boolean

    the current stencil buffer state

getStencilFunction

Find examples in Playground
  • getStencilFunction(): number
  • Gets the current stencil function

    Returns number

    a number defining the stencil function to use

getStencilFunctionMask

Find examples in Playground
  • getStencilFunctionMask(): number

getStencilFunctionReference

Find examples in Playground
  • getStencilFunctionReference(): number

getStencilMask

Find examples in Playground
  • getStencilMask(): number
  • Gets the current stencil mask

    Returns number

    a number defining the new stencil mask to use

getStencilOperationDepthFail

Find examples in Playground
  • getStencilOperationDepthFail(): number
  • Gets the current stencil operation when depth fails

    Returns number

    a number defining stencil operation to use when depth fails

getStencilOperationFail

Find examples in Playground
  • getStencilOperationFail(): number
  • Gets the current stencil operation when stencil fails

    Returns number

    a number defining stencil operation to use when stencil fails

getStencilOperationPass

Find examples in Playground
  • getStencilOperationPass(): number
  • Gets the current stencil operation when stencil passes

    Returns number

    a number defining stencil operation to use when stencil passes

getTimeStep

Find examples in Playground
  • getTimeStep(): number
  • Returns the time in ms between steps when using deterministic lock step.

    Returns number

    time step in (ms)

getUniforms

Find examples in Playground
  • 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

getVRDevice

Find examples in Playground
  • getVRDevice(): any
  • Gets the current webVR device

    Returns any

    the current webVR device (or null)

getVertexShaderSource

Find examples in Playground
  • getVertexShaderSource(program: WebGLProgram): Nullable<string>
  • Gets the source code of the vertex shader associated with a specific webGL program

    Parameters

    • program: WebGLProgram

      defines the program to use

    Returns Nullable<string>

    a string containing the source code of the vertex shader associated with the program

getZOffset

Find examples in Playground
  • getZOffset(): number
  • Gets the current value of the zOffset

    Returns number

    the current zOffset state

hideLoadingUI

Find examples in Playground
  • hideLoadingUI(): void

initWebVR

Find examples in Playground
  • Initializes a webVR display and starts listening to display change events The onVRDisplayChangedObservable will be notified upon these changes

    Returns Observable<IDisplayChangedEventArgs>

    The onVRDisplayChangedObservable

initWebVRAsync

Find examples in Playground
  • Initializes a webVR display and starts listening to display change events The onVRDisplayChangedObservable will be notified upon these changes

    Returns Promise<IDisplayChangedEventArgs>

    A promise containing a VRDisplay and if vr is supported

isDeterministicLockStep

Find examples in Playground
  • isDeterministicLockStep(): boolean

isQueryResultAvailable

Find examples in Playground
  • isQueryResultAvailable(query: WebGLQuery): boolean
  • Check if a given query has resolved and got its value

    Parameters

    Returns boolean

    true if the query got its value

isVRDevicePresent

Find examples in Playground
  • isVRDevicePresent(): boolean
  • Gets a boolean indicating if a webVR device was detected

    Returns boolean

    true if a webVR device was detected

isVRPresenting

Find examples in Playground
  • isVRPresenting(): boolean
  • Gets a boolean indicating that the system is in VR mode and is presenting

    Returns boolean

    true if VR mode is engaged

readPixels

Find examples in Playground
  • readPixels(x: number, y: number, width: number, height: number): Uint8Array
  • 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

    Returns Uint8Array

    a Uint8Array containing RGBA colors

registerView

Find examples in Playground
  • Register a new child canvas

    Parameters

    • canvas: HTMLCanvasElement

      defines the canvas to register

    • Optional camera: Camera

      defines an optional camera to use with this canvas (it will overwrite the scene.camera for this view)

    Returns EngineView

    the associated view

releaseEffects

Find examples in Playground
  • 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

resize

Find examples in Playground
  • resize(): void

restoreStencilState

Find examples in Playground
  • restoreStencilState(): void

scissorClear

Find examples in Playground
  • scissorClear(x: number, y: number, width: number, height: number, clearColor: IColor4Like): void
  • Executes a scissor clear (ie. a clear on a specific portion of the screen)

    Parameters

    • x: number

      defines the x-coordinate of the top left corner of the clear rectangle

    • y: number

      defines the y-coordinate of the corner of the clear rectangle

    • width: number

      defines the width of the clear rectangle

    • height: number

      defines the height of the clear rectangle

    • clearColor: IColor4Like

      defines the clear color

    Returns void

setAlphaMode

Find examples in Playground
  • setAlphaMode(mode: number, noDepthWriteChange?: boolean): void

setArray

Find examples in Playground
  • setArray(uniform: WebGLUniformLocation, array: number[]): void
  • Set the value of an uniform to an array of number

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: number[]

      defines the array of number to store

    Returns void

setArray2

Find examples in Playground
  • setArray2(uniform: WebGLUniformLocation, array: number[]): void
  • Set the value of an uniform to an array of number (stored as vec2)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: number[]

      defines the array of number to store

    Returns void

setArray3

Find examples in Playground
  • setArray3(uniform: WebGLUniformLocation, array: number[]): void
  • Set the value of an uniform to an array of number (stored as vec3)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: number[]

      defines the array of number to store

    Returns void

setArray4

Find examples in Playground
  • setArray4(uniform: WebGLUniformLocation, array: number[]): void
  • Set the value of an uniform to an array of number (stored as vec4)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: number[]

      defines the array of number to store

    Returns void

setBool

Find examples in Playground
  • setBool(uniform: WebGLUniformLocation, bool: number): void
  • Set the value of an uniform to a boolean

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • bool: number

      defines the boolean to store

    Returns void

setCompressedTextureExclusions

Find examples in Playground
  • setCompressedTextureExclusions(skippedFiles: Array<string>): void
  • Set the compressed texture extensions or file names to skip.

    Parameters

    • skippedFiles: Array<string>

      defines the list of those texture files you want to skip Example: [".dds", ".env", "myfile.png"]

    Returns void

setDepthBuffer

Find examples in Playground
  • setDepthBuffer(enable: boolean): void
  • Enable or disable depth buffering

    Parameters

    • enable: boolean

      defines the state to set

    Returns void

setDepthFunction

Find examples in Playground
  • setDepthFunction(depthFunc: number): void
  • Sets the current depth function

    Parameters

    • depthFunc: number

      defines the function to use

    Returns void

setDepthFunctionToGreater

Find examples in Playground
  • setDepthFunctionToGreater(): void

setDepthFunctionToGreaterOrEqual

Find examples in Playground
  • setDepthFunctionToGreaterOrEqual(): void

setDepthFunctionToLess

Find examples in Playground
  • setDepthFunctionToLess(): void

setDepthFunctionToLessOrEqual

Find examples in Playground
  • setDepthFunctionToLessOrEqual(): void

setDepthStencilTexture

Find examples in Playground
  • Sets a depth stencil texture from a render target to the according uniform.

    Parameters

    • channel: number

      The texture channel

    • uniform: Nullable<WebGLUniformLocation>

      The uniform to set

    • texture: Nullable<RenderTargetTexture>

      The render target texture containing the depth stencil texture to apply

    Returns void

setDepthWrite

Find examples in Playground
  • setDepthWrite(enable: boolean): void
  • Enable or disable depth writing

    Parameters

    • enable: boolean

      defines the state to set

    Returns void

setDirectViewport

Find examples in Playground
  • setDirectViewport(x: number, y: number, width: number, height: number): Nullable<IViewportLike>
  • Directly set the WebGL Viewport

    Parameters

    • x: number

      defines the x coordinate of the viewport (in screen space)

    • y: number

      defines the y coordinate of the viewport (in screen space)

    • width: number

      defines the width of the viewport (in screen space)

    • height: number

      defines the height of the viewport (in screen space)

    Returns Nullable<IViewportLike>

    the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state

setDitheringState

Find examples in Playground
  • setDitheringState(value: boolean): void
  • Sets a boolean indicating if the dithering state is enabled or disabled

    Parameters

    • value: boolean

      defines the dithering state

    Returns void

setFloat

Find examples in Playground
  • setFloat(uniform: WebGLUniformLocation, value: number): void
  • Set the value of an uniform to a number (float)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • value: number

      defines the float number to store

    Returns void

setFloat2

Find examples in Playground
  • setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void
  • Set the value of an uniform to a vec2

    Parameters

    • uniform: 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 void

setFloat3

Find examples in Playground
  • setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void
  • Set the value of an uniform to a vec3

    Parameters

    • uniform: 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 void

setFloat4

Find examples in Playground
  • setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void
  • Set the value of an uniform to a vec4

    Parameters

    • uniform: 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 void

setFloatArray

Find examples in Playground
  • setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): void
  • Set the value of an uniform to an array of float32

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: Float32Array

      defines the array of float32 to store

    Returns void

setFloatArray2

Find examples in Playground
  • setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): void
  • Set the value of an uniform to an array of float32 (stored as vec2)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: Float32Array

      defines the array of float32 to store

    Returns void

setFloatArray3

Find examples in Playground
  • setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): void
  • Set the value of an uniform to an array of float32 (stored as vec3)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: Float32Array

      defines the array of float32 to store

    Returns void

setFloatArray4

Find examples in Playground
  • setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): void
  • Set the value of an uniform to an array of float32 (stored as vec4)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: Float32Array

      defines the array of float32 to store

    Returns void

setFrameBufferDepthStencilTexture

Find examples in Playground

setIntArray

Find examples in Playground
  • setIntArray(uniform: WebGLUniformLocation, array: Int32Array): void
  • Set the value of an uniform to an array of int32

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: Int32Array

      defines the array of int32 to store

    Returns void

setIntArray2

Find examples in Playground
  • setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): void
  • Set the value of an uniform to an array of int32 (stored as vec2)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: Int32Array

      defines the array of int32 to store

    Returns void

setIntArray3

Find examples in Playground
  • setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): void
  • Set the value of an uniform to an array of int32 (stored as vec3)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: Int32Array

      defines the array of int32 to store

    Returns void

setIntArray4

Find examples in Playground
  • setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): void
  • Set the value of an uniform to an array of int32 (stored as vec4)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • array: Int32Array

      defines the array of int32 to store

    Returns void

setMatrices

Find examples in Playground
  • setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void
  • Set the value of an uniform to an array of float32 (stored as matrices)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • matrices: Float32Array

      defines the array of float32 to store

    Returns void

setMatrix2x2

Find examples in Playground
  • setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void
  • Set the value of an uniform to a matrix (2x2)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • matrix: Float32Array

      defines the Float32Array representing the 2x2 matrix to store

    Returns void

setMatrix3x3

Find examples in Playground
  • setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void
  • Set the value of an uniform to a matrix (3x3)

    Parameters

    • uniform: WebGLUniformLocation

      defines the webGL uniform location where to store the value

    • matrix: Float32Array

      defines the Float32Array representing the 3x3 matrix to store

    Returns void

setRasterizerState

Find examples in Playground
  • setRasterizerState(value: boolean): void
  • Sets a boolean indicating if the rasterizer state is enabled or disabled

    Parameters

    • value: boolean

      defines the rasterizer state

    Returns void

setSize

Find examples in Playground
  • setSize(width: number, height: number): void
  • Force a specific size of the canvas

    Parameters

    • width: number

      defines the new canvas' width

    • height: number

      defines the new canvas' height

    Returns void

setState

Find examples in Playground
  • setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void
  • Set various states to the webGL context

    Parameters

    • culling: boolean

      defines backface culling state

    • 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 instead of CW and CW instead of CCW)

    Returns void

setStencilBuffer

Find examples in Playground
  • setStencilBuffer(enable: boolean): void
  • Enable or disable the stencil buffer

    Parameters

    • enable: boolean

      defines if the stencil buffer must be enabled or disabled

    Returns void

setStencilFunction

Find examples in Playground
  • setStencilFunction(stencilFunc: number): void
  • Sets the current stencil function

    Parameters

    • stencilFunc: number

      defines the new stencil function to use

    Returns void

setStencilFunctionMask

Find examples in Playground
  • setStencilFunctionMask(mask: number): void
  • Sets the current stencil mask

    Parameters

    • mask: number

      defines the new stencil mask to use

    Returns void

setStencilFunctionReference

Find examples in Playground
  • setStencilFunctionReference(reference: number): void
  • Sets the current stencil reference

    Parameters

    • reference: number

      defines the new stencil reference to use

    Returns void

setStencilMask

Find examples in Playground
  • setStencilMask(mask: number): void
  • Sets the current stencil mask

    Parameters

    • mask: number

      defines the new stencil mask to use

    Returns void

setStencilOperationDepthFail

Find examples in Playground
  • setStencilOperationDepthFail(operation: number): void
  • Sets the stencil operation to use when depth fails

    Parameters

    • operation: number

      defines the stencil operation to use when depth fails

    Returns void

setStencilOperationFail

Find examples in Playground
  • setStencilOperationFail(operation: number): void
  • Sets the stencil operation to use when stencil fails

    Parameters

    • operation: number

      defines the stencil operation to use when stencil fails

    Returns void

setStencilOperationPass

Find examples in Playground
  • setStencilOperationPass(operation: number): void
  • Sets the stencil operation to use when stencil passes

    Parameters

    • operation: number

      defines the stencil operation to use when stencil passes

    Returns void

setTextureFormatToUse

Find examples in Playground
  • setTextureFormatToUse(formatsAvailable: Array<string>): Nullable<string>
  • Set the compressed texture format to use, based on the formats you have, and the formats supported by the hardware / browser.

    Khronos Texture Container (.ktx) files are used to support this. This format has the advantage of being specifically designed for OpenGL. Header elements directly correspond to API arguments needed to compressed textures. This puts the burden on the container generator to house the arcane code for determining these for current & future formats.

    for description see https://www.khronos.org/opengles/sdk/tools/KTX/ for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/

    Note: The result of this call is not taken into account when a texture is base64.

    Parameters

    • formatsAvailable: Array<string>

      defines the list of those format families you have created on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)

      Current families are astc, dxt, pvrtc, etc2, & etc1.

    Returns Nullable<string>

    The extension selected.

setTextureFromPostProcess

Find examples in Playground

setTextureFromPostProcessOutput

Find examples in Playground
  • Binds the output of the passed in post process to the texture channel specified

    Parameters

    • channel: number

      The channel the texture should be bound to

    • postProcess: Nullable<PostProcess>

      The post process which's output should be bound

    Returns void

setTranformFeedbackVaryings

Find examples in Playground
  • setTranformFeedbackVaryings(program: WebGLProgram, value: string[]): void
  • Specify the varyings to use with transform feedback

    Parameters

    • program: WebGLProgram

      defines the associated webGL program

    • value: string[]

      defines the list of strings representing the varying names

    Returns void

setViewport

Find examples in Playground
  • 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

setZOffset

Find examples in Playground
  • setZOffset(value: number): void
  • Set the z offset to apply to current rendering

    Parameters

    • value: number

      defines the offset to apply

    Returns void

startTimeQuery

Find examples in Playground
  • startTimeQuery(): Nullable<_TimeToken>
  • Starts a time query (used to measure time spent by the GPU on a specific frame) Please note that only one query can be issued at a time

    Returns Nullable<_TimeToken>

    a time token used to track the time span

switchFullscreen

Find examples in Playground
  • switchFullscreen(requestPointerLock: boolean): void
  • Toggle full screen mode

    Parameters

    • requestPointerLock: boolean

      defines if a pointer lock should be requested from the user

    Returns void

unBindFramebuffer

Find examples in Playground
  • unBindFramebuffer(texture: InternalTexture, disableGenerateMipMaps?: boolean, onBeforeUnbind?: function): void
  • Unbind the current render target texture from the webGL context

    Parameters

    • texture: InternalTexture

      defines the render target texture to unbind

    • Optional disableGenerateMipMaps: boolean

      defines a boolean indicating that mipmaps must not be generated

    • Optional onBeforeUnbind: function

      defines a function which will be called before the effective unbind

        • (): void
        • Returns void

    Returns void

unRegisterView

Find examples in Playground
  • unRegisterView(canvas: HTMLCanvasElement): Engine
  • Remove a registered child canvas

    Parameters

    • canvas: HTMLCanvasElement

      defines the canvas to remove

    Returns Engine

    the current engine

updateDynamicIndexBuffer

Find examples in Playground
  • updateDynamicIndexBuffer(indexBuffer: WebGLBuffer, indices: IndicesArray, offset?: number): void
  • Update a dynamic index buffer

    Parameters

    • indexBuffer: WebGLBuffer

      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

updateDynamicTexture

Find examples in Playground
  • updateDynamicTexture(texture: Nullable<InternalTexture>, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean, format?: number): void
  • Update the content of a dynamic texture

    Parameters

    • texture: Nullable<InternalTexture>

      defines the texture to update

    • canvas: HTMLCanvasElement

      defines the canvas containing the source

    • 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

    Returns void

updateDynamicVertexBuffer

Find examples in Playground
  • updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: FloatArray, byteOffset?: number, byteLength?: number): void
  • Updates a dynamic vertex buffer.

    Parameters

    • vertexBuffer: WebGLBuffer

      the vertex buffer to update

    • vertices: FloatArray

      the data used to update the vertex buffer

    • Optional byteOffset: number

      the byte offset of the data (optional)

    • Optional byteLength: number

      the byte length of the data (optional)

    Returns void

updateRawCubeTexture

Find examples in Playground
  • 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 udpdate

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

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

    • 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

updateRawTexture

Find examples in Playground
  • 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)

    Returns void

updateRawTexture2DArray

Find examples in Playground
  • 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

updateRawTexture3D

Find examples in Playground
  • 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

updateRenderTargetTextureSampleCount

Find examples in Playground

updateTextureComparisonFunction

Find examples in Playground
  • updateTextureComparisonFunction(texture: InternalTexture, comparisonFunction: number): void
  • Updates a depth texture Comparison Mode and Function. If the comparison Function is equal to 0, the mode will be set to none. Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.

    Parameters

    • texture: InternalTexture

      The texture to set the comparison function for

    • comparisonFunction: number

      The comparison function to set, 0 if no comparison required

    Returns void

updateTextureSamplingMode

Find examples in Playground
  • updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void
  • Update the sampling mode of a given texture

    Parameters

    • samplingMode: number

      defines the required sampling mode

    • texture: InternalTexture

      defines the texture to update

    Returns void

updateUniformBuffer

Find examples in Playground
  • updateUniformBuffer(uniformBuffer: DataBuffer, elements: FloatArray, offset?: number, count?: number): void

wipeCaches

Find examples in Playground
  • 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 DefaultLoadingScreenFactory

Find examples in Playground
  • DefaultLoadingScreenFactory(canvas: HTMLCanvasElement): ILoadingScreen
  • Method called to create the default loading screen. This can be overriden in your own app.

    Parameters

    • canvas: HTMLCanvasElement

      The rendering canvas element

    Returns ILoadingScreen

    The loading screen

Static MarkAllMaterialsAsDirty

Find examples in Playground
  • MarkAllMaterialsAsDirty(flag: number, predicate?: function): void
  • Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation

    Parameters

    • flag: number

      defines which part of the materials must be marked as dirty

    • Optional predicate: function

      defines a predicate used to filter which materials should be affected

    Returns void

Static _ExitFullscreen

Find examples in Playground
  • _ExitFullscreen(): void

Static _ExitPointerlock

Find examples in Playground
  • _ExitPointerlock(): void

Static _RequestFullscreen

Find examples in Playground
  • _RequestFullscreen(element: HTMLElement): void
  • Ask the browser to promote the current element to fullscreen rendering mode

    Parameters

    • element: HTMLElement

      defines the DOM element to promote

    Returns void

Static _RequestPointerlock

Find examples in Playground
  • _RequestPointerlock(element: HTMLElement): void
  • Ask the browser to promote the current element to pointerlock mode

    Parameters

    • element: HTMLElement

      defines the DOM element to promote

    Returns void

Generated using TypeDoc