API

Class AbstractEngineAbstract

The parent class for specialized engines (WebGL, WebGPU)

Hierarchy (View Summary)

Index
_createDepthStencilCubeTexture _createImageBitmapFromSource _loadFileAsync areAllComputeEffectsReady areAllEffectsReady beginFrame beginOcclusionQuery bindAttachments bindBuffers bindFramebuffer bindSamplers bindUniformBlock bindUniformBufferBase buildTextureLayout cacheStencilState captureGPUFrameTime clear clearInternalTexturesCache computeDispatch computeDispatchIndirect createCanvas createCanvasImage createCanvasPath2D createComputeContext createComputeEffect createComputePipelineContext createCubeTexture createDepthStencilTexture createDrawContext createDynamicTexture createDynamicUniformBuffer createDynamicVertexBuffer createEffect createEffectForParticles createImageBitmap createIndexBuffer createMaterialContext createMultipleRenderTarget createPipelineContext createPrefilteredCubeTexture createQuery createRawCubeTexture createRawCubeTextureFromUrl createRawTexture createRawTexture2DArray createRawTexture3D createRenderPassId createRenderTargetCubeTexture createRenderTargetTexture createTexture createUniformBuffer createVertexBuffer createVideoElement deleteQuery disableScissor displayLoadingUI dispose drawArraysType drawElementsType enableEffect enableScissor endFrame endOcclusionQuery enterFullscreen exitFullscreen extractDriverInfo flushFramebuffer generateMipmaps generateMipMapsForCubemap generateMipMapsFramebuffer generateMipMapsMultiFramebuffer getAlphaEquation getAlphaMode getAspectRatio getAudioContext getAudioDestination getCaps getClassName getColorWrite getCreationOptions getCurrentRenderPassName getDeltaTime getDepthBuffer getDepthFunction getDepthWrite getError getFontOffset getFps getGPUFrameTimeCounter getHardwareScalingLevel getHostDocument getHostWindow getInputElement getInputElementClientRect getLoadedTexturesCache getLockstepMaxSteps getQueryResult getRenderHeight getRenderingCanvas getRenderingCanvasClientRect getRenderPassNames getRenderWidth getScreenAspectRatio getStencilBackFunction getStencilBackOperationDepthFail getStencilBackOperationFail getStencilBackOperationPass getStencilBuffer getStencilFunction getStencilFunctionMask getStencilFunctionReference getStencilMask getStencilOperationDepthFail getStencilOperationFail getStencilOperationPass getTimeStep getZOffset getZOffsetUnits hideLoadingUI inlineShaderCode isDeterministicLockStep isOcclusionQueryVisible isQueryResultAvailable readPixels registerView releaseComputeEffects releaseEffects releaseRenderPassId resetTextureCache resize resizeImageBitmap resolveFramebuffer resolveMultiFramebuffer restoreDefaultFramebuffer restoreSingleAttachment restoreSingleAttachmentForRenderTarget restoreStencilState runRenderLoop setAlphaConstants setAlphaEquation setAlphaMode setColorWrite setCompressedTextureExclusions setDepthBuffer setDepthFunction setDepthFunctionToGreater setDepthFunctionToGreaterOrEqual setDepthFunctionToLess setDepthFunctionToLessOrEqual setDepthStencilTexture setDepthWrite setHardwareScalingLevel setSize setState setStateCullFaceType setStencilBackFunction setStencilBackOperationDepthFail setStencilBackOperationFail setStencilBackOperationPass setStencilBuffer setStencilFunction setStencilFunctionMask setStencilFunctionReference setStencilMask setStencilOperationDepthFail setStencilOperationFail setStencilOperationPass setTexture setTextureArray setTextureFormatToUse setTextureFromPostProcess setTextureFromPostProcessOutput setViewport setZOffset setZOffsetUnits stopRenderLoop switchFullscreen unBindFramebuffer unbindInstanceAttributes unBindMultiColorAttachmentFramebuffer unRegisterView updateDynamicIndexBuffer updateDynamicTexture updateDynamicVertexBuffer updateMultipleRenderTargetTextureSampleCount updateRawCubeTexture updateRawTexture updateRawTexture2DArray updateRawTexture3D updateRenderTargetTextureSampleCount updateTextureArrayLayerFromImageSource updateTextureDimensions updateTextureSamplingMode updateTextureWrappingMode updateUniformBuffer updateVideoTexture wipeCaches DefaultLoadingScreenFactory MarkAllMaterialsAsDirty
  • Creates a new engine

    Parameters

    • antialias: boolean | undefined

      defines whether anti-aliasing should be enabled. If undefined, it means that the underlying engine is free to enable it or not

    • options: AbstractEngineOptions

      defines further options to be sent to the creation context

    • OptionaladaptToDeviceRatio: boolean

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

    Returns AbstractEngine

activeView: Nullable<EngineView>

Gets the current engine view

adaptToDeviceRatio: boolean = false

If set to true zooming in and out in the browser will rescale the hardware-scaling correctly.

canvasTabIndex: number = 1

Gets or sets the tab index to set to the rendering canvas. Any value >= 0 makes the canvas focusable to capture keyboard events and adds it to the tab order; use -1 to keep it focusable programmatically but out of the tab order

cullBackFaces: Nullable<boolean> = null

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

currentRenderPassId: number = Constants.RENDERPASS_MAIN

Gets or sets the current render pass id

customAnimationFrameRequester: Nullable<ICustomAnimationFrameRequester> = null

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

disableContextMenu: boolean = true

Gets or sets a boolean to enable/disable the context menu (right-click) from appearing on the main canvas

disableManifestCheck: boolean = false

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

disablePerformanceMonitorInBackground: boolean = false

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

disableVertexArrayObjects: boolean = false

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

enableOfflineSupport: boolean = false

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

hasOriginBottomLeft: boolean = true

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

hostInformation: HostInformation = ...

Gets information about the current host

inputElement: Nullable<HTMLElement>

Gets or sets the HTML element to use for attaching events

isFullscreen: boolean = false

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

isNDCHalfZRange: boolean = false

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

isPointerLock: boolean = false

Gets a boolean indicating if the pointer is currently locked

loadingScreen: ILoadingScreen

Gets or sets the current loading screen object

loadingUIBackgroundColor: string

Sets the current loading screen background color

loadingUIText: string

Sets the current loading screen text

onAfterShaderCompilationObservable: Observable<AbstractEngine> = ...

Observable raised when the engine has just compiled a shader

onAfterViewRenderObservable: Observable<EngineView>

Will be triggered after the view rendered

onBeforeShaderCompilationObservable: Observable<AbstractEngine> = ...

Observable raised when the engine is about to compile a shader

onBeforeTextureInitObservable: Observable<Texture> = ...

Observable event triggered before each texture is initialized

onBeforeViewRenderObservable: Observable<EngineView>

Will be triggered before the view renders

onBeginFrameObservable: Observable<AbstractEngine> = ...

Observable raised when the engine begins a new frame

onCanvasBlurObservable: Observable<AbstractEngine> = ...

Observable event triggered each time the canvas loses focus

onCanvasFocusObservable: Observable<AbstractEngine> = ...

Observable event triggered each time the canvas gains focus

onCanvasPointerOutObservable: Observable<PointerEvent> = ...

Observable event triggered each time the canvas receives pointerout event

onContextLostObservable: Observable<AbstractEngine> = ...

Observable signaled when a context lost event is raised

onContextRestoredObservable: Observable<AbstractEngine> = ...

Observable signaled when a context restored event is raised

onDisposeObservable: Observable<AbstractEngine> = ...

An event triggered when the engine is disposed.

onEffectErrorObservable: Observable<{ effect: Effect; errors: string }> = ...

Observable event triggered each time an effect compilation fails

onEndFrameObservable: Observable<AbstractEngine> = ...

Observable raised when the engine ends the current frame (requires a render loop, e.g. 'engine.runRenderLoop(...)')

onNewSceneAddedObservable: Observable<Scene> = ...

Event raised when a new scene is created

onReleaseEffectsObservable: Observable<AbstractEngine> = ...

An event triggered when a global cleanup of all effects is required

onResizeObservable: Observable<AbstractEngine> = ...

Observable event triggered each time the rendering canvas is resized

postProcesses: PostProcess[] = []

Gets the list of created postprocesses

premultipliedAlpha: boolean = true

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

preventCacheWipeBetweenFrames: boolean = false

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

renderEvenInBackground: boolean = true

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

scenes: Scene[] = []

Gets the list of created scenes

skipFrameRender: boolean = false

Skip frame rendering but keep the frame heartbeat (begin/end frame). This is useful if you need all the plumbing but not the rendering work. (for instance when capturing a screenshot where you do not want to mix rendering to the screen and to the screenshot)

startTime: number

The time (in milliseconds elapsed since the current page has been loaded) when the engine was initialized

textureFormatInUse: Nullable<string>

Gets the texture format in use

texturesSupported: string[]

Gets the list of texture formats supported

useExactSrgbConversions: boolean

Gets a boolean indicating if the exact sRGB conversions or faster approximations are used for converting to and from linear space.

views: EngineView[]

Gets or sets the list of views

_RescalePostProcessFactory: Nullable<(engine: AbstractEngine) => PostProcess> = null

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

audioEngine: Nullable<IAudioEngine>

Gets the audio engine

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.

please use AudioEngineV2 instead

CollisionsEpsilon: number = 0.001

Gets or sets the epsilon value used by collision engine

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.

QueueNewFrame: (func: () => void, requester?: any) => number = QueueNewFrame

Queue a new function into the requested animation frame pool (ie. this function will be executed by the browser (or the javascript engine) for the next frame)

Type Declaration

    • (func: () => void, requester?: any): number
    • Parameters

      • func: () => void

        the function to be called

      • Optionalrequester: any

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

      Returns number

      frame number

  • set framebufferDimensionsObject(
        dimensions: Nullable<
            { framebufferHeight: number; framebufferWidth: number },
        >,
    ): void

    sets the object from which width and height will be taken from when getting render width and height

    Parameters

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

      the framebuffer width and height that will be used.

    Returns void

  • 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

  • Engine abstraction for loading and creating an image bitmap from a given source string.

    Parameters

    • imageSource: string

      source to load the image from.

    • Optionaloptions: ImageBitmapOptions

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

    Returns Promise<ImageBitmap>

  • Binds the frame buffer to the specified texture.

    Parameters

    • texture: RenderTargetWrapper

      The render target wrapper to render to

    • OptionalfaceIndex: number

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

    • OptionalrequiredWidth: number

      The width of the target to render to

    • OptionalrequiredHeight: number

      The height of the target to render to

    • OptionalforceFullscreenViewport: boolean

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

    • OptionallodLevel: number

      defines the lod level to bind to the frame buffer

    • Optionallayer: number

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

    Returns void

  • 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

    • OptionalbackBufferLayout: boolean

      if true, the layout will be built to account for the back buffer only, and textureStatus won't be used

    Returns number[]

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

  • 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

    • OptionalbackBufferLayout: boolean

      if true, the layout will be built to account for the back buffer only, and textureStatus won't be used

    Returns number[]

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

  • 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

    • Optionalstencil: boolean

      defines if the stencil buffer must be cleared

    • OptionalstencilClearValue: number

      defines the value to use to clear the stencil buffer

    Returns 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

    • Optionaly: number

      The number of workgroups to execute on the Y dimension

    • Optionalz: number

      The number of workgroups to execute on the Z dimension

    • OptionalbindingsMapping: ComputeBindingMapping

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

    • OptionalgpuPerfCounter: WebGPUPerfCounter

      GPU time computed for the compute shader will be assigned to this object

    Returns 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

    • buffer: DataBuffer

      The buffer containing the dispatch parameters

    • Optionaloffset: number

      The offset in the buffer where the dispatch parameters start

    • OptionalbindingsMapping: ComputeBindingMapping

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

    • OptionalgpuPerfCounter: WebGPUPerfCounter

      GPU time computed for the compute shader will be assigned to this object

    Returns void

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

    • buffer: Nullable<ArrayBufferView<ArrayBufferLike>>

      defines the data buffer to load instead of loading the rootUrl

    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

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

    • buffer: Nullable<ArrayBufferView<ArrayBufferLike>>

      defines the data buffer to load instead of loading the rootUrl

    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

  • 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

  • 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

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

    Parameters

    • baseName: string | IShaderPath & { fragmentToken?: string; vertexToken?: string }

      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[] | AbstractEngine

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

    • Optionalsamplers: string[]

      defines an array of string used to represent textures

    • Optionaldefines: string

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

    • Optionalfallbacks: EffectFallbacks

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

    • OptionalonCompiled: Nullable<(effect: Effect) => void>

      defines a function to call when the effect creation is successful

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

      defines a function to call when the effect creation has failed

    • OptionalindexParameters: any

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

    • OptionalshaderLanguage: ShaderLanguage

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

    • OptionalextraInitializationsAsync: () => Promise<void>

      additional async code to run before preparing the effect

    Returns Effect

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

    • Optionalfallbacks: EffectFallbacks

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

    • OptionalonCompiled: (effect: Effect) => void

      defines a function to call when the effect creation is successful

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

      defines a function to call when the effect creation has failed

    • OptionalparticleSystem: IParticleSystem

      the particle system you want to create the effect for

    • OptionalshaderLanguage: any

      defines the shader language to use

    • OptionalvertexName: string

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

    Returns Effect

    the new Effect

  • Engine abstraction for createImageBitmap

    Parameters

    • image: ImageBitmapSource

      source for image

    • Optionaloptions: ImageBitmapOptions

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

    Returns Promise<ImageBitmap>

    ImageBitmap

  • 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

    • OptionalonLoad: Nullable<(internalTexture: Nullable<InternalTexture>) => void>

      defines an optional callback raised when the texture is loaded

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

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

    • Optionalformat: number

      defines the format of the data

    • OptionalforcedExtension: any

      defines the extension to use to pick the right loader

    • OptionalcreatePolynomials: boolean

      defines wheter or not to create polynomails harmonics for the texture

    • Optionalbuffer: Nullable<ArrayBufferView<ArrayBufferLike>>

      defines the data buffer to load instead of loading the rootUrl

    Returns InternalTexture

    the cube texture as an InternalTexture

  • Creates a new raw cube texture

    Parameters

    • data: Nullable<ArrayBufferView<ArrayBufferLike>[]>

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

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

    • Optionalcompression: Nullable<string>

      defines the compression used (null by default)

    Returns InternalTexture

    the cube texture as an InternalTexture

  • Creates a new raw cube texture

    Parameters

    • data: Nullable<ArrayBufferView<ArrayBufferLike>[]>

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

    • 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

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

    • noMipmap: boolean

      defines if the engine should avoid generating the mip levels

    • callback: (
          ArrayBuffer: ArrayBuffer,
      ) => Nullable<
          | ArrayBufferView<ArrayBufferLike>[]
          | Promise<ArrayBufferView<ArrayBufferLike>[]>,
      >

      defines a callback used to extract texture data from loaded data

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

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

    • noMipmap: boolean

      defines if the engine should avoid generating the mip levels

    • callback: (
          ArrayBuffer: ArrayBuffer,
      ) => Nullable<
          | ArrayBufferView<ArrayBufferLike>[]
          | Promise<ArrayBufferView<ArrayBufferLike>[]>,
      >

      defines a callback used to extract texture data from loaded data

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

      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

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

    • noMipmap: boolean

      defines if the engine should avoid generating the mip levels

    • callback: (
          ArrayBuffer: ArrayBuffer,
      ) => Nullable<
          | ArrayBufferView<ArrayBufferLike>[]
          | Promise<ArrayBufferView<ArrayBufferLike>[]>,
      >

      defines a callback used to extract texture data from loaded data

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

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

    • noMipmap: boolean

      defines if the engine should avoid generating the mip levels

    • callback: (
          ArrayBuffer: ArrayBuffer,
      ) => Nullable<
          | ArrayBufferView<ArrayBufferLike>[]
          | Promise<ArrayBufferView<ArrayBufferLike>[]>,
      >

      defines a callback used to extract texture data from loaded data

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

      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

  • Creates a raw texture

    Parameters

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

      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)

    • Optionalcompression: Nullable<string>

      defines the compression used (null by default)

    • Optionaltype: number

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

    • OptionalcreationFlags: number

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

    • OptionaluseSRGBBuffer: boolean

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

    • OptionalmipLevelCount: number

      defines the number of mip levels to allocate for the texture

    Returns InternalTexture

    the raw texture inside an InternalTexture

  • Creates a new raw 2D array texture

    Parameters

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

      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)

    • Optionalcompression: Nullable<string>

      defines the compressed used (can be null)

    • OptionaltextureType: number

      defines the compressed used (can be null)

    • OptionalcreationFlags: number

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

    • OptionalmipLevelCount: number

      defines the number of mip levels to allocate for the texture

    Returns InternalTexture

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

  • Creates a new raw 3D texture

    Parameters

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

      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)

    • Optionalcompression: Nullable<string>

      defines the compressed used (can be null)

    • OptionaltextureType: number

      defines the compressed used (can be null)

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

  • 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

    • OptionalsamplingMode: number

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

    • OptionalonLoad: Nullable<(texture: InternalTexture) => void>

      optional callback to be called upon successful completion

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

      optional callback to be called upon failure

    • Optionalbuffer: Nullable<
          | string
          | ArrayBuffer
          | ArrayBufferView<ArrayBufferLike>
          | HTMLImageElement
          | ImageBitmap
          | Blob,
      >

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

    • Optionalfallback: Nullable<InternalTexture>

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

    • Optionalformat: Nullable<number>

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

    • OptionalforcedExtension: Nullable<string>

      defines the extension to use to pick the right loader

    • OptionalmimeType: string

      defines an optional mime type

    • OptionalloaderOptions: any

      options to be passed to the loader

    • OptionalcreationFlags: number

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

    • OptionaluseSRGBBuffer: 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

  • Creates a vertex buffer

    Parameters

    • data: number | DataArray

      the data or size for the vertex buffer

    • Optional_updatable: boolean

      whether the buffer should be created as updatable

    • Optional_label: string

      defines the label of the buffer (for debug purpose)

    Returns DataBuffer

    the new WebGL static buffer

  • 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

    • OptionalinstancesCount: number

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

    Returns 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

    • OptionalinstancesCount: number

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

    Returns 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 bottom left corner of the scissor rectangle

    • y: number

      defines the y-coordinate of the bottom left corner of the scissor rectangle

    • width: number

      defines the width of the scissor rectangle

    • height: number

      defines the height of the scissor rectangle

    Returns void

  • Gets the audio destination specified in engine initialization options

    Returns Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode>

    an audio destination node

    please use AudioEngineV2 instead

  • 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

  • Gets the backend-specific value of a query. For an available occlusion query, only zero (no samples passed) versus a positive value (samples passed) is portable across backends. The magnitude of a positive value is backend-dependent and should not be relied upon. Use isOcclusionQueryVisible when only visibility is needed.

    Parameters

    • query: OcclusionQuery

      defines the query to check

    Returns number

    the raw backend query value

  • Gets the current render height

    Parameters

    • OptionaluseScreen: boolean

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

    Returns number

    a number defining the current render height

  • Gets the current render width

    Parameters

    • OptionaluseScreen: boolean

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

    Returns number

    a number defining the current render width

  • Checks whether an available occlusion query indicates that any samples passed. This normalizes backend-specific query values without changing the raw value returned by getQueryResult.

    Parameters

    • query: OcclusionQuery

      defines the occlusion query to check

    Returns boolean

    true when the query result is greater than zero, otherwise false

  • 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

    • OptionalhasAlpha: boolean

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

    • OptionalflushRenderer: boolean

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

    Returns Promise<ArrayBufferView<ArrayBufferLike>>

    a ArrayBufferView promise (Uint8Array) containing RGBA colors

  • Since

    Register a new child canvas

    Parameters

    • canvas: HTMLCanvasElement

      defines the canvas to register

    • Optionalcamera: Camera | Camera[]

      defines an optional camera or array of cameras to use with this canvas (it will overwrite the scene.activeCamera / scene.activeCameras for this view). Support for array of cameras

    • OptionalclearBeforeCopy: 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

  • 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

  • Unbind the current render target and bind the default framebuffer

    Parameters

    • OptionalunbindOnly: boolean

      defines a boolean indicating that the function should only unbind the current render target without binding the default framebuffer

    Returns 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

    Returns void

  • Sets the current alpha equation

    Parameters

    • equation: number

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

    • OptionaltargetIndex: number

      defines the index of the target to set the equation for (default is 0)

    Returns 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

  • Force a specific size of the canvas

    Parameters

    • width: number

      defines the new canvas' width

    • height: number

      defines the new canvas' height

    • forceSetSize: boolean = false

      true to force setting the sizes of the underlying canvas

    Returns boolean

    true if the size was changed

  • Set various states to the webGL context

    Parameters

    • culling: boolean

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

    • OptionalzOffset: number

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

    • Optionalforce: boolean

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

    • OptionalreverseSide: boolean

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

    • OptionalcullBackFaces: boolean

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

    • Optionalstencil: IStencilState | IStencilStateProperties

      stencil states to set

    • OptionalzOffsetUnits: number

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

    Returns void

  • Sets the type of faces to cull

    Parameters

    • OptionalcullBackFaces: boolean

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

    • Optionalforce: boolean

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

    Returns void

  • 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

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

  • Set the WebGL's viewport

    Parameters

    • viewport: IViewportLike

      defines the viewport element to be used

    • OptionalrequiredWidth: number

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

    • OptionalrequiredHeight: number

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

    Returns void

  • stop executing a render loop function and remove it from the execution array

    Parameters

    • OptionalrenderFunction: () => void

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

    Returns void

  • Unbind the current render target texture from the webGL context

    Parameters

    • texture: RenderTargetWrapper

      defines the render target wrapper to unbind

    • OptionaldisableGenerateMipMaps: boolean

      defines a boolean indicating that mipmaps must not be generated

    • OptionalonBeforeUnbind: () => void

      defines a function which will be called before the effective unbind

    Returns 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

    • OptionalonBeforeUnbind: () => void

      defines a function which will be called before the effective unbind

    Returns 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

    • OptionalonBeforeUnbind: () => void

      defines a function which will be called before the effective unbind

    Returns void

  • Update the content of a dynamic texture

    Parameters

    • texture: Nullable<InternalTexture>

      defines the texture to update

    • source: ICanvas | ImageSource

      defines the source containing the data

    • OptionalinvertY: boolean

      defines if data must be stored with Y axis inverted

    • OptionalpremulAlpha: boolean

      defines if alpha is stored as premultiplied

    • Optionalformat: number

      defines the format of the data

    • OptionalforceBindTexture: boolean

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

    • OptionalallowGPUOptimization: boolean

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

    Returns void

  • Update the content of a dynamic texture

    Parameters

    • texture: Nullable<InternalTexture>

      defines the texture to update

    • source: ICanvas | ImageSource

      defines the source containing the data

    • OptionalinvertY: boolean

      defines if data must be stored with Y axis inverted

    • OptionalpremulAlpha: boolean

      defines if alpha is stored as premultiplied

    • Optionalformat: number

      defines the format of the data

    • OptionalforceBindTexture: boolean

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

    • OptionalallowGPUOptimization: boolean

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

    Returns void

  • Update a raw cube texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: ArrayBufferView<ArrayBufferLike>[]

      defines the data to store

    • format: number

      defines the data format

    • type: number

      defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE 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<ArrayBufferLike>[]

      defines the data to store

    • format: number

      defines the data format

    • type: number

      defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE 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<ArrayBufferLike>[]

      defines the data to store

    • format: number

      defines the data format

    • type: number

      defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE 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

  • Update a raw cube texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: ArrayBufferView<ArrayBufferLike>[]

      defines the data to store

    • format: number

      defines the data format

    • type: number

      defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE 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<ArrayBufferLike>[]

      defines the data to store

    • format: number

      defines the data format

    • type: number

      defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE 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<ArrayBufferLike>[]

      defines the data to store

    • format: number

      defines the data format

    • type: number

      defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE 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

  • Update a raw texture

    Parameters

    • texture: Nullable<InternalTexture>

      defines the texture to update

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

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

      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_BYTE by default)

    • useSRGBBuffer: boolean

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

    Returns void

  • Update a raw texture

    Parameters

    • texture: Nullable<InternalTexture>

      defines the texture to update

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

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

      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_BYTE by default)

    • useSRGBBuffer: boolean

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

    • OptionalmipLevel: number

      defines which mipLevel of the texture is going to be updated

    Returns void

  • Update a raw 2D array texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

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

      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_BYTE, Engine.TEXTURETYPE_FLOAT...)

    Returns void

  • Update a raw 2D array texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

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

      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_BYTE, Engine.TEXTURETYPE_FLOAT...)

    Returns void

  • Update a raw 2D array texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

      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_BYTE, Engine.TEXTURETYPE_FLOAT...)

    • OptionalmipLevel: number

      defines which mipLevel of the texture is going to be updated

    Returns void

  • Update a raw 3D texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

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

      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_BYTE, Engine.TEXTURETYPE_FLOAT...)

    Returns void

  • Update a raw 3D texture

    Parameters

    • texture: InternalTexture

      defines the texture to update

    • data: Nullable<ArrayBufferView<ArrayBufferLike>>

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

      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_BYTE, Engine.TEXTURETYPE_FLOAT...)

    Returns void

  • Uploads an image source (ImageBitmap, canvas, video, image element...) into a single layer of a 2D array texture. Unlike updateRawTexture2DArray, which uploads raw bytes, this uploads a decoded image source directly. This is a side-effect engine extension: import "core/Engines/Extensions/engine.texture2DArrayImageSource" (or the WebGPU counterpart) to make it available on the tree-shakeable engine path.

    Parameters

    • texture: InternalTexture

      defines the 2D array texture to update

    • source: ImageSource

      defines the image source to upload

    • layer: number

      defines the array layer (z index) to upload into

    • OptionalinvertY: boolean

      defines if the source must be stored with the Y axis inverted (false by default)

    • OptionalpremultiplyAlpha: boolean

      defines if the source alpha must be premultiplied (false by default)

    Returns void

  • Update the sampling mode of a given texture

    Parameters

    • samplingMode: number

      defines the required sampling mode

    • texture: InternalTexture

      defines the texture to update

    • OptionalgenerateMipMaps: boolean

      defines whether to generate mipmaps for the texture

    Returns 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

    • Optionalpredicate: (mat: Material) => boolean

      defines a predicate used to filter which materials should be affected

    Returns void