ThinEngine | Babylon.js API documentation

API
Babylon.js API documentation
    Preparing search index...

    Class ThinEngine

    The base engine class (root of all engines)

    Hierarchy (View Summary)

    Index
    _createDepthStencilCubeTexture _createImageBitmapFromSource _getInternalFormatFromDepthTextureFormat _getWebGLTextureTypeFromDepthTextureFormat _loadFileAsync _updateRenderBuffer applyStates areAllComputeEffectsReady areAllEffectsReady attachContextLostEvent attachContextRestoredEvent beginFrame beginOcclusionQuery bindArrayBuffer bindAttachments bindBuffers bindBuffersDirectly bindFramebuffer bindInstancesBuffer bindSamplers bindUniformBlock bindUniformBuffer bindUniformBufferBase bindVertexArrayObject 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 createRawShaderProgram createRawTexture createRawTexture2DArray createRawTexture3D createRenderPassId createRenderTargetCubeTexture createRenderTargetTexture createShaderProgram createTexture createUniformBuffer createVertexBuffer createVideoElement deleteQuery disableAttributeByIndex disableInstanceAttribute disableInstanceAttributeByName disableScissor displayLoadingUI dispose draw drawArraysType drawElementsType drawPointClouds drawUnIndexed enableEffect enableScissor endFrame endOcclusionQuery endTimeQuery enterFullscreen exitFullscreen extractDriverInfo flushFramebuffer generateMipmaps generateMipMapsForCubemap generateMipMapsFramebuffer generateMipMapsMultiFramebuffer getAlphaEquation getAlphaMode getAlphaToCoverage getAspectRatio getAttributes getAudioContext getAudioDestination getCaps getClassName getColorWrite getCreationOptions getCurrentRenderPassName getDeltaTime getDepthBuffer getDepthFunction getDepthWrite getError getFontOffset getFps getGlInfo getGPUFrameTimeCounter getHardwareScalingLevel getHostDocument getHostWindow getInfo getInputElement getInputElementClientRect getLoadedTexturesCache getLockstepMaxSteps getQueryResult getRenderHeight getRenderingCanvas getRenderingCanvasClientRect getRenderPassNames getRenderWidth getScreenAspectRatio getStencilBackFunction getStencilBackOperationDepthFail getStencilBackOperationFail getStencilBackOperationPass getStencilBuffer getStencilFunction getStencilFunctionMask getStencilFunctionReference getStencilMask getStencilOperationDepthFail getStencilOperationFail getStencilOperationPass getTimeStep getUniforms getZOffset getZOffsetUnits hideLoadingUI inlineShaderCode isDeterministicLockStep isOcclusionQueryVisible isQueryResultAvailable readPixels recordVertexArrayObject registerView releaseComputeEffects releaseEffects releaseRenderPassId releaseVertexArrayObject resetTextureCache resize resizeImageBitmap resolveFramebuffer resolveMultiFramebuffer restoreDefaultFramebuffer restoreSingleAttachment restoreSingleAttachmentForRenderTarget restoreStencilState runRenderLoop setAlphaConstants setAlphaEquation setAlphaMode setAlphaToCoverage setArray setArray2 setArray3 setArray4 setColorWrite setCompressedTextureExclusions setDepthBuffer setDepthFunction setDepthFunctionToGreater setDepthFunctionToGreaterOrEqual setDepthFunctionToLess setDepthFunctionToLessOrEqual setDepthStencilTexture setDepthWrite setFloat setFloat2 setFloat3 setFloat4 setHardwareScalingLevel setInt setInt2 setInt3 setInt4 setIntArray setIntArray2 setIntArray3 setIntArray4 setMatrices setMatrix2x2 setMatrix3x3 setSize setState setStateCullFaceType setStencilBackFunction setStencilBackOperationDepthFail setStencilBackOperationFail setStencilBackOperationPass setStencilBuffer setStencilFunction setStencilFunctionMask setStencilFunctionReference setStencilMask setStencilOperationDepthFail setStencilOperationFail setStencilOperationPass setTexture setTextureArray setTextureFormatToUse setTextureFromPostProcess setTextureFromPostProcessOutput setUInt setUInt2 setUInt3 setUInt4 setUIntArray setUIntArray2 setUIntArray3 setUIntArray4 setViewport setZOffset setZOffsetUnits snapshotRenderingReset startTimeQuery stopRenderLoop switchFullscreen unbindAllAttributes unbindAllTextures unBindFramebuffer unbindInstanceAttributes unBindMultiColorAttachmentFramebuffer unRegisterView updateAndBindInstancesBuffer updateArrayBuffer updateDynamicIndexBuffer updateDynamicTexture updateDynamicVertexBuffer updateMultipleRenderTargetTextureSampleCount updateRawCubeTexture updateRawTexture updateRawTexture2DArray updateRawTexture3D updateRenderTargetTextureSampleCount updateTextureArrayLayerFromImageSource updateTextureData updateTextureDimensions updateTextureSamplingMode updateTextureWrappingMode updateUniformBuffer updateVideoTexture wipeCaches DefaultLoadingScreenFactory isSupported MarkAllMaterialsAsDirty
    • 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

      • Optionalantialias: boolean

        defines whether anti-aliasing should be enabled (default value is "undefined", meaning that the browser may or may not enable it)

      • Optionaloptions: EngineOptions

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

      • OptionaladaptToDeviceRatio: boolean

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

      Returns ThinEngine

    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

    currentSampleCount: number

    Gets the number of samples used by the current render target.

    the current sample count, or 1 when multisampling is disabled

    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

    disableUniformBuffers: boolean = false

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

    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

    enableUnpackFlipYCached: boolean = true

    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.

    forcePOTTextures: boolean = false

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

    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.

    validateShaderPrograms: boolean = false

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

    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

    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

    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

    • get activeRenderLoops(): readonly (() => void)[]

      Gets the list of current active render loop functions

      Returns readonly (() => void)[]

      a read only array with the current render loop functions

    • 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

    • 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

    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>

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

    • Parameters

      • textureFormat: number
      • hasDepth: boolean
      • hasStencil: boolean

      Returns number

    • Parameters

      • renderBuffer: Nullable<WebGLRenderbuffer>
      • width: number
      • height: number
      • samples: number
      • internalFormat: number
      • msInternalFormat: number
      • attachment: number
      • unbindBuffer: boolean = true

      Returns Nullable<WebGLRenderbuffer>

    • Attach a new callback raised when context lost event is fired

      Parameters

      • callback: (event: WebGLContextEvent) => void

        defines the callback to call

      Returns void

    • Attach a new callback raised when context restored event is fired

      Parameters

      • callback: (event: WebGLContextEvent) => void

        defines the callback to call

      Returns 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

    • Binds the frame buffer to the specified texture.

      Parameters

      • rtWrapper: RenderTargetWrapper

        The render target wrapper to render to

      • faceIndex: number = 0

        The face of the texture to render to in case of cube texture and if the render target wrapper is not a multi render target

      • 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

      • lodLevel: number = 0

        Defines the lod level to bind to the frame buffer

      • layer: number = 0

        Defines the 2d array index to bind to the frame buffer if the render target wrapper is not a multi render target

      Returns void

    • 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

      • computeStride: boolean = true

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

      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

      • stencil: boolean = false

        defines if the stencil buffer must be cleared

      • stencilClearValue: number = 0

        defines the value to use to clear the stencil buffer (default is 0)

      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

    • 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[] | ThinEngine

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

        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)

      • shaderLanguage: ShaderLanguage = ShaderLanguage.GLSL

        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

    • 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

      • Optionalcontext: WebGLRenderingContext

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

      • transformFeedbackVaryings: Nullable<string[]> = null

        defines the list of transform feedback varyings to use

      Returns WebGLProgram

      the new webGL program

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

    • Creates a webGL program

      Parameters

      • pipelineContext: IPipelineContext

        defines the pipeline context to attach to

      • vertexCode: string

        defines the vertex shader code to use

      • fragmentCode: string

        defines the fragment shader code to use

      • defines: Nullable<string>

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

      • Optionalcontext: WebGLRenderingContext

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

      • transformFeedbackVaryings: Nullable<string[]> = null

        defines the list of transform feedback varyings to use

      Returns WebGLProgram

      the new webGL program

    • 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

      • samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE

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

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

        optional callback to be called upon successful completion

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

        optional callback to be called upon failure

      • buffer: Nullable<
            | string
            | ArrayBuffer
            | ArrayBufferView<ArrayBufferLike>
            | HTMLImageElement
            | ImageBitmap
            | Blob,
        > = null

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

      • fallback: Nullable<InternalTexture> = null

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

      • format: Nullable<number> = null

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

      • forcedExtension: Nullable<string> = null

        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

    • Disable the attribute corresponding to the location in parameter

      Parameters

      • attributeLocation: number

        defines the attribute location of the attribute to disable

      Returns 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

    • Disable the instance attribute corresponding to the name in parameter

      Parameters

      • name: string

        defines the name of the attribute to disable

      Returns 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

      • OptionalinstancesCount: number

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

      Returns 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

      • 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

    • 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

      • OptionalinstancesCount: number

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

      Returns 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

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

    • 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

    • 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 an object containing information about the current engine context

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

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

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

    • 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

      • hasAlpha: boolean = true

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

      • flushRenderer: boolean = true

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

      • data: Nullable<Uint8Array<ArrayBufferLike>> = null

        defines the data to fill with the read pixels (if not provided, a new one will be created)

      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

    • Release and free the memory of a vertex array object

      Parameters

      • vao: WebGLVertexArrayObject

        defines the vertex array object to delete

      Returns void

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

    • 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

      • zOffset: number = 0

        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

      • reverseSide: boolean = false

        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

        stencil states to set

      • zOffsetUnits: number = 0

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

      Returns void

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

      Parameters

      • uniform: Nullable<WebGLUniformLocation>

        defines the webGL uniform location where to store the value

      • value: number

        defines the unsigned int number to store

      Returns boolean

      true if the value was set

    • Set the value of an uniform to a unsigned 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

    • Set the value of an uniform to a unsigned 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

    • Set the value of an uniform to a unsigned 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

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

      Parameters

      • uniform: Nullable<WebGLUniformLocation>

        defines the webGL uniform location where to store the value

      • array: Uint32Array

        defines the array of unsigned int32 to store

      Returns boolean

      true if the value was set

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

      Parameters

      • uniform: Nullable<WebGLUniformLocation>

        defines the webGL uniform location where to store the value

      • array: Uint32Array

        defines the array of unsigned int32 to store

      Returns boolean

      true if the value was set

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

      Parameters

      • uniform: Nullable<WebGLUniformLocation>

        defines the webGL uniform location where to store the value

      • array: Uint32Array

        defines the array of unsigned int32 to store

      Returns boolean

      true if the value was set

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

      Parameters

      • uniform: Nullable<WebGLUniformLocation>

        defines the webGL uniform location where to store the value

      • array: Uint32Array

        defines the array of unsigned int32 to store

      Returns boolean

      true if the value was set

    • 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

    • 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

    • 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

    • 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

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

      • faceIndex: number = 0

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

      • lod: number = 0

        defines the lod level to update (0 by default)

      • generateMipMaps: boolean = false

        defines whether to generate mipmaps or not

      Returns 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

      • OptionalbruteForce: boolean

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

      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