Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Engine

The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio

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 Engine

Properties

activeViewSearch playground for activeView

activeView: Nullable<EngineView>

Gets the current engine view

see

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

canvasTabIndexSearch playground for canvasTabIndex

canvasTabIndex: number

Gets or sets the tab index to set to the rendering canvas. 1 is the minimum value to set to be able to capture keyboard events

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

customAnimationFrameRequesterSearch playground for customAnimationFrameRequester

customAnimationFrameRequester: Nullable<ICustomAnimationFrameRequester>

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

deviceInputSystemSearch playground for deviceInputSystem

deviceInputSystem: IDeviceInputSystem

Stores instance of DeviceInputSystem

disableManifestCheckSearch playground for disableManifestCheck

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)

disablePerformanceMonitorInBackgroundSearch playground for disablePerformanceMonitorInBackground

disablePerformanceMonitorInBackground: boolean

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

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

enableOfflineSupportSearch playground for enableOfflineSupport

enableOfflineSupport: boolean

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

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

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

inputElementSearch playground for inputElement

inputElement: Nullable<HTMLElement>

Gets or sets the HTML element to use for attaching events

isFullscreenSearch playground for isFullscreen

isFullscreen: boolean

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

isInVRExclusivePointerModeSearch playground for isInVRExclusivePointerMode

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

Readonly isNDCHalfZRangeSearch playground for isNDCHalfZRange

isNDCHalfZRange: boolean

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

isPointerLockSearch playground for isPointerLock

isPointerLock: boolean

Gets a boolean indicating if the pointer is currently locked

onAfterShaderCompilationObservableSearch playground for onAfterShaderCompilationObservable

onAfterShaderCompilationObservable: Observable<Engine>

Observable raised when the engine has just compiled a shader

onBeforeShaderCompilationObservableSearch playground for onBeforeShaderCompilationObservable

onBeforeShaderCompilationObservable: Observable<Engine>

Observable raised when the engine is about to compile a shader

onBeforeTextureInitObservableSearch playground for onBeforeTextureInitObservable

onBeforeTextureInitObservable: Observable<Texture>

Observable event triggered before each texture is initialized

onBeginFrameObservableSearch playground for onBeginFrameObservable

onBeginFrameObservable: Observable<Engine>

Observable raised when the engine begins a new frame

onCanvasBlurObservableSearch playground for onCanvasBlurObservable

onCanvasBlurObservable: Observable<Engine>

Observable event triggered each time the canvas loses focus

onCanvasFocusObservableSearch playground for onCanvasFocusObservable

onCanvasFocusObservable: Observable<Engine>

Observable event triggered each time the canvas gains focus

onCanvasPointerOutObservableSearch playground for onCanvasPointerOutObservable

onCanvasPointerOutObservable: Observable<IPointerEvent>

Observable event triggered each time the canvas receives pointerout event

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.

onEndFrameObservableSearch playground for onEndFrameObservable

onEndFrameObservable: Observable<Engine>

Observable raised when the engine ends the current frame

onNewSceneAddedObservableSearch playground for onNewSceneAddedObservable

onNewSceneAddedObservable: Observable<Scene>

Event raised when a new scene is created

onResizeObservableSearch playground for onResizeObservable

onResizeObservable: Observable<Engine>

Observable event triggered each time the rendering canvas is resized

onVRDisplayChangedObservableSearch playground for onVRDisplayChangedObservable

onVRDisplayChangedObservable: Observable<IDisplayChangedEventArgs>

Observable signaled when VR display mode changes

onVRRequestPresentCompleteSearch playground for onVRRequestPresentComplete

onVRRequestPresentComplete: Observable<boolean>

Observable signaled when VR request present is complete

onVRRequestPresentStartSearch playground for onVRRequestPresentStart

onVRRequestPresentStart: Observable<Engine>

Observable signaled when VR request present starts

postProcessesSearch playground for postProcesses

postProcesses: PostProcess[]

Gets the list of created postprocesses

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 foregroun

scenesSearch playground for scenes

scenes: Scene[]

Gets the list of created scenes

Readonly textureFormatInUseSearch playground for textureFormatInUse

textureFormatInUse: Nullable<string>

Gets the texture format in use

Readonly texturesSupportedSearch playground for texturesSupported

texturesSupported: Array<string>

Gets the list of texture formats supported

validateShaderProgramsSearch playground for validateShaderPrograms

validateShaderPrograms: boolean

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

viewsSearch playground for views

views: EngineView[]

Gets or sets the list of views

Optional vrPresentationAttributesSearch playground for vrPresentationAttributes

vrPresentationAttributes: IVRPresentationAttributes

Gets or sets the presentation attributes used to configure VR rendering

Static Readonly ALPHA_ADDSearch playground for ALPHA_ADD

ALPHA_ADD: number

Defines that alpha blending to SRC ALPHA * SRC + DEST

Static Readonly ALPHA_COMBINESearch playground for ALPHA_COMBINE

ALPHA_COMBINE: number

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

Static Readonly ALPHA_DISABLESearch playground for ALPHA_DISABLE

ALPHA_DISABLE: number

Defines that alpha blending is disabled

Static Readonly ALPHA_INTERPOLATESearch playground for ALPHA_INTERPOLATE

ALPHA_INTERPOLATE: number

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

Static Readonly ALPHA_MAXIMIZEDSearch playground for ALPHA_MAXIMIZED

ALPHA_MAXIMIZED: number

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

Static Readonly ALPHA_MULTIPLYSearch playground for ALPHA_MULTIPLY

ALPHA_MULTIPLY: number

Defines that alpha blending to SRC * DEST

Static Readonly ALPHA_ONEONESearch playground for ALPHA_ONEONE

ALPHA_ONEONE: number

Defines that alpha blending to SRC + DEST

Static Readonly ALPHA_PREMULTIPLIEDSearch playground for ALPHA_PREMULTIPLIED

ALPHA_PREMULTIPLIED: number

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

Static Readonly ALPHA_PREMULTIPLIED_PORTERDUFFSearch playground for ALPHA_PREMULTIPLIED_PORTERDUFF

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 Readonly ALPHA_SCREENMODESearch playground for ALPHA_SCREENMODE

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 Readonly ALPHA_SUBTRACTSearch playground for ALPHA_SUBTRACT

ALPHA_SUBTRACT: number

Defines that alpha blending to DEST - SRC * DEST

Static Readonly ALWAYSSearch playground for ALWAYS

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 AudioEngineFactorySearch playground for AudioEngineFactory

AudioEngineFactory: (hostElement: Nullable<HTMLElement>, audioContext: Nullable<AudioContext>, audioDestination: Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode>) => IAudioEngine

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

    • Parameters

      • hostElement: Nullable<HTMLElement>
      • audioContext: Nullable<AudioContext>
      • audioDestination: Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode>

      Returns IAudioEngine

Static CollisionsEpsilonSearch playground for CollisionsEpsilon

CollisionsEpsilon: number

Gets or sets the epsilon value used by collision engine

Static Readonly DECRSearch playground for DECR

DECR: number

Passed to stencilOperation to specify that stencil value must be decremented

Static Readonly DECR_WRAPSearch playground for DECR_WRAP

DECR_WRAP: number

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

Static Readonly DELAYLOADSTATE_LOADEDSearch playground for DELAYLOADSTATE_LOADED

DELAYLOADSTATE_LOADED: number

Defines that the resource was successfully delay loaded

Static Readonly DELAYLOADSTATE_LOADINGSearch playground for DELAYLOADSTATE_LOADING

DELAYLOADSTATE_LOADING: number

Defines that the resource is currently delay loading

Static Readonly DELAYLOADSTATE_NONESearch playground for DELAYLOADSTATE_NONE

DELAYLOADSTATE_NONE: number

Defines that the resource is not delayed

Static Readonly DELAYLOADSTATE_NOTLOADEDSearch playground for DELAYLOADSTATE_NOTLOADED

DELAYLOADSTATE_NOTLOADED: number

Defines that the resource is delayed and has not started loading

Static Readonly EQUALSearch playground for EQUAL

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

Static Readonly GEQUALSearch playground for GEQUAL

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 Readonly GREATERSearch playground for GREATER

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 Readonly INCRSearch playground for INCR

INCR: number

Passed to stencilOperation to specify that stencil value must be incremented

Static Readonly INCR_WRAPSearch playground for INCR_WRAP

INCR_WRAP: number

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

Static Readonly INVERTSearch playground for INVERT

INVERT: number

Passed to stencilOperation to specify that stencil value must be inverted

Static Readonly KEEPSearch playground for KEEP

KEEP: number

Passed to stencilOperation to specify that stencil value must be kept

Static Readonly LEQUALSearch playground for LEQUAL

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 Readonly LESSSearch playground for LESS

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 Readonly NEVERSearch playground for NEVER

NEVER: number

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

Static Readonly NOTEQUALSearch playground for NOTEQUAL

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 OfflineProviderFactorySearch playground for OfflineProviderFactory

OfflineProviderFactory: (urlToScene: string, callbackManifestChecked: (checked: boolean) => any, disableManifestCheck: boolean) => IOfflineProvider

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: (checked: boolean) => any, disableManifestCheck: boolean): IOfflineProvider
    • Parameters

      • urlToScene: string
      • callbackManifestChecked: (checked: boolean) => any
          • (checked: boolean): any
          • Parameters

            • checked: boolean

            Returns any

      • disableManifestCheck: boolean

      Returns IOfflineProvider

Static Readonly REPLACESearch playground for REPLACE

REPLACE: number

Passed to stencilOperation to specify that stencil value must be replaced

Static Readonly SCALEMODE_CEILINGSearch playground for SCALEMODE_CEILING

SCALEMODE_CEILING: number

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

Static Readonly SCALEMODE_FLOORSearch playground for SCALEMODE_FLOOR

SCALEMODE_FLOOR: number

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

Static Readonly SCALEMODE_NEARESTSearch playground for SCALEMODE_NEAREST

SCALEMODE_NEAREST: number

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

Static Readonly TEXTUREFORMAT_ALPHASearch playground for TEXTUREFORMAT_ALPHA

TEXTUREFORMAT_ALPHA: number

ALPHA

Static Readonly TEXTUREFORMAT_LUMINANCESearch playground for TEXTUREFORMAT_LUMINANCE

TEXTUREFORMAT_LUMINANCE: number

LUMINANCE

Static Readonly TEXTUREFORMAT_LUMINANCE_ALPHASearch playground for TEXTUREFORMAT_LUMINANCE_ALPHA

TEXTUREFORMAT_LUMINANCE_ALPHA: number

LUMINANCE_ALPHA

Static Readonly TEXTUREFORMAT_RSearch playground for TEXTUREFORMAT_R

TEXTUREFORMAT_R: number

RED (2nd reference)

Static Readonly TEXTUREFORMAT_REDSearch playground for TEXTUREFORMAT_RED

TEXTUREFORMAT_RED: number

RED

Static Readonly TEXTUREFORMAT_RED_INTEGERSearch playground for TEXTUREFORMAT_RED_INTEGER

TEXTUREFORMAT_RED_INTEGER: number

RED_INTEGER

Static Readonly TEXTUREFORMAT_RGSearch playground for TEXTUREFORMAT_RG

TEXTUREFORMAT_RG: number

RG

Static Readonly TEXTUREFORMAT_RGBSearch playground for TEXTUREFORMAT_RGB

TEXTUREFORMAT_RGB: number

RGB

Static Readonly TEXTUREFORMAT_RGBASearch playground for TEXTUREFORMAT_RGBA

TEXTUREFORMAT_RGBA: number

RGBA

Static Readonly TEXTUREFORMAT_RGBA_INTEGERSearch playground for TEXTUREFORMAT_RGBA_INTEGER

TEXTUREFORMAT_RGBA_INTEGER: number

RGBA_INTEGER

Static Readonly TEXTUREFORMAT_RGB_INTEGERSearch playground for TEXTUREFORMAT_RGB_INTEGER

TEXTUREFORMAT_RGB_INTEGER: number

RGB_INTEGER

Static Readonly TEXTUREFORMAT_RG_INTEGERSearch playground for TEXTUREFORMAT_RG_INTEGER

TEXTUREFORMAT_RG_INTEGER: number

RG_INTEGER

Static Readonly TEXTUREFORMAT_R_INTEGERSearch playground for TEXTUREFORMAT_R_INTEGER

TEXTUREFORMAT_R_INTEGER: number

RED_INTEGER (2nd reference)

Static Readonly TEXTURETYPE_BYTESearch playground for TEXTURETYPE_BYTE

TEXTURETYPE_BYTE: number

BYTE

Static Readonly TEXTURETYPE_FLOATSearch playground for TEXTURETYPE_FLOAT

TEXTURETYPE_FLOAT: number

FLOAT

Static Readonly TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REVSearch playground for TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV

TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV: number

FLOAT_32_UNSIGNED_INT_24_8_REV

Static Readonly TEXTURETYPE_HALF_FLOATSearch playground for TEXTURETYPE_HALF_FLOAT

TEXTURETYPE_HALF_FLOAT: number

HALF_FLOAT

Static Readonly TEXTURETYPE_INTSearch playground for TEXTURETYPE_INT

TEXTURETYPE_INT: number

INT

Static Readonly TEXTURETYPE_SHORTSearch playground for TEXTURETYPE_SHORT

TEXTURETYPE_SHORT: number

SHORT

Static Readonly TEXTURETYPE_UNSIGNED_BYTESearch playground for TEXTURETYPE_UNSIGNED_BYTE

TEXTURETYPE_UNSIGNED_BYTE: number

UNSIGNED_BYTE

Static Readonly TEXTURETYPE_UNSIGNED_INTSearch playground for TEXTURETYPE_UNSIGNED_INT

TEXTURETYPE_UNSIGNED_INT: number

UNSIGNED_BYTE (2nd reference)

Static Readonly TEXTURETYPE_UNSIGNED_INTEGERSearch playground for TEXTURETYPE_UNSIGNED_INTEGER

TEXTURETYPE_UNSIGNED_INTEGER: number

UNSIGNED_INT

Static Readonly TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REVSearch playground for TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV

TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV: number

UNSIGNED_INT_10F_11F_11F_REV

Static Readonly TEXTURETYPE_UNSIGNED_INT_24_8Search playground for TEXTURETYPE_UNSIGNED_INT_24_8

TEXTURETYPE_UNSIGNED_INT_24_8: number

UNSIGNED_INT_24_8

Static Readonly TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REVSearch playground for TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV

TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV: number

UNSIGNED_INT_2_10_10_10_REV

Static Readonly TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REVSearch playground for TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV

TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV: number

UNSIGNED_INT_5_9_9_9_REV

Static Readonly TEXTURETYPE_UNSIGNED_SHORTSearch playground for TEXTURETYPE_UNSIGNED_SHORT

TEXTURETYPE_UNSIGNED_SHORT: number

UNSIGNED_SHORT

Static Readonly TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4Search playground for TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4

TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4: number

UNSIGNED_SHORT_4_4_4_4

Static Readonly TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1Search playground for TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1

TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1: number

UNSIGNED_SHORT_5_5_5_1

Static Readonly TEXTURETYPE_UNSIGNED_SHORT_5_6_5Search playground for TEXTURETYPE_UNSIGNED_SHORT_5_6_5

TEXTURETYPE_UNSIGNED_SHORT_5_6_5: number

UNSIGNED_SHORT_5_6_5

Static Readonly TEXTURE_BILINEAR_SAMPLINGMODESearch playground for TEXTURE_BILINEAR_SAMPLINGMODE

TEXTURE_BILINEAR_SAMPLINGMODE: number

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

Static Readonly TEXTURE_CLAMP_ADDRESSMODESearch playground for TEXTURE_CLAMP_ADDRESSMODE

TEXTURE_CLAMP_ADDRESSMODE: number

Texture is not repeating outside of 0..1 UVs

Static Readonly TEXTURE_CUBIC_MODESearch playground for TEXTURE_CUBIC_MODE

TEXTURE_CUBIC_MODE: number

Cubic coordinates mode

Static Readonly TEXTURE_EQUIRECTANGULAR_MODESearch playground for TEXTURE_EQUIRECTANGULAR_MODE

TEXTURE_EQUIRECTANGULAR_MODE: number

Equirectangular coordinates mode

Static Readonly TEXTURE_EXPLICIT_MODESearch playground for TEXTURE_EXPLICIT_MODE

TEXTURE_EXPLICIT_MODE: number

Explicit coordinates mode

Static Readonly TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODESearch playground for TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE

TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number

Equirectangular Fixed Mirrored coordinates mode

Static Readonly TEXTURE_FIXED_EQUIRECTANGULAR_MODESearch playground for TEXTURE_FIXED_EQUIRECTANGULAR_MODE

TEXTURE_FIXED_EQUIRECTANGULAR_MODE: number

Equirectangular Fixed coordinates mode

Static Readonly TEXTURE_INVCUBIC_MODESearch playground for TEXTURE_INVCUBIC_MODE

TEXTURE_INVCUBIC_MODE: number

Inverse Cubic coordinates mode

Static Readonly TEXTURE_LINEAR_LINEARSearch playground for TEXTURE_LINEAR_LINEAR

TEXTURE_LINEAR_LINEAR: number

mag = linear and min = linear and mip = none

Static Readonly TEXTURE_LINEAR_LINEAR_MIPLINEARSearch playground for TEXTURE_LINEAR_LINEAR_MIPLINEAR

TEXTURE_LINEAR_LINEAR_MIPLINEAR: number

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

Static Readonly TEXTURE_LINEAR_LINEAR_MIPNEARESTSearch playground for TEXTURE_LINEAR_LINEAR_MIPNEAREST

TEXTURE_LINEAR_LINEAR_MIPNEAREST: number

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

Static Readonly TEXTURE_LINEAR_NEARESTSearch playground for TEXTURE_LINEAR_NEAREST

TEXTURE_LINEAR_NEAREST: number

mag = linear and min = nearest and mip = none

Static Readonly TEXTURE_LINEAR_NEAREST_MIPLINEARSearch playground for TEXTURE_LINEAR_NEAREST_MIPLINEAR

TEXTURE_LINEAR_NEAREST_MIPLINEAR: number

mag = linear and min = nearest and mip = linear

Static Readonly TEXTURE_LINEAR_NEAREST_MIPNEARESTSearch playground for TEXTURE_LINEAR_NEAREST_MIPNEAREST

TEXTURE_LINEAR_NEAREST_MIPNEAREST: number

mag = linear and min = nearest and mip = nearest

Static Readonly TEXTURE_MIRROR_ADDRESSMODESearch playground for TEXTURE_MIRROR_ADDRESSMODE

TEXTURE_MIRROR_ADDRESSMODE: number

Texture is repeating and mirrored

Static Readonly TEXTURE_NEAREST_LINEARSearch playground for TEXTURE_NEAREST_LINEAR

TEXTURE_NEAREST_LINEAR: number

mag = nearest and min = linear and mip = none

Static Readonly TEXTURE_NEAREST_LINEAR_MIPLINEARSearch playground for TEXTURE_NEAREST_LINEAR_MIPLINEAR

TEXTURE_NEAREST_LINEAR_MIPLINEAR: number

mag = nearest and min = linear and mip = linear

Static Readonly TEXTURE_NEAREST_LINEAR_MIPNEARESTSearch playground for TEXTURE_NEAREST_LINEAR_MIPNEAREST

TEXTURE_NEAREST_LINEAR_MIPNEAREST: number

mag = nearest and min = linear and mip = nearest

Static Readonly TEXTURE_NEAREST_NEARESTSearch playground for TEXTURE_NEAREST_NEAREST

TEXTURE_NEAREST_NEAREST: number

mag = nearest and min = nearest and mip = none

Static Readonly TEXTURE_NEAREST_NEAREST_MIPLINEARSearch playground for TEXTURE_NEAREST_NEAREST_MIPLINEAR

TEXTURE_NEAREST_NEAREST_MIPLINEAR: number

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

Static Readonly TEXTURE_NEAREST_NEAREST_MIPNEARESTSearch playground for TEXTURE_NEAREST_NEAREST_MIPNEAREST

TEXTURE_NEAREST_NEAREST_MIPNEAREST: number

mag = nearest and min = nearest and mip = nearest

Static Readonly TEXTURE_NEAREST_SAMPLINGMODESearch playground for TEXTURE_NEAREST_SAMPLINGMODE

TEXTURE_NEAREST_SAMPLINGMODE: number

nearest is mag = nearest and min = nearest and mip = none

Static Readonly TEXTURE_PLANAR_MODESearch playground for TEXTURE_PLANAR_MODE

TEXTURE_PLANAR_MODE: number

Planar coordinates mode

Static Readonly TEXTURE_PROJECTION_MODESearch playground for TEXTURE_PROJECTION_MODE

TEXTURE_PROJECTION_MODE: number

Projection coordinates mode

Static Readonly TEXTURE_SKYBOX_MODESearch playground for TEXTURE_SKYBOX_MODE

TEXTURE_SKYBOX_MODE: number

Skybox coordinates mode

Static Readonly TEXTURE_SPHERICAL_MODESearch playground for TEXTURE_SPHERICAL_MODE

TEXTURE_SPHERICAL_MODE: number

Spherical coordinates mode

Static Readonly TEXTURE_TRILINEAR_SAMPLINGMODESearch playground for TEXTURE_TRILINEAR_SAMPLINGMODE

TEXTURE_TRILINEAR_SAMPLINGMODE: number

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

Static Readonly TEXTURE_WRAP_ADDRESSMODESearch playground for TEXTURE_WRAP_ADDRESSMODE

TEXTURE_WRAP_ADDRESSMODE: number

Texture is repeating outside of 0..1 UVs

Static _RescalePostProcessFactorySearch playground for _RescalePostProcessFactory

_RescalePostProcessFactory: Nullable<(engine: Engine) => PostProcess>

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

Static audioEngineSearch playground for audioEngine

audioEngine: Nullable<IAudioEngine>

Gets the audio engine

see

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

ignorenaming

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>

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

emptyTexture

emptyTexture2DArray

emptyTexture3D

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

loadingScreen

loadingUIBackgroundColor

  • set loadingUIBackgroundColor(color: string): any

loadingUIText

  • set loadingUIText(text: string): any

name

  • get name(): string
  • Returns the name of the engine

    Returns string

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

performanceMonitor

shaderPlatformName

  • get shaderPlatformName(): string
  • Gets the shader platfrom 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 Instances

  • Gets the list of created engines

    Returns Engine[]

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 LastCreatedEngine

  • Gets the latest created engine

    Returns Nullable<Engine>

Static LastCreatedScene

  • Gets the latest created scene

    Returns Nullable<Scene>

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

_deletePipelineContextSearch playground for _deletePipelineContext

  • Parameters

    Returns void

_renderLoopSearch playground for _renderLoop

  • _renderLoop(): void
  • Returns void

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

beginOcclusionQuerySearch playground for beginOcclusionQuery

  • beginOcclusionQuery(algorithmType: number, query: OcclusionQuery): boolean
  • Initiates an occlusion query

    see

    https://doc.babylonjs.com/features/occlusionquery

    Parameters

    • algorithmType: number

      defines the algorithm to use

    • query: OcclusionQuery

      defines the query to use

    Returns boolean

    the current engine

beginTransformFeedbackSearch playground for beginTransformFeedback

  • beginTransformFeedback(usePoints: boolean): void
  • Begins a transform feedback operation

    Parameters

    • usePoints: boolean

      defines if points or triangles must be used

    Returns void

bindArrayBufferSearch playground for bindArrayBuffer

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

bindMultiviewFramebufferSearch playground for bindMultiviewFramebuffer

  • Binds a multiview render target wrapper to be drawn to

    Parameters

    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

bindTransformFeedbackSearch playground for bindTransformFeedback

  • Bind a webGL transform feedback object to the webgl context

    Parameters

    Returns void

bindTransformFeedbackBufferSearch playground for bindTransformFeedbackBuffer

  • Bind a webGL buffer for a transform feedback operation

    Parameters

    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

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.

cacheStencilStateSearch playground for cacheStencilState

  • cacheStencilState(): void
  • Caches the the state of the stencil buffer

    Returns void

captureGPUFrameTimeSearch playground for captureGPUFrameTime

  • captureGPUFrameTime(value: boolean): void
  • Enable or disable the GPU frame time capture

    Parameters

    • value: boolean

      True to enable, false to disable

    Returns void

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 overiden by other engines

    Parameters

    • width: number

      width

    • height: number

      height

    Returns ICanvas

    ICanvas interface

createCanvasImageSearch playground for createCanvasImage

createComputeContextSearch playground for createComputeContext

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

    Returns IComputeContext | undefined

    the new context

createComputeEffectSearch playground for createComputeEffect

createComputePipelineContextSearch playground for createComputePipelineContext

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

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

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)

    Returns Effect

    the new Effect

createEffectForParticlesSearch playground for createEffectForParticles

  • createEffectForParticles(fragmentName: string, uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, particleSystem?: IParticleSystem): 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, except if you pass the particle system for which you want to create a custom effect in the last parameter

    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 compilation fails

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

      defines a function to call when the effect creation is successful

        • Parameters

          Returns void

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

      defines a function to call when the effect creation has failed

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

          • effect: Effect
          • errors: string

          Returns void

    • Optional particleSystem: IParticleSystem

      the particle system you want to create the effect for

    Returns Effect

    the new Effect

createImageBitmapSearch playground for createImageBitmap

  • createImageBitmap(image: ImageBitmapSource, options?: ImageBitmapOptions): Promise<ImageBitmap>
  • Engine abstraction for createImageBitmap

    Parameters

    • image: ImageBitmapSource

      source for image

    • Optional options: ImageBitmapOptions

      An object that sets options for the image's extraction.

    Returns Promise<ImageBitmap>

    ImageBitmap

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

createInstancesBufferSearch playground for createInstancesBuffer

  • createInstancesBuffer(capacity: number): DataBuffer
  • Creates a webGL buffer to use with instantiation

    Parameters

    • capacity: number

      defines the size of the buffer

    Returns DataBuffer

    the webGL buffer

createMaterialContextSearch playground for createMaterialContext

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

    Returns IMaterialContext | undefined

    the new context

createMultipleRenderTargetSearch playground for createMultipleRenderTarget

createMultiviewRenderTargetTextureSearch playground for createMultiviewRenderTargetTexture

  • Creates a new multiview render target

    Parameters

    • width: number

      defines the width of the texture

    • height: number

      defines the height of the texture

    Returns RenderTargetWrapper

    the created multiview render target wrapper

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

createQuerySearch playground for createQuery

  • createQuery(): OcclusionQuery
  • Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)

    Returns OcclusionQuery

    the new query

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

    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

createRenderTargetTextureSearch playground for createRenderTargetTexture

createShaderProgramSearch playground for createShaderProgram

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

  • createTexture(url: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<ISceneLike>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap>, fallback?: Nullable<InternalTexture>, format?: Nullable<number>, forcedExtension?: Nullable<string>, mimeType?: string, loaderOptions?: any, creationFlags?: number, useSRGBBuffer?: boolean): InternalTexture
  • 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<() => 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

createTransformFeedbackSearch playground for createTransformFeedback

  • Creates a webGL transform feedback object Please makes sure to check webGLVersion property to check if you are running webGL 2+

    Returns WebGLTransformFeedback

    the webGL transform feedback object

createUniformBufferSearch playground for createUniformBuffer

createVertexBufferSearch playground for createVertexBuffer

createVideoElementSearch playground for createVideoElement

  • createVideoElement(constraints: MediaTrackConstraints): any
  • creates and returns a new video element

    Parameters

    • constraints: MediaTrackConstraints

      video constraints

    Returns any

    video element

deleteInstancesBufferSearch playground for deleteInstancesBuffer

  • deleteInstancesBuffer(buffer: WebGLBuffer): void
  • Delete a webGL buffer used with instantiation

    Parameters

    • buffer: WebGLBuffer

      defines the webGL buffer to delete

    Returns void

deleteQuerySearch playground for deleteQuery

  • deleteQuery(query: OcclusionQuery): Engine
  • Delete and release a webGL query

    Parameters

    • query: OcclusionQuery

      defines the query to delete

    Returns Engine

    the current engine

deleteTransformFeedbackSearch playground for deleteTransformFeedback

  • Delete a webGL transform feedback object

    Parameters

    Returns void

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

disableScissorSearch playground for disableScissor

  • disableScissor(): void
  • Disable previously set scissor test rectangle

    Returns void

disableVRSearch playground for disableVR

  • disableVR(): void

displayLoadingUISearch playground for displayLoadingUI

  • displayLoadingUI(): void

disposeSearch playground for dispose

  • dispose(): void
  • 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

enableScissorSearch playground for enableScissor

  • 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

enableVRSearch playground for enableVR

  • Call this function to switch to webVR mode Will do nothing if webVR is not supported or if there is no webVR device

    see

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

    Parameters

    • options: WebVROptions

      the webvr options provided to the camera. mainly used for multiview

    Returns void

endFrameSearch playground for endFrame

  • endFrame(): void
  • End the current frame

    Returns void

endOcclusionQuerySearch playground for endOcclusionQuery

  • endOcclusionQuery(algorithmType: number): Engine

endTimeQuerySearch playground for endTimeQuery

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

endTransformFeedbackSearch playground for endTransformFeedback

  • endTransformFeedback(): void
  • Ends a transform feedback operation

    Returns void

enterFullscreenSearch playground for enterFullscreen

  • enterFullscreen(requestPointerLock: boolean): void
  • Enters full screen mode

    Parameters

    • requestPointerLock: boolean

      defines if a pointer lock should be requested from the user

    Returns void

enterPointerlockSearch playground for enterPointerlock

  • enterPointerlock(): void
  • Enters Pointerlock mode

    Returns void

exitFullscreenSearch playground for exitFullscreen

  • exitFullscreen(): void
  • Exits full screen mode

    Returns void

exitPointerlockSearch playground for exitPointerlock

  • exitPointerlock(): void
  • Exits Pointerlock mode

    Returns void

flushFramebufferSearch playground for flushFramebuffer

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

    Returns void

generateMipMapsForCubemapSearch playground for generateMipMapsForCubemap

  • 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

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

getAspectRatioSearch playground for getAspectRatio

  • 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

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

getDeltaTimeSearch playground for getDeltaTime

  • getDeltaTime(): number
  • Gets the time spent between current and previous frame

    Returns number

    a number representing the delta time in ms

getDepthBufferSearch playground for getDepthBuffer

  • getDepthBuffer(): boolean
  • Gets a boolean indicating if depth testing is enabled

    Returns boolean

    the current state

getDepthFunctionSearch playground for getDepthFunction

  • Gets the current depth function

    Returns Nullable<number>

    a number defining the depth function

getDepthWriteSearch playground for getDepthWrite

  • getDepthWrite(): boolean
  • Gets a boolean indicating if depth writing is enabled

    Returns boolean

    the current depth writing state

getErrorSearch playground for getError

  • getError(): number

getFontOffsetSearch playground for getFontOffset

  • getFontOffset(font: string): { ascent: number; descent: number; height: number }
  • Get Font size information

    Parameters

    • font: string

      font name

    Returns { ascent: number; descent: number; height: number }

    an object containing ascent, height and descent

    • ascent: number
    • descent: number
    • height: number

getFpsSearch playground for getFps

  • getFps(): number
  • Gets the current framerate

    Returns number

    a number representing the framerate

getFragmentShaderSourceSearch playground for getFragmentShaderSource

  • Gets the source code of the fragment shader associated with a specific webGL program

    Parameters

    Returns Nullable<string>

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

getGPUFrameTimeCounterSearch playground for getGPUFrameTimeCounter

  • Get the performance counter associated with the frame time computation

    Returns PerfCounter

    the perf counter

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

getHostWindowSearch playground for getHostWindow

getInputElementSearch playground for getInputElement

  • getInputElement(): Nullable<HTMLElement>
  • Gets the HTML element used to attach event listeners

    Returns Nullable<HTMLElement>

    a HTML element

getInputElementClientRectSearch playground for getInputElementClientRect

  • getInputElementClientRect(): Nullable<ClientRect>
  • Gets the client rect of the HTML element used for events

    Returns Nullable<ClientRect>

    a client rectangle

getLoadedTexturesCacheSearch playground for getLoadedTexturesCache

getLockstepMaxStepsSearch playground for getLockstepMaxSteps

  • getLockstepMaxSteps(): number

getQueryResultSearch playground for getQueryResult

  • getQueryResult(query: OcclusionQuery): number
  • Gets the value of a given query

    Parameters

    • query: OcclusionQuery

      defines the query to check

    Returns number

    the value of the query

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

getRenderingCanvasClientRectSearch playground for getRenderingCanvasClientRect

  • getRenderingCanvasClientRect(): Nullable<ClientRect>
  • Gets the client rect of the HTML canvas attached with the current webGL context

    Returns Nullable<ClientRect>

    a client rectangle

getScreenAspectRatioSearch playground for getScreenAspectRatio

  • getScreenAspectRatio(): number
  • Gets current screen aspect ratio

    Returns number

    a number defining the aspect ratio

getStencilBufferSearch playground for getStencilBuffer

  • getStencilBuffer(): boolean
  • Gets a boolean indicating if stencil buffer is enabled

    Returns boolean

    the current stencil buffer state

getStencilFunctionSearch playground for getStencilFunction

  • getStencilFunction(): number
  • Gets the current stencil function

    Returns number

    a number defining the stencil function to use

getStencilFunctionMaskSearch playground for getStencilFunctionMask

  • getStencilFunctionMask(): number
  • Gets the current stencil mask

    Returns number

    a number defining the stencil mask to use

getStencilFunctionReferenceSearch playground for getStencilFunctionReference

  • getStencilFunctionReference(): number
  • Gets the current stencil reference value

    Returns number

    a number defining the stencil reference value to use

getStencilMaskSearch playground for getStencilMask

  • getStencilMask(): number
  • Gets the current stencil mask

    Returns number

    a number defining the new stencil mask to use

getStencilOperationDepthFailSearch playground for getStencilOperationDepthFail

  • getStencilOperationDepthFail(): number
  • Gets the current stencil operation when depth fails

    Returns number

    a number defining stencil operation to use when depth fails

getStencilOperationFailSearch playground for getStencilOperationFail

  • getStencilOperationFail(): number
  • Gets the current stencil operation when stencil fails

    Returns number

    a number defining stencil operation to use when stencil fails

getStencilOperationPassSearch playground for getStencilOperationPass

  • getStencilOperationPass(): number
  • Gets the current stencil operation when stencil passes

    Returns number

    a number defining stencil operation to use when stencil passes

getTimeStepSearch playground for getTimeStep

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

    Returns number

    time step in (ms)

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

getVRDeviceSearch playground for getVRDevice

  • getVRDevice(): any
  • Gets the current webVR device

    Returns any

    the current webVR device (or null)

getVertexShaderSourceSearch playground for getVertexShaderSource

  • Gets the source code of the vertex shader associated with a specific webGL program

    Parameters

    Returns Nullable<string>

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

getZOffsetSearch playground for getZOffset

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

    Returns number

    the current zOffset state

hideLoadingUISearch playground for hideLoadingUI

  • hideLoadingUI(): void

initWebVRSearch playground for initWebVR

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

    Returns Observable<IDisplayChangedEventArgs>

    The onVRDisplayChangedObservable

initWebVRAsyncSearch playground for initWebVRAsync

  • 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

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

isDeterministicLockStepSearch playground for isDeterministicLockStep

  • isDeterministicLockStep(): boolean

isQueryResultAvailableSearch playground for isQueryResultAvailable

  • isQueryResultAvailable(query: OcclusionQuery): boolean
  • Check if a given query has resolved and got its value

    Parameters

    • query: OcclusionQuery

      defines the query to check

    Returns boolean

    true if the query got its value

isVRDevicePresentSearch playground for isVRDevicePresent

  • isVRDevicePresent(): boolean
  • Gets a boolean indicating if a webVR device was detected

    Returns boolean

    true if a webVR device was detected

isVRPresentingSearch playground for isVRPresenting

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

    Returns boolean

    true if VR mode is engaged

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

registerViewSearch playground for registerView

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

    • Optional clearBeforeCopy: boolean

      Indicates if the destination view canvas should be cleared before copying the parent canvas. Can help if the scene clear color has alpha < 1

    Returns EngineView

    the associated view

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

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

resizeImageBitmapSearch playground for resizeImageBitmap

  • resizeImageBitmap(image: HTMLImageElement | ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array
  • Resize an image and returns the image data as an uint8array

    Parameters

    • image: HTMLImageElement | ImageBitmap

      image to resize

    • bufferWidth: number

      destination buffer width

    • bufferHeight: number

      destination buffer height

    Returns Uint8Array

    an uint8array containing RGBA values of bufferWidth * bufferHeight size

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

restoreStencilStateSearch playground for restoreStencilState

  • restoreStencilState(): void
  • Restores the state of the stencil 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

scissorClearSearch playground for scissorClear

  • 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

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

setCompressedTextureExclusionsSearch playground for setCompressedTextureExclusions

  • 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

setDepthBufferSearch playground for setDepthBuffer

  • setDepthBuffer(enable: boolean): void
  • Enable or disable depth buffering

    Parameters

    • enable: boolean

      defines the state to set

    Returns void

setDepthFunctionSearch playground for setDepthFunction

  • setDepthFunction(depthFunc: number): void
  • Sets the current depth function

    Parameters

    • depthFunc: number

      defines the function to use

    Returns void

setDepthFunctionToGreaterSearch playground for setDepthFunctionToGreater

  • setDepthFunctionToGreater(): void
  • Sets the current depth function to GREATER

    Returns void

setDepthFunctionToGreaterOrEqualSearch playground for setDepthFunctionToGreaterOrEqual

  • setDepthFunctionToGreaterOrEqual(): void
  • Sets the current depth function to GEQUAL

    Returns void

setDepthFunctionToLessSearch playground for setDepthFunctionToLess

  • setDepthFunctionToLess(): void
  • Sets the current depth function to LESS

    Returns void

setDepthFunctionToLessOrEqualSearch playground for setDepthFunctionToLessOrEqual

  • setDepthFunctionToLessOrEqual(): void
  • Sets the current depth function to LEQUAL

    Returns void

setDepthStencilTextureSearch playground for setDepthStencilTexture

  • Sets a depth stencil texture from a render target to the according uniform.

    Parameters

    Returns void

setDepthWriteSearch playground for setDepthWrite

  • setDepthWrite(enable: boolean): void
  • Enable or disable depth writing

    Parameters

    • enable: boolean

      defines the state to set

    Returns void

setDirectViewportSearch playground for setDirectViewport

  • 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

setDitheringStateSearch playground for setDitheringState

  • 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

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

setRasterizerStateSearch playground for setRasterizerState

  • 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

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

    Returns void

setStencilBufferSearch playground for setStencilBuffer

  • 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

setStencilFunctionSearch playground for setStencilFunction

  • setStencilFunction(stencilFunc: number): void
  • Sets the current stencil function

    Parameters

    • stencilFunc: number

      defines the new stencil function to use

    Returns void

setStencilFunctionMaskSearch playground for setStencilFunctionMask

  • setStencilFunctionMask(mask: number): void
  • Sets the current stencil mask

    Parameters

    • mask: number

      defines the new stencil mask to use

    Returns void

setStencilFunctionReferenceSearch playground for setStencilFunctionReference

  • setStencilFunctionReference(reference: number): void
  • Sets the current stencil reference

    Parameters

    • reference: number

      defines the new stencil reference to use

    Returns void

setStencilMaskSearch playground for setStencilMask

  • setStencilMask(mask: number): void
  • Sets the current stencil mask

    Parameters

    • mask: number

      defines the new stencil mask to use

    Returns void

setStencilOperationDepthFailSearch playground for setStencilOperationDepthFail

  • 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

setStencilOperationFailSearch playground for setStencilOperationFail

  • 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

setStencilOperationPassSearch playground for setStencilOperationPass

  • 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

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

setTextureFormatToUseSearch playground for setTextureFormatToUse

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

setTextureFromPostProcessSearch playground for setTextureFromPostProcess

  • setTextureFromPostProcess(channel: number, postProcess: Nullable<PostProcess>, name: string): void
  • Sets a texture to the webGL context from a postprocess

    Parameters

    • channel: number

      defines the channel to use

    • postProcess: Nullable<PostProcess>

      defines the source postprocess

    • name: string

      name of the channel

    Returns void

setTextureFromPostProcessOutputSearch playground for setTextureFromPostProcessOutput

  • setTextureFromPostProcessOutput(channel: number, postProcess: Nullable<PostProcess>, name: string): void
  • 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

    • name: string

      name of the channel

    Returns void

setTranformFeedbackVaryingsSearch playground for setTranformFeedbackVaryings

  • 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

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 to apply to current rendering

    Parameters

    • value: number

      defines the offset to apply

    Returns void

startTimeQuerySearch playground for startTimeQuery

  • 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

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

switchFullscreenSearch playground for switchFullscreen

  • switchFullscreen(requestPointerLock: boolean): void
  • Toggle full screen mode

    Parameters

    • requestPointerLock: boolean

      defines if a pointer lock should be requested from the user

    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

unRegisterViewSearch playground for unRegisterView

  • Remove a registered child canvas

    Parameters

    Returns Engine

    the current engine

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

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)

    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

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)

    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

updateTextureComparisonFunctionSearch playground for updateTextureComparisonFunction

  • 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

updateTextureDataSearch playground for updateTextureData

  • updateTextureData(texture: InternalTexture, imageData: ArrayBufferView, xOffset: number, yOffset: number, width: number, height: number, faceIndex?: number, lod?: number): 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)

    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

updateVideoTextureSearch playground for updateVideoTexture

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 DefaultLoadingScreenFactorySearch playground for DefaultLoadingScreenFactory

  • Method called to create the default loading screen. This can be overridden in your own app.

    Parameters

    Returns ILoadingScreen

    The loading screen

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 MarkAllMaterialsAsDirtySearch playground for MarkAllMaterialsAsDirty

  • MarkAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): 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: (mat: Material) => boolean

      defines a predicate used to filter which materials should be affected

    Returns void

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 _ExitFullscreenSearch playground for _ExitFullscreen

  • _ExitFullscreen(): void
  • Asks the browser to exit fullscreen mode

    Returns void

Static _ExitPointerlockSearch playground for _ExitPointerlock

  • _ExitPointerlock(): void
  • Asks the browser to exit pointerlock mode

    Returns void

Static _RequestFullscreenSearch playground for _RequestFullscreen

  • _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 _RequestPointerlockSearch playground for _RequestPointerlock

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

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