NullEngine | Babylon.js API documentation

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

    Class NullEngine

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

    Hierarchy (View Summary)

    Index
    activeView adaptToDeviceRatio canvasTabIndex cullBackFaces currentRenderPassId currentSampleCount customAnimationFrameRequester disableContextMenu disableManifestCheck disablePerformanceMonitorInBackground disableUniformBuffers disableVertexArrayObjects enableOfflineSupport enableUnpackFlipYCached forcePOTTextures hasOriginBottomLeft hostInformation inputElement isFullscreen isNDCHalfZRange isPointerLock loadingScreen loadingUIBackgroundColor onAfterShaderCompilationObservable onAfterViewRenderObservable onBeforeShaderCompilationObservable onBeforeTextureInitObservable onBeforeViewRenderObservable onBeginFrameObservable onCanvasBlurObservable onCanvasFocusObservable onCanvasPointerOutObservable onContextLostObservable onContextRestoredObservable onDisposeObservable onEffectErrorObservable onEndFrameObservable onNewSceneAddedObservable onReleaseEffectsObservable onResizeObservable postProcesses premultipliedAlpha preventCacheWipeBetweenFrames renderEvenInBackground scenes skipFrameRender startTime textureFormatInUse texturesSupported useExactSrgbConversions validateShaderPrograms views _RescalePostProcessFactory ALPHA_ADD ALPHA_COMBINE ALPHA_DISABLE ALPHA_INTERPOLATE ALPHA_MAXIMIZED ALPHA_MULTIPLY ALPHA_ONEONE ALPHA_PREMULTIPLIED ALPHA_PREMULTIPLIED_PORTERDUFF ALPHA_SCREENMODE ALPHA_SUBTRACT ALWAYS audioEngine AudioEngineFactory CollisionsEpsilon DECR DECR_WRAP DELAYLOADSTATE_LOADED DELAYLOADSTATE_LOADING DELAYLOADSTATE_NONE DELAYLOADSTATE_NOTLOADED EQUAL ExceptionList GEQUAL GREATER INCR INCR_WRAP INVERT KEEP LEQUAL LESS NEVER NOTEQUAL OfflineProviderFactory QueueNewFrame REPLACE SCALEMODE_CEILING SCALEMODE_FLOOR SCALEMODE_NEAREST TEXTURE_BILINEAR_SAMPLINGMODE TEXTURE_CLAMP_ADDRESSMODE TEXTURE_CUBIC_MODE TEXTURE_EQUIRECTANGULAR_MODE TEXTURE_EXPLICIT_MODE TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE TEXTURE_FIXED_EQUIRECTANGULAR_MODE TEXTURE_INVCUBIC_MODE TEXTURE_LINEAR_LINEAR TEXTURE_LINEAR_LINEAR_MIPLINEAR TEXTURE_LINEAR_LINEAR_MIPNEAREST TEXTURE_LINEAR_NEAREST TEXTURE_LINEAR_NEAREST_MIPLINEAR TEXTURE_LINEAR_NEAREST_MIPNEAREST TEXTURE_MIRROR_ADDRESSMODE TEXTURE_NEAREST_LINEAR TEXTURE_NEAREST_LINEAR_MIPLINEAR TEXTURE_NEAREST_LINEAR_MIPNEAREST TEXTURE_NEAREST_NEAREST TEXTURE_NEAREST_NEAREST_MIPLINEAR TEXTURE_NEAREST_NEAREST_MIPNEAREST TEXTURE_NEAREST_SAMPLINGMODE TEXTURE_PLANAR_MODE TEXTURE_PROJECTION_MODE TEXTURE_SKYBOX_MODE TEXTURE_SPHERICAL_MODE TEXTURE_TRILINEAR_SAMPLINGMODE TEXTURE_WRAP_ADDRESSMODE TEXTUREFORMAT_ALPHA TEXTUREFORMAT_LUMINANCE TEXTUREFORMAT_LUMINANCE_ALPHA TEXTUREFORMAT_R TEXTUREFORMAT_R_INTEGER TEXTUREFORMAT_R16_SNORM TEXTUREFORMAT_R16_UNORM TEXTUREFORMAT_RED TEXTUREFORMAT_RED_INTEGER TEXTUREFORMAT_RG TEXTUREFORMAT_RG_INTEGER TEXTUREFORMAT_RG16_SNORM TEXTUREFORMAT_RG16_UNORM TEXTUREFORMAT_RGB TEXTUREFORMAT_RGB_INTEGER TEXTUREFORMAT_RGB16_SNORM TEXTUREFORMAT_RGB16_UNORM TEXTUREFORMAT_RGBA TEXTUREFORMAT_RGBA_INTEGER TEXTUREFORMAT_RGBA16_SNORM TEXTUREFORMAT_RGBA16_UNORM TEXTURETYPE_BYTE TEXTURETYPE_FLOAT TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV TEXTURETYPE_HALF_FLOAT TEXTURETYPE_INT TEXTURETYPE_SHORT TEXTURETYPE_UNSIGNED_BYTE TEXTURETYPE_UNSIGNED_INT TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV TEXTURETYPE_UNSIGNED_INT_24_8 TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV TEXTURETYPE_UNSIGNED_INTEGER TEXTURETYPE_UNSIGNED_SHORT TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 TEXTURETYPE_UNSIGNED_SHORT_5_6_5
    _createDepthStencilCubeTexture _createImageBitmapFromSource _getInternalFormatFromDepthTextureFormat _getWebGLTextureTypeFromDepthTextureFormat _loadFileAsync _updateRenderBuffer applyStates areAllComputeEffectsReady areAllEffectsReady attachContextLostEvent attachContextRestoredEvent beginFrame beginOcclusionQuery beginTransformFeedback bindArrayBuffer bindAttachments bindBuffers bindBuffersDirectly bindFramebuffer bindInstancesBuffer bindMultiviewFramebuffer bindSamplers bindSpaceWarpFramebuffer bindTransformFeedback bindTransformFeedbackBuffer 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 createInstancesBuffer createMaterialContext createMultipleRenderTarget createMultiviewRenderTargetTexture createPipelineContext createPrefilteredCubeTexture createQuery createRawCubeTexture createRawCubeTextureFromUrl createRawShaderProgram createRawTexture createRawTexture2DArray createRawTexture3D createRenderPassId createRenderTargetCubeTexture createRenderTargetTexture createShaderProgram createTexture createTransformFeedback createUniformBuffer createVertexBuffer createVideoElement deleteInstancesBuffer deleteQuery deleteTransformFeedback disableAttributeByIndex disableInstanceAttribute disableInstanceAttributeByName disableScissor displayLoadingUI dispose draw drawArraysType drawElementsType drawPointClouds drawUnIndexed enableEffect enableScissor endFrame endOcclusionQuery endTimeQuery endTransformFeedback enterFullscreen enterPointerlock exitFullscreen exitPointerlock extractDriverInfo flushFramebuffer generateMipmaps generateMipMapsForCubemap generateMipMapsFramebuffer generateMipMapsMultiFramebuffer getAlphaEquation getAlphaMode getAlphaToCoverage getAspectRatio getAttributes getAudioContext getAudioDestination getCaps getClassName getColorWrite getCreationOptions getCurrentRenderPassName getDeltaTime getDepthBuffer getDepthFunction getDepthWrite getFontOffset getFps getFragmentShaderSource 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 getVertexShaderSource getZOffset getZOffsetUnits hideLoadingUI inlineShaderCode isDeterministicLockStep isOcclusionQueryVisible isQueryResultAvailable readPixels readTransformFeedbackBuffer recordVertexArrayObject registerView releaseComputeEffects releaseEffects releaseRenderPassId releaseVertexArrayObject resetTextureCache resize resizeImageBitmap resolveFramebuffer resolveMultiFramebuffer restoreDefaultFramebuffer restoreSingleAttachment restoreSingleAttachmentForRenderTarget restoreStencilState runRenderLoop scissorClear setAlphaConstants setAlphaEquation setAlphaMode setAlphaToCoverage setArray setArray2 setArray3 setArray4 setBool setColorWrite setCompressedTextureExclusions setDepthBuffer setDepthFunction setDepthFunctionToGreater setDepthFunctionToGreaterOrEqual setDepthFunctionToLess setDepthFunctionToLessOrEqual setDepthStencilTexture setDepthWrite setDirectViewport setDitheringState setFloat setFloat2 setFloat3 setFloat4 setFloatArray setFloatArray2 setFloatArray3 setFloatArray4 setHardwareScalingLevel setInt setInt2 setInt3 setInt4 setIntArray setIntArray2 setIntArray3 setIntArray4 setMatrices setMatrix2x2 setMatrix3x3 setRasterizerState setSize setState setStateCullFaceType setStencilBackFunction setStencilBackOperationDepthFail setStencilBackOperationFail setStencilBackOperationPass setStencilBuffer setStencilFunction setStencilFunctionMask setStencilFunctionReference setStencilMask setStencilOperationDepthFail setStencilOperationFail setStencilOperationPass setTexture setTextureArray setTextureFormatToUse setTextureFromPostProcess setTextureFromPostProcessOutput setTranformFeedbackVaryings 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 updateTextureComparisonFunction updateTextureData updateTextureDimensions updateTextureSamplingMode updateTextureWrappingMode updateUniformBuffer updateVideoTexture updateWrappedWebGLTexture wipeCaches wrapWebGLTexture DefaultLoadingScreenFactory isSupported MarkAllMaterialsAsDirty
    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

    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.

    ALPHA_ADD: 1 = Constants.ALPHA_ADD

    Defines that alpha blending to SRC ALPHA * SRC + DEST

    ALPHA_COMBINE: 2 = Constants.ALPHA_COMBINE

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

    ALPHA_DISABLE: 0 = Constants.ALPHA_DISABLE

    Defines that alpha blending is disabled

    ALPHA_INTERPOLATE: 9 = Constants.ALPHA_INTERPOLATE

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

    ALPHA_MAXIMIZED: 5 = Constants.ALPHA_MAXIMIZED

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

    ALPHA_MULTIPLY: 4 = Constants.ALPHA_MULTIPLY

    Defines that alpha blending to SRC * DEST

    ALPHA_ONEONE: 6 = Constants.ALPHA_ONEONE

    Defines that alpha blending to SRC + DEST

    ALPHA_PREMULTIPLIED: 7 = Constants.ALPHA_PREMULTIPLIED

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

    ALPHA_PREMULTIPLIED_PORTERDUFF: 8 = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF

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

    ALPHA_SCREENMODE: 10 = Constants.ALPHA_SCREENMODE

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

    ALPHA_SUBTRACT: 3 = Constants.ALPHA_SUBTRACT

    Defines that alpha blending to DEST - SRC * DEST

    ALWAYS: 519 = Constants.ALWAYS

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

    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

    DECR: 7683 = Constants.DECR

    Passed to stencilOperation to specify that stencil value must be decremented

    DECR_WRAP: 34056 = Constants.DECR_WRAP

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

    DELAYLOADSTATE_LOADED: 1 = Constants.DELAYLOADSTATE_LOADED

    Defines that the resource was successfully delay loaded

    DELAYLOADSTATE_LOADING: 2 = Constants.DELAYLOADSTATE_LOADING

    Defines that the resource is currently delay loading

    DELAYLOADSTATE_NONE: 0 = Constants.DELAYLOADSTATE_NONE

    Defines that the resource is not delayed

    DELAYLOADSTATE_NOTLOADED: 4 = Constants.DELAYLOADSTATE_NOTLOADED

    Defines that the resource is delayed and has not started loading

    EQUAL: 514 = Constants.EQUAL

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

    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

    GEQUAL: 518 = Constants.GEQUAL

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

    GREATER: 516 = Constants.GREATER

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

    INCR: 7682 = Constants.INCR

    Passed to stencilOperation to specify that stencil value must be incremented

    INCR_WRAP: 34055 = Constants.INCR_WRAP

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

    INVERT: 5386 = Constants.INVERT

    Passed to stencilOperation to specify that stencil value must be inverted

    KEEP: 7680 = Constants.KEEP

    Passed to stencilOperation to specify that stencil value must be kept

    LEQUAL: 515 = Constants.LEQUAL

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

    LESS: 513 = Constants.LESS

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

    NEVER: 512 = Constants.NEVER

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

    NOTEQUAL: 517 = Constants.NOTEQUAL

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

    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

    REPLACE: 7681 = Constants.REPLACE

    Passed to stencilOperation to specify that stencil value must be replaced

    SCALEMODE_CEILING: 3 = Constants.SCALEMODE_CEILING

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

    SCALEMODE_FLOOR: 1 = Constants.SCALEMODE_FLOOR

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

    SCALEMODE_NEAREST: 2 = Constants.SCALEMODE_NEAREST

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

    TEXTURE_BILINEAR_SAMPLINGMODE: 2 = Constants.TEXTURE_BILINEAR_SAMPLINGMODE

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

    TEXTURE_CLAMP_ADDRESSMODE: 0 = Constants.TEXTURE_CLAMP_ADDRESSMODE

    Texture is not repeating outside of 0..1 UVs

    TEXTURE_CUBIC_MODE: 3 = Constants.TEXTURE_CUBIC_MODE

    Cubic coordinates mode

    TEXTURE_EQUIRECTANGULAR_MODE: 7 = Constants.TEXTURE_EQUIRECTANGULAR_MODE

    Equirectangular coordinates mode

    TEXTURE_EXPLICIT_MODE: 0 = Constants.TEXTURE_EXPLICIT_MODE

    Explicit coordinates mode

    TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE: 9 = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE

    Equirectangular Fixed Mirrored coordinates mode

    TEXTURE_FIXED_EQUIRECTANGULAR_MODE: 8 = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE

    Equirectangular Fixed coordinates mode

    TEXTURE_INVCUBIC_MODE: 6 = Constants.TEXTURE_INVCUBIC_MODE

    Inverse Cubic coordinates mode

    TEXTURE_LINEAR_LINEAR: 2 = Constants.TEXTURE_LINEAR_LINEAR

    mag = linear and min = linear and mip = none

    TEXTURE_LINEAR_LINEAR_MIPLINEAR: 3 = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR

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

    TEXTURE_LINEAR_LINEAR_MIPNEAREST: 11 = Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST

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

    TEXTURE_LINEAR_NEAREST: 12 = Constants.TEXTURE_LINEAR_NEAREST

    mag = linear and min = nearest and mip = none

    TEXTURE_LINEAR_NEAREST_MIPLINEAR: 10 = Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR

    mag = linear and min = nearest and mip = linear

    TEXTURE_LINEAR_NEAREST_MIPNEAREST: 9 = Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST

    mag = linear and min = nearest and mip = nearest

    TEXTURE_MIRROR_ADDRESSMODE: 2 = Constants.TEXTURE_MIRROR_ADDRESSMODE

    Texture is repeating and mirrored

    TEXTURE_NEAREST_LINEAR: 7 = Constants.TEXTURE_NEAREST_LINEAR

    mag = nearest and min = linear and mip = none

    TEXTURE_NEAREST_LINEAR_MIPLINEAR: 6 = Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR

    mag = nearest and min = linear and mip = linear

    TEXTURE_NEAREST_LINEAR_MIPNEAREST: 5 = Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST

    mag = nearest and min = linear and mip = nearest

    TEXTURE_NEAREST_NEAREST: 1 = Constants.TEXTURE_NEAREST_NEAREST

    mag = nearest and min = nearest and mip = none

    TEXTURE_NEAREST_NEAREST_MIPLINEAR: 8 = Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR

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

    TEXTURE_NEAREST_NEAREST_MIPNEAREST: 4 = Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST

    mag = nearest and min = nearest and mip = nearest

    TEXTURE_NEAREST_SAMPLINGMODE: 1 = Constants.TEXTURE_NEAREST_SAMPLINGMODE

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

    TEXTURE_PLANAR_MODE: 2 = Constants.TEXTURE_PLANAR_MODE

    Planar coordinates mode

    TEXTURE_PROJECTION_MODE: 4 = Constants.TEXTURE_PROJECTION_MODE

    Projection coordinates mode

    TEXTURE_SKYBOX_MODE: 5 = Constants.TEXTURE_SKYBOX_MODE

    Skybox coordinates mode

    TEXTURE_SPHERICAL_MODE: 1 = Constants.TEXTURE_SPHERICAL_MODE

    Spherical coordinates mode

    TEXTURE_TRILINEAR_SAMPLINGMODE: 3 = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE

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

    TEXTURE_WRAP_ADDRESSMODE: 1 = Constants.TEXTURE_WRAP_ADDRESSMODE

    Texture is repeating outside of 0..1 UVs

    TEXTUREFORMAT_ALPHA: 0 = Constants.TEXTUREFORMAT_ALPHA

    ALPHA

    TEXTUREFORMAT_LUMINANCE: 1 = Constants.TEXTUREFORMAT_LUMINANCE

    LUMINANCE

    TEXTUREFORMAT_LUMINANCE_ALPHA: 2 = Constants.TEXTUREFORMAT_LUMINANCE_ALPHA

    LUMINANCE_ALPHA

    TEXTUREFORMAT_R: 6 = Constants.TEXTUREFORMAT_R

    RED (2nd reference)

    TEXTUREFORMAT_R_INTEGER: 8 = Constants.TEXTUREFORMAT_R_INTEGER

    RED_INTEGER (2nd reference)

    TEXTUREFORMAT_R16_SNORM: 36760 = Constants.TEXTUREFORMAT_R16_SNORM

    RED signed short normed to [-1, 1] *

    TEXTUREFORMAT_R16_UNORM: 33322 = Constants.TEXTUREFORMAT_R16_UNORM

    RED unsigned short normed to [0, 1] *

    TEXTUREFORMAT_RED: 6 = Constants.TEXTUREFORMAT_RED

    RED

    TEXTUREFORMAT_RED_INTEGER: 8 = Constants.TEXTUREFORMAT_RED_INTEGER

    RED_INTEGER

    TEXTUREFORMAT_RG: 7 = Constants.TEXTUREFORMAT_RG

    RG

    TEXTUREFORMAT_RG_INTEGER: 9 = Constants.TEXTUREFORMAT_RG_INTEGER

    RG_INTEGER

    TEXTUREFORMAT_RG16_SNORM: 36761 = Constants.TEXTUREFORMAT_RG16_SNORM

    RG signed short normed to [-1, 1] *

    TEXTUREFORMAT_RG16_UNORM: 33324 = Constants.TEXTUREFORMAT_RG16_UNORM

    RG unsigned short normed to [0, 1] *

    TEXTUREFORMAT_RGB: 4 = Constants.TEXTUREFORMAT_RGB

    RGB

    TEXTUREFORMAT_RGB_INTEGER: 10 = Constants.TEXTUREFORMAT_RGB_INTEGER

    RGB_INTEGER

    TEXTUREFORMAT_RGB16_SNORM: 36762 = Constants.TEXTUREFORMAT_RGB16_SNORM

    RGB signed short normed to [-1, 1] *

    TEXTUREFORMAT_RGB16_UNORM: 32852 = Constants.TEXTUREFORMAT_RGB16_UNORM

    RGB unsigned short normed to [0, 1] *

    TEXTUREFORMAT_RGBA: 5 = Constants.TEXTUREFORMAT_RGBA

    RGBA

    TEXTUREFORMAT_RGBA_INTEGER: 11 = Constants.TEXTUREFORMAT_RGBA_INTEGER

    RGBA_INTEGER

    TEXTUREFORMAT_RGBA16_SNORM: 36763 = Constants.TEXTUREFORMAT_RGBA16_SNORM

    RGBA signed short normed to [-1, 1] *

    TEXTUREFORMAT_RGBA16_UNORM: 32859 = Constants.TEXTUREFORMAT_RGBA16_UNORM

    RGBA unsigned short normed to [0, 1] *

    TEXTURETYPE_BYTE: 3 = Constants.TEXTURETYPE_BYTE

    BYTE

    TEXTURETYPE_FLOAT: 1 = Constants.TEXTURETYPE_FLOAT

    FLOAT

    TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV: 15 = Constants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV

    FLOAT_32_UNSIGNED_INT_24_8_REV

    TEXTURETYPE_HALF_FLOAT: 2 = Constants.TEXTURETYPE_HALF_FLOAT

    HALF_FLOAT

    TEXTURETYPE_INT: 6 = Constants.TEXTURETYPE_INT

    INT

    TEXTURETYPE_SHORT: 4 = Constants.TEXTURETYPE_SHORT

    SHORT

    TEXTURETYPE_UNSIGNED_BYTE: 0 = Constants.TEXTURETYPE_UNSIGNED_BYTE

    UNSIGNED_BYTE

    TEXTURETYPE_UNSIGNED_INT: 0 = Constants.TEXTURETYPE_UNSIGNED_INT

    use more explicit TEXTURETYPE_UNSIGNED_BYTE instead. Use TEXTURETYPE_UNSIGNED_INTEGER for 32bits values.

    TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV: 13 = Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV

    UNSIGNED_INT_10F_11F_11F_REV

    TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV: 11 = Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV

    UNSIGNED_INT_2_10_10_10_REV

    TEXTURETYPE_UNSIGNED_INT_24_8: 12 = Constants.TEXTURETYPE_UNSIGNED_INT_24_8

    UNSIGNED_INT_24_8

    TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV: 14 = Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV

    UNSIGNED_INT_5_9_9_9_REV

    TEXTURETYPE_UNSIGNED_INTEGER: 7 = Constants.TEXTURETYPE_UNSIGNED_INTEGER

    UNSIGNED_INT

    TEXTURETYPE_UNSIGNED_SHORT: 5 = Constants.TEXTURETYPE_UNSIGNED_SHORT

    UNSIGNED_SHORT

    TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4: 8 = Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4

    UNSIGNED_SHORT_4_4_4_4

    TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1: 9 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1

    UNSIGNED_SHORT_5_5_5_1

    TEXTURETYPE_UNSIGNED_SHORT_5_6_5: 10 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5

    UNSIGNED_SHORT_5_6_5

    • 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 Will fallback to the gl object

      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 supportsUniformBuffers(): boolean

      Gets a boolean indicating that the engine supports uniform buffers. Reports true when NullEngineOptions.enableMultiview is set: the multiview scene UBO is the only path that uploads the per-eye viewProjectionR matrix, so multiview is meaningless without uniform-buffer support. This mirrors real engines, where multiview (OVR_multiview2) implies WebGL2, which always supports uniform buffers.

      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>

      ImageBitmap

    • Parameters

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

      Returns Nullable<WebGLRenderbuffer>

    • 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

      • 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

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

      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)

      • compression: Nullable<string> = null

        defines the compression used (null by default)

      • type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE

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

      • creationFlags: number = 0

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

      • useSRGBBuffer: boolean = false

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

      Returns InternalTexture

      the raw texture inside an InternalTexture

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

      Returns WebGLProgram

      the new webGL program

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

      Parameters

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

      Returns InternalTexture

      a InternalTexture for assignment back into BABYLON.Texture

    • 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

    • Get Font size information

      Parameters

      • font: string

        font name

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

      an object containing ascent, height and descent

    • 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

    • 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

    • Resize an image and returns the image data as an uint8array

      Parameters

      • image: HTMLImageElement | ImageBitmap

        image to resize

      • bufferWidth: number

        destination buffer width

      • bufferHeight: number

        destination buffer height

      Returns Uint8Array

      an uint8array containing RGBA values of bufferWidth * bufferHeight size

    • Executes a scissor clear (ie. a clear on a specific portion of the screen)

      Parameters

      • x: number

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

      • y: number

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

      • width: number

        defines the width of the clear rectangle

      • height: number

        defines the height of the clear rectangle

      • clearColor: IColor4Like

        defines the clear color

      Returns void

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: number[]

        defines the array of number to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: number[]

        defines the array of number to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: number[]

        defines the array of number to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: number[]

        defines the array of number to store

      Returns boolean

      true if value was set

    • Set the value of an uniform to a boolean

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • bool: number

        defines the boolean to store

      Returns boolean

      true if value was set

    • Directly set the WebGL Viewport

      Parameters

      • x: number

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

      • y: number

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

      • width: number

        defines the width of the viewport (in screen space)

      • height: number

        defines the height of the viewport (in screen space)

      Returns Nullable<IViewportLike>

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

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • value: number

        defines the float number to store

      Returns boolean

      true if value was set

    • Set the value of an uniform to a vec2

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • x: number

        defines the 1st component of the value

      • y: number

        defines the 2nd component of the value

      Returns boolean

      true if value was set

    • Set the value of an uniform to a vec3

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • x: number

        defines the 1st component of the value

      • y: number

        defines the 2nd component of the value

      • z: number

        defines the 3rd component of the value

      Returns boolean

      true if value was set

    • Set the value of an uniform to a vec4

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • x: number

        defines the 1st component of the value

      • y: number

        defines the 2nd component of the value

      • z: number

        defines the 3rd component of the value

      • w: number

        defines the 4th component of the value

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: Float32Array

        defines the array of float32 to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: Float32Array

        defines the array of float32 to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: Float32Array

        defines the array of float32 to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: Float32Array

        defines the array of float32 to store

      Returns boolean

      true if 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: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: Int32Array

        defines the array of int32 to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: Int32Array

        defines the array of int32 to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: Int32Array

        defines the array of int32 to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • array: Int32Array

        defines the array of int32 to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • matrices: Float32Array

        defines the array of float32 to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • matrix: Float32Array

        defines the Float32Array representing the 2x2 matrix to store

      Returns boolean

      true if value was set

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

      Parameters

      • uniform: WebGLUniformLocation

        defines the webGL uniform location where to store the value

      • matrix: Float32Array

        defines the Float32Array representing the 3x3 matrix to store

      Returns boolean

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

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

      • rtWrapper: RenderTargetWrapper

        defines the render target wrapper to unbind

      • disableGenerateMipMaps: boolean = false

        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

      • canvas: HTMLCanvasElement

        defines the canvas containing the source

      • invertY: boolean

        defines if data must be stored with Y axis inverted

      • premulAlpha: boolean = false

        defines if alpha is stored as premultiplied

      • Optionalformat: number

        defines the format of the data

      Returns void

    • Updates a dynamic vertex buffer.

      Parameters

      • vertexBuffer: WebGLBuffer

        the vertex buffer to update

      • vertices: FloatArray

        the data used to update the vertex buffer

      • OptionalbyteOffset: number

        the byte offset of the data (optional)

      • OptionalbyteLength: number

        the byte length of the data (optional)

      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

      • compression: Nullable<string> = null

        defines the compression used (null by default)

      • type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE

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

      • useSRGBBuffer: boolean = false

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

      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

    • Updates a depth texture Comparison Mode and Function. If the comparison Function is equal to 0, the mode will be set to none. Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.

      Parameters

      • texture: InternalTexture

        The texture to set the comparison function for

      • comparisonFunction: number

        The comparison function to set, 0 if no comparison required

      Returns void

    • 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

    • Replaces the underlying WebGL handle of a texture previously created via wrapWebGLTexture, preserving the InternalTexture identity.

      Intended for the context-loss / context-restored flow: when the host application recreates its external resource on the new WebGL context, it calls this method to repoint Babylon's wrapper at the new handle without losing references held by materials, render-target wrappers, particle systems, etc.

      The new handle must describe a texture with the same dimensions the wrapped texture was created with. A WebGL handle is opaque (the dimensions can't be introspected), so we can't validate this -- passing a mismatched handle is undefined behaviour. Sampling mode and mip-map flag are properties of the logical wrapped texture and are re-applied to the new resource. Any render-target wrapper holding this texture as its color attachment has its framebuffer rebuilt with the new handle (including a fresh depth/stencil renderbuffer, since the old one came from the dead context). If the wrapper is multisampled, the MSAA framebuffer + color renderbuffer + MSAA depth/stencil buffer are rebuilt too.

      Throws if the target was not produced by wrapWebGLTexture, if the wrapped texture is part of a multi render-target wrapper, or if the wrapper has a depth/stencil texture (these are not supported in this version; dispose and re-wrap).

      Parameters

      • internalTexture: InternalTexture

        defines the wrapped InternalTexture to repoint

      • texture: WebGLTexture

        defines the new WebGL handle to wrap

      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

    • Wraps an external web gl texture in a Babylon texture.

      Parameters

      • texture: WebGLTexture

        defines the external texture

      • hasMipMaps: boolean = false

        defines whether the external texture has mip maps (default: false)

      • samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE

        defines the sampling mode for the external texture (default: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE)

      • width: number = 0

        defines the width for the external texture (default: 0)

      • height: number = 0

        defines the height for the external texture (default: 0)

      Returns InternalTexture

      the babylon internal texture

    • 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