Class NullEngine
Hierarchy (View Summary)
- Engine
- NullEngine
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Parameters
- options: NullEngineOptions = ...
Returns NullEngine
Properties
active View
Gets the current engine view
adapt To Device Ratio
If set to true zooming in and out in the browser will rescale the hardware-scaling correctly.
canvas Tab Index
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
cull Back Faces
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
current Render Pass Id
Gets or sets the current render pass id
Readonlycurrent Sample Count
Gets the number of samples used by the current render target.
custom Animation Frame Requester
If set, will be used to request the next animation frame for the render loop
disable Context Menu
Gets or sets a boolean to enable/disable the context menu (right-click) from appearing on the main canvas
disable Manifest Check
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)
disable Performance Monitor In Background
Turn this value on if you want to pause FPS computation when in background
disable Uniform Buffers
Gets or sets a boolean indicating that uniform buffers must be disabled even if they are supported
disable Vertex Array Objects
Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported
enable Offline Support
Gets or sets a boolean to enable/disable IndexedDB support and avoid XHR on .manifest
enable Unpack Flip Y Cached
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.
force POT Textures
Gets or sets a boolean that indicates if textures must be forced to power of 2 size even if not required
Readonlyhas Origin Bottom Left
Indicates that the origin of the texture/framebuffer space is the bottom left corner. If false, the origin is top left
host Information
Gets information about the current host
input Element
Gets or sets the HTML element to use for attaching events
is Fullscreen
Gets a boolean indicating if the engine is currently rendering in fullscreen mode
Readonlyis NDC Half Z Range
Indicates if the z range in NDC space is 0..1 (value: true) or -1..1 (value: false)
is Pointer Lock
Gets a boolean indicating if the pointer is currently locked
loading Screen
Gets or sets the current loading screen object
loading UI Background Color
Sets the current loading screen background color
on After Shader Compilation Observable
Observable raised when the engine has just compiled a shader
Readonlyon After View Render Observable
Will be triggered after the view rendered
on Before Shader Compilation Observable
Observable raised when the engine is about to compile a shader
on Before Texture Init Observable
Observable event triggered before each texture is initialized
Readonlyon Before View Render Observable
Will be triggered before the view renders
on Begin Frame Observable
Observable raised when the engine begins a new frame
on Canvas Blur Observable
Observable event triggered each time the canvas loses focus
on Canvas Focus Observable
Observable event triggered each time the canvas gains focus
on Canvas Pointer Out Observable
Observable event triggered each time the canvas receives pointerout event
on Context Lost Observable
Observable signaled when a context lost event is raised
on Context Restored Observable
Observable signaled when a context restored event is raised
Readonlyon Dispose Observable
An event triggered when the engine is disposed.
on Effect Error Observable
Observable event triggered each time an effect compilation fails
on End Frame Observable
Observable raised when the engine ends the current frame (requires a render loop, e.g. 'engine.runRenderLoop(...)')
on New Scene Added Observable
Event raised when a new scene is created
Readonlyon Release Effects Observable
An event triggered when a global cleanup of all effects is required
on Resize Observable
Observable event triggered each time the rendering canvas is resized
post Processes
Gets the list of created postprocesses
premultiplied Alpha
Defines whether the engine has been created with the premultipliedAlpha option on or not.
prevent Cache Wipe Between Frames
Gets or sets a boolean indicating that cache can be kept between frames
render Even In Background
Gets or sets a boolean indicating if the engine must keep rendering even if the window is not in foreground
scenes
Gets the list of created scenes
skip Frame Render
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)
Readonlystart Time
The time (in milliseconds elapsed since the current page has been loaded) when the engine was initialized
Readonlytexture Format In Use
Gets the texture format in use
Readonlytextures Supported
Gets the list of texture formats supported
Readonlyuse Exact Srgb Conversions
Gets a boolean indicating if the exact sRGB conversions or faster approximations are used for converting to and from linear space.
validate Shader Programs
Gets or sets a boolean indicating if the engine should validate programs after compilation
views
Gets or sets the list of views
Static_ Rescale Post Process Factory
Method called to create the default rescale post process on each engine.
Static ReadonlyALPHA_ ADD
Defines that alpha blending to SRC ALPHA * SRC + DEST
Static ReadonlyALPHA_ COMBINE
Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST
Static ReadonlyALPHA_ DISABLE
Defines that alpha blending is disabled
Static ReadonlyALPHA_ INTERPOLATE
Defines that alpha blending to CST * SRC + (1 - CST) * DEST
Static ReadonlyALPHA_ MAXIMIZED
Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST
Static ReadonlyALPHA_ MULTIPLY
Defines that alpha blending to SRC * DEST
Static ReadonlyALPHA_ ONEONE
Defines that alpha blending to SRC + DEST
Static ReadonlyALPHA_ PREMULTIPLIED
Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST
Static ReadonlyALPHA_ PREMULTIPLIED_ PORTERDUFF
Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA
Static ReadonlyALPHA_ SCREENMODE
Defines that alpha blending to SRC + (1 - SRC) * DEST Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA
Static ReadonlyALPHA_ SUBTRACT
Defines that alpha blending to DEST - SRC * DEST
Static ReadonlyALWAYS
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
Staticaudio Engine
Gets the audio engine
StaticAudio Engine Factory
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.
StaticCollisions Epsilon
Gets or sets the epsilon value used by collision engine
Static ReadonlyDECR
Passed to stencilOperation to specify that stencil value must be decremented
Static ReadonlyDECR_ WRAP
Passed to stencilOperation to specify that stencil value must be decremented with wrapping
Static ReadonlyDELAYLOADSTATE_ LOADED
Defines that the resource was successfully delay loaded
Static ReadonlyDELAYLOADSTATE_ LOADING
Defines that the resource is currently delay loading
Static ReadonlyDELAYLOADSTATE_ NONE
Defines that the resource is not delayed
Static ReadonlyDELAYLOADSTATE_ NOTLOADED
Defines that the resource is delayed and has not started loading
Static ReadonlyEQUAL
Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value
StaticException List
| {
capture: string;
captureConstraint: number;
key: string;
targets: string[];
}
| {
capture: null;
captureConstraint: null;
key: string;
targets: string[];
}
)[] = ...
Use this array to turn off some WebGL2 features on known buggy browsers version
Static ReadonlyGEQUAL
Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value
Static ReadonlyGREATER
Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value
Static ReadonlyINCR
Passed to stencilOperation to specify that stencil value must be incremented
Static ReadonlyINCR_ WRAP
Passed to stencilOperation to specify that stencil value must be incremented with wrapping
Static ReadonlyINVERT
Passed to stencilOperation to specify that stencil value must be inverted
Static ReadonlyKEEP
Passed to stencilOperation to specify that stencil value must be kept
Static ReadonlyLEQUAL
Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value
Static ReadonlyLESS
Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value
Static ReadonlyNEVER
Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn
Static ReadonlyNOTEQUAL
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
StaticOffline Provider Factory
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.
StaticQueue New Frame
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: anythe object that will request the next frame. Falls back to window.
Returns number
frame number
- func: () => void
Static ReadonlyREPLACE
Passed to stencilOperation to specify that stencil value must be replaced
Static ReadonlySCALEMODE_ CEILING
Defines that texture rescaling will use a ceil to find the closer power of 2 size
Static ReadonlySCALEMODE_ FLOOR
Defines that texture rescaling will use a floor to find the closer power of 2 size
Static ReadonlySCALEMODE_ NEAREST
Defines that texture rescaling will look for the nearest power of 2 size
Static ReadonlyTEXTURE_ BILINEAR_ SAMPLINGMODE
Bilinear is mag = linear and min = linear and mip = nearest
Static ReadonlyTEXTURE_ CLAMP_ ADDRESSMODE
Texture is not repeating outside of 0..1 UVs
Static ReadonlyTEXTURE_ CUBIC_ MODE
Cubic coordinates mode
Static ReadonlyTEXTURE_ EQUIRECTANGULAR_ MODE
Equirectangular coordinates mode
Static ReadonlyTEXTURE_ EXPLICIT_ MODE
Explicit coordinates mode
Static ReadonlyTEXTURE_ FIXED_ EQUIRECTANGULAR_ MIRRORED_ MODE
Equirectangular Fixed Mirrored coordinates mode
Static ReadonlyTEXTURE_ FIXED_ EQUIRECTANGULAR_ MODE
Equirectangular Fixed coordinates mode
Static ReadonlyTEXTURE_ INVCUBIC_ MODE
Inverse Cubic coordinates mode
Static ReadonlyTEXTURE_ LINEAR_ LINEAR
mag = linear and min = linear and mip = none
Static ReadonlyTEXTURE_ LINEAR_ LINEAR_ MIPLINEAR
Trilinear is mag = linear and min = linear and mip = linear
Static ReadonlyTEXTURE_ LINEAR_ LINEAR_ MIPNEAREST
Bilinear is mag = linear and min = linear and mip = nearest
Static ReadonlyTEXTURE_ LINEAR_ NEAREST
mag = linear and min = nearest and mip = none
Static ReadonlyTEXTURE_ LINEAR_ NEAREST_ MIPLINEAR
mag = linear and min = nearest and mip = linear
Static ReadonlyTEXTURE_ LINEAR_ NEAREST_ MIPNEAREST
mag = linear and min = nearest and mip = nearest
Static ReadonlyTEXTURE_ MIRROR_ ADDRESSMODE
Texture is repeating and mirrored
Static ReadonlyTEXTURE_ NEAREST_ LINEAR
mag = nearest and min = linear and mip = none
Static ReadonlyTEXTURE_ NEAREST_ LINEAR_ MIPLINEAR
mag = nearest and min = linear and mip = linear
Static ReadonlyTEXTURE_ NEAREST_ LINEAR_ MIPNEAREST
mag = nearest and min = linear and mip = nearest
Static ReadonlyTEXTURE_ NEAREST_ NEAREST
mag = nearest and min = nearest and mip = none
Static ReadonlyTEXTURE_ NEAREST_ NEAREST_ MIPLINEAR
nearest is mag = nearest and min = nearest and mip = linear
Static ReadonlyTEXTURE_ NEAREST_ NEAREST_ MIPNEAREST
mag = nearest and min = nearest and mip = nearest
Static ReadonlyTEXTURE_ NEAREST_ SAMPLINGMODE
nearest is mag = nearest and min = nearest and mip = none
Static ReadonlyTEXTURE_ PLANAR_ MODE
Planar coordinates mode
Static ReadonlyTEXTURE_ PROJECTION_ MODE
Projection coordinates mode
Static ReadonlyTEXTURE_ SKYBOX_ MODE
Skybox coordinates mode
Static ReadonlyTEXTURE_ SPHERICAL_ MODE
Spherical coordinates mode
Static ReadonlyTEXTURE_ TRILINEAR_ SAMPLINGMODE
Trilinear is mag = linear and min = linear and mip = linear
Static ReadonlyTEXTURE_ WRAP_ ADDRESSMODE
Texture is repeating outside of 0..1 UVs
Static ReadonlyTEXTUREFORMAT_ ALPHA
ALPHA
Static ReadonlyTEXTUREFORMAT_ LUMINANCE
LUMINANCE
Static ReadonlyTEXTUREFORMAT_ LUMINANCE_ ALPHA
LUMINANCE_ALPHA
Static ReadonlyTEXTUREFORMAT_ R
RED (2nd reference)
Static ReadonlyTEXTUREFORMAT_ R_ INTEGER
RED_INTEGER (2nd reference)
Static ReadonlyTEXTUREFORMAT_ R16_ SNORM
RED signed short normed to [-1, 1] *
Static ReadonlyTEXTUREFORMAT_ R16_ UNORM
RED unsigned short normed to [0, 1] *
Static ReadonlyTEXTUREFORMAT_ RED
RED
Static ReadonlyTEXTUREFORMAT_ RED_ INTEGER
RED_INTEGER
Static ReadonlyTEXTUREFORMAT_ RG
RG
Static ReadonlyTEXTUREFORMAT_ RG_ INTEGER
RG_INTEGER
Static ReadonlyTEXTUREFORMAT_ RG16_ SNORM
RG signed short normed to [-1, 1] *
Static ReadonlyTEXTUREFORMAT_ RG16_ UNORM
RG unsigned short normed to [0, 1] *
Static ReadonlyTEXTUREFORMAT_ RGB
RGB
Static ReadonlyTEXTUREFORMAT_ RGB_ INTEGER
RGB_INTEGER
Static ReadonlyTEXTUREFORMAT_ RGB16_ SNORM
RGB signed short normed to [-1, 1] *
Static ReadonlyTEXTUREFORMAT_ RGB16_ UNORM
RGB unsigned short normed to [0, 1] *
Static ReadonlyTEXTUREFORMAT_ RGBA
RGBA
Static ReadonlyTEXTUREFORMAT_ RGBA_ INTEGER
RGBA_INTEGER
Static ReadonlyTEXTUREFORMAT_ RGBA16_ SNORM
RGBA signed short normed to [-1, 1] *
Static ReadonlyTEXTUREFORMAT_ RGBA16_ UNORM
RGBA unsigned short normed to [0, 1] *
Static ReadonlyTEXTURETYPE_ BYTE
BYTE
Static ReadonlyTEXTURETYPE_ FLOAT
FLOAT
Static ReadonlyTEXTURETYPE_ FLOAT_ 32_ UNSIGNED_ INT_ 24_ 8_ REV
FLOAT_32_UNSIGNED_INT_24_8_REV
Static ReadonlyTEXTURETYPE_ HALF_ FLOAT
HALF_FLOAT
Static ReadonlyTEXTURETYPE_ INT
INT
Static ReadonlyTEXTURETYPE_ SHORT
SHORT
Static ReadonlyTEXTURETYPE_ UNSIGNED_ BYTE
UNSIGNED_BYTE
Static ReadonlyTEXTURETYPE_ UNSIGNED_ INT
Static ReadonlyTEXTURETYPE_ UNSIGNED_ INT_ 10 F_ 11 F_ 11 F_ REV
UNSIGNED_INT_10F_11F_11F_REV
Static ReadonlyTEXTURETYPE_ UNSIGNED_ INT_ 2_ 10_ 10_ 10_ REV
UNSIGNED_INT_2_10_10_10_REV
Static ReadonlyTEXTURETYPE_ UNSIGNED_ INT_ 24_ 8
UNSIGNED_INT_24_8
Static ReadonlyTEXTURETYPE_ UNSIGNED_ INT_ 5_ 9_ 9_ 9_ REV
UNSIGNED_INT_5_9_9_9_REV
Static ReadonlyTEXTURETYPE_ UNSIGNED_ INTEGER
UNSIGNED_INT
Static ReadonlyTEXTURETYPE_ UNSIGNED_ SHORT
UNSIGNED_SHORT
Static ReadonlyTEXTURETYPE_ UNSIGNED_ SHORT_ 4_ 4_ 4_ 4
UNSIGNED_SHORT_4_4_4_4
Static ReadonlyTEXTURETYPE_ UNSIGNED_ SHORT_ 5_ 5_ 5_ 1
UNSIGNED_SHORT_5_5_5_1
Static ReadonlyTEXTURETYPE_ UNSIGNED_ SHORT_ 5_ 6_ 5
UNSIGNED_SHORT_5_6_5
Accessors
active Render Loops
-
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
alpha State
-
get alphaState(): AlphaState
Gets the alpha state manager
Returns AlphaState
compatibility Mode
-
get compatibilityMode(): boolean
(WebGPU only) True (default) to be in compatibility mode, meaning rendering all existing scenes without artifacts (same rendering than WebGL). Setting the property to false will improve performances but may not work in some scenes if some precautions are not taken. See https://doc.babylonjs.com/setup/support/webGPU/webGPUOptimization/webGPUNonCompatibilityMode for more details
Returns boolean
-
set compatibilityMode(mode: boolean): void
Parameters
- mode: boolean
Returns void
current Viewport
-
Gets the current viewport
Returns Nullable<IViewportLike>
depth Culling State
-
get depthCullingState(): DepthCullingState
Gets the depth culling state manager
Returns DepthCullingState
description
-
get description(): string
Returns a string describing the current engine
Returns string
do Not Handle Context Lost
-
get doNotHandleContextLost(): boolean
Gets or sets a boolean indicating if resources should be retained to be able to handle context lost events
Returns boolean
-
set doNotHandleContextLost(value: boolean): void
Parameters
- value: boolean
Returns void
empty Cube Texture
-
Gets the default empty cube texture
Returns InternalTexture
empty Texture
-
Gets the default empty texture
Returns InternalTexture
empty Texture2 D Array
-
Gets the default empty 2D array texture
Returns InternalTexture
empty Texture3 D
-
Gets the default empty 3D texture
Returns InternalTexture
framebuffer Dimensions Object
-
set framebufferDimensionsObject(
dimensions: Nullable<
{ framebufferHeight: number; framebufferWidth: number },
>,
): voidsets 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
- dimensions: Nullable<{ framebufferHeight: number; framebufferWidth: number }>
frame Id
-
get frameId(): number
Gets the current frame id
Returns number
is Disposed
-
get isDisposed(): boolean
Gets a boolean indicating if the engine was disposed
Returns boolean
is Stencil Enable
-
get isStencilEnable(): boolean
Returns true if the stencil buffer has been enabled through the creation option of the context.
Returns boolean
is Web GPU
-
get isWebGPU(): boolean
Gets a boolean indicating if the engine runs in WebGPU or not.
Returns boolean
loading UI Text
-
set loadingUIText(_: string): void
Sets the current loading screen text
Parameters
- _: string
Returns void
max FPS
-
get maxFPS(): number | undefined
Gets or sets max frame per second allowed. Will return undefined if not capped
Returns number | undefined
-
set maxFPS(value: number | undefined): void
Parameters
- value: number | undefined
Returns void
name
-
get name(): string
Gets or sets the name of the engine
Returns string
-
set name(value: string): void
Gets or sets the name of the engine
Parameters
- value: string
Returns void
need POT Textures
-
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
performance Monitor
-
Gets the performance monitor attached to this engine
Returns PerformanceMonitor
shader Platform Name
-
get shaderPlatformName(): string
Gets the shader platform name used by the effects.
Returns string
snapshot Rendering
-
get snapshotRendering(): boolean
Enables or disables the snapshot rendering mode Note that the WebGL engine does not support snapshot rendering so setting the value won't have any effect for this engine
Returns boolean
-
set snapshotRendering(activate: boolean): void
Parameters
- activate: boolean
Returns void
snapshot Rendering Mode
-
get snapshotRenderingMode(): number
Gets or sets the snapshot rendering mode
Returns number
-
set snapshotRenderingMode(mode: number): void
Parameters
- mode: number
Returns void
stencil State
-
get stencilState(): StencilState
Gets the stencil state manager
Returns StencilState
stencil State Composer
-
get stencilStateComposer(): StencilStateComposer
Gets the stencil state composer
Returns StencilStateComposer
supports Uniform Buffers
-
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
viewProjectionRmatrix, 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
use Reverse Depth Buffer
-
get useReverseDepthBuffer(): boolean
Gets or sets a boolean indicating if depth buffer should be reverse, going from far to near. This can provide greater z depth for distant objects.
Returns boolean
-
set useReverseDepthBuffer(useReverse: boolean): void
Parameters
- useReverse: boolean
Returns void
version
-
get version(): number
Returns the version of the engine
Returns number
web GL Version
-
get webGLVersion(): number
Gets version of the current webGL context Keep it for back compat - use version instead
Returns number
StaticHas Major Performance Caveat
-
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
StaticInstances
-
Gets the list of created engines
Returns AbstractEngine[]
StaticIs Supported
-
get IsSupported(): boolean
Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)
Returns boolean
StaticIs Supported Async
Returns Promise<boolean>
StaticLast Created Engine
-
Gets the latest created engine
Returns Nullable<AbstractEngine>
StaticLast Created Scene
StaticNpm Package
-
get NpmPackage(): string
Returns the current npm package of the sdk
Returns string
StaticShaders Repository
-
get ShadersRepository(): string
Gets or sets the relative url used to load shaders if using the engine in non-minified mode
Returns string
-
set ShadersRepository(value: string): void
Parameters
- value: string
Returns void
StaticVersion
-
get Version(): string
Returns the current version of the framework
Returns string
Methods
_ create Depth Stencil Cube Texture
-
_createDepthStencilCubeTexture(
size: number,
options: DepthTextureCreationOptions,
): InternalTextureCreates a depth stencil cube texture. This is only available in WebGL 2.
Parameters
- size: number
The size of face edge in the cube texture.
- options: DepthTextureCreationOptions
The options defining the cube texture.
Returns InternalTexture
The cube texture
- size: number
-
_createDepthStencilCubeTexture(
size: number,
options: DepthTextureCreationOptions,
): InternalTextureCreates a depth stencil cube texture. This is only available in WebGL 2.
Parameters
- size: number
The size of face edge in the cube texture.
- options: DepthTextureCreationOptions
The options defining the cube texture.
Returns InternalTexture
The cube texture
- size: number
_ create Image Bitmap From Source
-
_createImageBitmapFromSource(
imageSource: string,
options?: ImageBitmapOptions,
): Promise<ImageBitmap>Engine abstraction for loading and creating an image bitmap from a given source string.
Parameters
- imageSource: string
source to load the image from.
Optionaloptions: ImageBitmapOptionsAn object that sets options for the image's extraction.
Returns Promise<ImageBitmap>
ImageBitmap
- imageSource: string
_ get Internal Format From Depth Texture Format
_ get Web GL Texture Type From Depth Texture Format
-
Parameters
- textureFormat: number
Returns number
_ load File Async
-
_loadFileAsync(
url: string,
offlineProvider?: IOfflineProvider,
useArrayBuffer?: true,
): Promise<ArrayBuffer>Parameters
- url: string
OptionalofflineProvider: IOfflineProviderOptionaluseArrayBuffer: true
Returns Promise<ArrayBuffer>
-
_loadFileAsync(
url: string,
offlineProvider?: IOfflineProvider,
useArrayBuffer?: boolean,
): Promise<string | ArrayBuffer>Parameters
- url: string
OptionalofflineProvider: IOfflineProviderOptionaluseArrayBuffer: boolean
Returns Promise<string | ArrayBuffer>
_ update Render Buffer
apply States
-
Apply all cached states (depth, culling, stencil and alpha)
Returns void
are All Compute Effects Ready
-
Gets a boolean indicating if all created compute effects are ready
Returns boolean
true if all effects are ready
are All Effects Ready
-
Gets a boolean indicating if all created effects are ready
Returns boolean
true if all effects are ready
attach Context Lost Event
-
Attach a new callback raised when context lost event is fired
Parameters
- callback: (event: WebGLContextEvent) => void
defines the callback to call
Returns void
- callback: (event: WebGLContextEvent) => void
attach Context Restored Event
-
Attach a new callback raised when context restored event is fired
Parameters
- callback: (event: WebGLContextEvent) => void
defines the callback to call
Returns void
- callback: (event: WebGLContextEvent) => void
begin Frame
-
Begin a new frame
Returns void
begin Occlusion Query
-
Initiates an occlusion query
Parameters
- algorithmType: number
defines the algorithm to use
- query: OcclusionQuery
defines the query to use
Returns boolean
the current engine
- algorithmType: number
begin Transform Feedback
-
Begins a transform feedback operation
Parameters
- usePoints: boolean
defines if points or triangles must be used
Returns void
- usePoints: boolean
bind Array Buffer
-
Bind a webGL buffer to the webGL context
Parameters
- buffer: Nullable<DataBuffer>
defines the buffer to bind
Returns void
- buffer: Nullable<DataBuffer>
bind Attachments
-
Select a subsets of attachments to draw to.
Parameters
- attachments: number[]
gl attachments
Returns void
- attachments: number[]
-
Select a subsets of attachments to draw to.
Parameters
- attachments: number[]
gl attachments
Returns void
- attachments: number[]
bind Buffers
-
bindBuffers(
vertexBuffers: { [key: string]: VertexBuffer },
indexBuffer: DataBuffer,
effect: Effect,
): voidBind webGl buffers directly to the webGL context
Parameters
- vertexBuffers: { [key: string]: VertexBuffer }
defines the vertex buffer to bind
- indexBuffer: DataBuffer
defines the index buffer to bind
- effect: Effect
defines the effect associated with the vertex buffer
Returns void
- vertexBuffers: { [key: string]: VertexBuffer }
bind Buffers Directly
-
bindBuffersDirectly(
vertexBuffer: DataBuffer,
indexBuffer: DataBuffer,
vertexDeclaration: number[],
vertexStrideSize: number,
effect: Effect,
): voidBind 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
- vertexBuffer: DataBuffer
bind Framebuffer
-
bindFramebuffer(
rtWrapper: RenderTargetWrapper,
faceIndex?: number,
requiredWidth?: number,
requiredHeight?: number,
forceFullscreenViewport?: boolean,
): voidBinds the frame buffer to the specified texture.
Parameters
- rtWrapper: RenderTargetWrapper
The render target wrapper to render to
OptionalfaceIndex: numberThe face of the texture to render to in case of cube texture
OptionalrequiredWidth: numberThe width of the target to render to
OptionalrequiredHeight: numberThe height of the target to render to
OptionalforceFullscreenViewport: booleanForces the viewport to be the entire texture/screen if true
Returns void
- rtWrapper: RenderTargetWrapper
bind Instances Buffer
-
bindInstancesBuffer(
instancesBuffer: DataBuffer,
attributesInfo: InstancingAttributeInfo[],
computeStride?: boolean,
): voidBind the content of a webGL buffer used with instantiation
Parameters
- instancesBuffer: DataBuffer
defines the webGL buffer to bind
- attributesInfo: InstancingAttributeInfo[]
defines the offsets or attributes information used to determine where data must be stored in the buffer
- computeStride: boolean = true
defines Whether to compute the strides from the info or use the default 0
Returns void
- instancesBuffer: DataBuffer
bind Multiview Framebuffer
-
Binds a multiview framebuffer for headless render-state tests.
Parameters
- multiviewTexture: RenderTargetWrapper
render target wrapper to bind
Returns void
- multiviewTexture: RenderTargetWrapper
bind Samplers
-
Binds an effect to the webGL context
Parameters
- effect: Effect
defines the effect to bind
Returns void
- effect: Effect
bind Space Warp Framebuffer
-
Binds a Space Warp render target wrapper to be drawn to
Parameters
- spaceWarpTexture: RenderTargetWrapper
render target wrapper to bind
Returns void
- spaceWarpTexture: RenderTargetWrapper
bind Transform Feedback
-
Bind a webGL transform feedback object to the webgl context
Parameters
- value: Nullable<WebGLTransformFeedback>
defines the webGL transform feedback object to bind
Returns void
- value: Nullable<WebGLTransformFeedback>
bind Transform Feedback Buffer
-
Bind a webGL buffer for a transform feedback operation
Parameters
- value: Nullable<DataBuffer>
defines the webGL buffer to bind
Returns void
- value: Nullable<DataBuffer>
bind Uniform Block
-
Binds a uniform block to a specific index.
Parameters
- _pipelineContext: IPipelineContext
defines the pipeline context to use
- _blockName: string
defines the block name
- _index: number
defines the index where to bind the block
Returns void
- _pipelineContext: IPipelineContext
bind Uniform Buffer
-
Bind an uniform buffer to the current webGL context
Parameters
- buffer: Nullable<DataBuffer>
defines the buffer to bind
Returns void
- buffer: Nullable<DataBuffer>
bind Uniform Buffer Base
-
Binds a uniform buffer to the current draw context.
Parameters
- _buffer: DataBuffer
defines the buffer to bind
- _location: number
not used in NullEngine
- _name: string
name of the uniform variable to bind
Returns void
- _buffer: DataBuffer
bind Vertex Array Object
-
bindVertexArrayObject(
vertexArrayObject: WebGLVertexArrayObject,
indexBuffer: Nullable<DataBuffer>,
): voidBind a specific vertex array object
Parameters
- vertexArrayObject: WebGLVertexArrayObject
defines the vertex array object to bind
- indexBuffer: Nullable<DataBuffer>
defines the index buffer to bind
Returns void
- vertexArrayObject: WebGLVertexArrayObject
build Texture Layout
-
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: booleanif 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. - textureStatus: boolean[]
-
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: booleanif 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. - textureStatus: boolean[]
cache Stencil State
-
Caches the state of the stencil buffer
Returns void
capture GPU Frame Time
-
Enable or disable the GPU frame time capture
Parameters
- value: boolean
True to enable, false to disable
Returns void
- value: boolean
clear
-
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
- color: IColor4Like
clear Internal Textures Cache
-
Clears the list of texture accessible through engine. This can help preventing texture load conflict due to name collision.
Returns void
compute Dispatch
-
computeDispatch(
effect: ComputeEffect,
context: IComputeContext,
bindings: ComputeBindingList,
x: number,
y?: number,
z?: number,
bindingsMapping?: ComputeBindingMapping,
gpuPerfCounter?: WebGPUPerfCounter,
): voidDispatches 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: numberThe number of workgroups to execute on the Y dimension
Optionalz: numberThe number of workgroups to execute on the Z dimension
OptionalbindingsMapping: ComputeBindingMappinglist of bindings mapping (key is property name, value is binding location)
OptionalgpuPerfCounter: WebGPUPerfCounterGPU time computed for the compute shader will be assigned to this object
Returns void
- effect: ComputeEffect
compute Dispatch Indirect
-
computeDispatchIndirect(
effect: ComputeEffect,
context: IComputeContext,
bindings: ComputeBindingList,
buffer: DataBuffer,
offset?: number,
bindingsMapping?: ComputeBindingMapping,
gpuPerfCounter?: WebGPUPerfCounter,
): voidDispatches 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: numberThe offset in the buffer where the dispatch parameters start
OptionalbindingsMapping: ComputeBindingMappinglist of bindings mapping (key is property name, value is binding location)
OptionalgpuPerfCounter: WebGPUPerfCounterGPU time computed for the compute shader will be assigned to this object
Returns void
- effect: ComputeEffect
create Canvas
-
Create a canvas. This method is overridden by other engines
Parameters
- width: number
width
- height: number
height
Returns ICanvas
ICanvas interface
- width: number
create Canvas Image
create Canvas Path2 D
-
Create a 2D path to use with canvas
Parameters
Optionald: stringSVG path string
Returns IPath2D
IPath2D interface
create Compute Context
-
Creates a new compute context
Returns IComputeContext | undefined
the new context
create Compute Effect
-
createComputeEffect(
baseName: string | IComputeShaderPath & {},
options: IComputeEffectCreationOptions,
): ComputeEffectCreates a new compute effect
Parameters
- baseName: string | IComputeShaderPath & {}
Name of the effect
- options: IComputeEffectCreationOptions
Options used to create the effect
Returns ComputeEffect
The new compute effect
- baseName: string | IComputeShaderPath & {}
create Compute Pipeline Context
-
Creates a new compute pipeline context
Returns IComputePipelineContext
the new pipeline
create Cube Texture
-
createCubeTexture(
rootUrl: string,
scene: Nullable<Scene>,
files: Nullable<string[]>,
noMipmap: boolean | undefined,
onLoad: Nullable<(data?: any) => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
format: number | undefined,
forcedExtension: any,
createPolynomials: boolean,
lodScale: number,
lodOffset: number,
fallback: Nullable<InternalTexture>,
loaderOptions: any,
useSRGBBuffer: boolean,
buffer: Nullable<ArrayBufferView<ArrayBufferLike>>,
): InternalTextureCreates 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
- rootUrl: string
-
createCubeTexture(
rootUrl: string,
scene: Nullable<Scene>,
files: Nullable<string[]>,
noMipmap: boolean,
onLoad: Nullable<(data?: any) => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
format: number | undefined,
forcedExtension: any,
): InternalTextureCreates 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
- rootUrl: string
-
createCubeTexture(
rootUrl: string,
scene: Nullable<Scene>,
files: Nullable<string[]>,
noMipmap: boolean,
onLoad: Nullable<(data?: any) => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
format: number | undefined,
forcedExtension: any,
createPolynomials: boolean,
lodScale: number,
lodOffset: number,
): InternalTextureCreates 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
- rootUrl: string
-
createCubeTexture(
rootUrl: string,
scene: Nullable<Scene>,
files: Nullable<string[]>,
noMipmap: boolean | undefined,
onLoad: Nullable<(data?: any) => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
format: number | undefined,
forcedExtension: any,
createPolynomials: boolean,
lodScale: number,
lodOffset: number,
fallback: Nullable<InternalTexture>,
loaderOptions: any,
useSRGBBuffer: boolean,
buffer: Nullable<ArrayBufferView<ArrayBufferLike>>,
): InternalTextureCreates 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
- rootUrl: string
-
createCubeTexture(
rootUrl: string,
scene: Nullable<Scene>,
files: Nullable<string[]>,
noMipmap: boolean,
onLoad: Nullable<(data?: any) => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
format: number | undefined,
forcedExtension: any,
): InternalTextureCreates 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
- rootUrl: string
-
createCubeTexture(
rootUrl: string,
scene: Nullable<Scene>,
files: Nullable<string[]>,
noMipmap: boolean,
onLoad: Nullable<(data?: any) => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
format: number | undefined,
forcedExtension: any,
createPolynomials: boolean,
lodScale: number,
lodOffset: number,
): InternalTextureCreates 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
- rootUrl: string
create Depth Stencil Texture
-
createDepthStencilTexture(
size: TextureSize,
options: DepthTextureCreationOptions,
rtWrapper: RenderTargetWrapper,
): InternalTextureCreates a depth stencil texture. This is only available in WebGL 2 or with the depth texture extension available.
Parameters
- size: TextureSize
The size of face edge in the texture.
- options: DepthTextureCreationOptions
The options defining the texture.
- rtWrapper: RenderTargetWrapper
The render target wrapper for which the depth/stencil texture must be created
Returns InternalTexture
The texture
- size: TextureSize
create Draw Context
create Dynamic Texture
-
createDynamicTexture(
width: number,
height: number,
generateMipMaps: boolean,
samplingMode: number,
): InternalTextureCreates a dynamic texture
Parameters
- width: number
defines the width of the texture
- height: number
defines the height of the texture
- generateMipMaps: boolean
defines if the engine should generate the mip levels
- samplingMode: number
defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
Returns InternalTexture
the dynamic texture inside an InternalTexture
- width: number
-
createDynamicTexture(
width: number,
height: number,
generateMipMaps: boolean,
samplingMode: number,
): InternalTextureCreates a dynamic texture
Parameters
- width: number
defines the width of the texture
- height: number
defines the height of the texture
- generateMipMaps: boolean
defines if the engine should generate the mip levels
- samplingMode: number
defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
Returns InternalTexture
the dynamic texture inside an InternalTexture
- width: number
create Dynamic Uniform Buffer
-
Creates a dynamic uniform buffer.
Parameters
- elements: FloatArray
defines the content of the dynamic uniform buffer
Returns DataBuffer
a new data buffer
- elements: FloatArray
create Dynamic Vertex Buffer
-
Creates a dynamic vertex buffer
Parameters
- vertices: FloatArray
the data for the dynamic vertex buffer
Returns DataBuffer
the new WebGL dynamic buffer
- vertices: FloatArray
create Effect
-
createEffect(
baseName:
| string
| IShaderPath & { fragmentToken?: string; vertexToken?: string },
attributesNamesOrOptions: string[] | IEffectCreationOptions,
uniformsNamesOrEngine: string[] | ThinEngine,
samplers?: string[],
defines?: string,
fallbacks?: IEffectFallbacks,
onCompiled?: Nullable<(effect: Effect) => void>,
onError?: Nullable<(effect: Effect, errors: string) => void>,
indexParameters?: any,
shaderLanguage?: ShaderLanguage,
extraInitializationsAsync?: () => Promise<void>,
): EffectCreate 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: stringdefines the string containing the defines to use to compile the shaders
Optionalfallbacks: IEffectFallbacksdefines 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: anydefines 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
- baseName: string | IShaderPath & { fragmentToken?: string; vertexToken?: string }
create Effect For Particles
-
createEffectForParticles(
fragmentName: string,
uniformsNames: string[],
samplers: string[],
defines: string,
fallbacks?: EffectFallbacks,
onCompiled?: (effect: Effect) => void,
onError?: (effect: Effect, errors: string) => void,
particleSystem?: IParticleSystem,
shaderLanguage?: any,
vertexName?: string,
): EffectCreate 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: EffectFallbacksdefines the list of potential fallbacks to use if shader compilation fails
OptionalonCompiled: (effect: Effect) => voiddefines a function to call when the effect creation is successful
OptionalonError: (effect: Effect, errors: string) => voiddefines a function to call when the effect creation has failed
OptionalparticleSystem: IParticleSystemthe particle system you want to create the effect for
OptionalshaderLanguage: anydefines the shader language to use
OptionalvertexName: stringdefines the vertex base name of the effect (The name of file without .vertex.fx)
Returns Effect
the new Effect
- fragmentName: string
create Image Bitmap
-
Engine abstraction for createImageBitmap
Parameters
- image: ImageBitmapSource
source for image
Optionaloptions: ImageBitmapOptionsAn object that sets options for the image's extraction.
Returns Promise<ImageBitmap>
ImageBitmap
- image: ImageBitmapSource
create Index Buffer
-
Creates a new index buffer
Parameters
- indices: IndicesArray
defines the content of the index buffer
Returns DataBuffer
a new webGL buffer
- indices: IndicesArray
create Instances Buffer
-
Creates a webGL buffer to use with instantiation
Parameters
- capacity: number
defines the size of the buffer
Returns DataBuffer
the webGL buffer
- capacity: number
create Material Context
-
Creates a new material context
Returns IMaterialContext | undefined
the new context
create Multiple Render Target
-
createMultipleRenderTarget(
size: TextureSize,
options: IMultiRenderTargetOptions,
initializeBuffers?: boolean,
): RenderTargetWrapperCreate a multi render target texture
Parameters
- size: TextureSize
defines the size of the texture
- options: IMultiRenderTargetOptions
defines the creation options
OptionalinitializeBuffers: booleanif set to true, the engine will make an initializing call of drawBuffers
Returns RenderTargetWrapper
a new render target wrapper ready to render textures
- size: TextureSize
-
createMultipleRenderTarget(
size: TextureSize,
options: IMultiRenderTargetOptions,
initializeBuffers?: boolean,
): RenderTargetWrapperCreate a multi render target texture
Parameters
- size: TextureSize
defines the size of the texture
- options: IMultiRenderTargetOptions
defines the creation options
OptionalinitializeBuffers: booleanif set to true, the engine will make an initializing call of drawBuffers
Returns RenderTargetWrapper
a new render target wrapper ready to render textures
- size: TextureSize
create Multiview Render Target Texture
-
Creates a new multiview render target wrapper for headless render-state tests.
Parameters
- width: number
defines the width of the texture
- height: number
defines the height of the texture
Returns RenderTargetWrapper
a new multiview render target wrapper
- width: number
create Pipeline Context
-
createPipelineContext(
shaderProcessingContext: Nullable<_IShaderProcessingContext>,
): IPipelineContextCreates a new pipeline context
Parameters
- shaderProcessingContext: Nullable<_IShaderProcessingContext>
defines the shader processing context used during the processing if available
Returns IPipelineContext
the new pipeline
- shaderProcessingContext: Nullable<_IShaderProcessingContext>
create Prefiltered Cube Texture
-
createPrefilteredCubeTexture(
rootUrl: string,
scene: Nullable<Scene>,
lodScale: number,
lodOffset: number,
onLoad?: Nullable<(internalTexture: Nullable<InternalTexture>) => void>,
onError?: Nullable<(message?: string, exception?: any) => void>,
format?: number,
forcedExtension?: any,
createPolynomials?: boolean,
buffer?: Nullable<ArrayBufferView<ArrayBufferLike>>,
): InternalTextureCreate 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: numberdefines the format of the data
OptionalforcedExtension: anydefines the extension to use to pick the right loader
OptionalcreatePolynomials: booleandefines 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
- rootUrl: string
create Query
-
Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)
Returns Nullable<OcclusionQuery>
the new query
create Raw Cube Texture
-
createRawCubeTexture(
data: Nullable<ArrayBufferView<ArrayBufferLike>[]>,
size: number,
format: number,
type: number,
generateMipMaps: boolean,
invertY: boolean,
samplingMode: number,
compression?: Nullable<string>,
): InternalTextureCreates 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
- data: Nullable<ArrayBufferView<ArrayBufferLike>[]>
-
createRawCubeTexture(
data: Nullable<ArrayBufferView<ArrayBufferLike>[]>,
size: number,
format: number,
type: number,
generateMipMaps: boolean,
invertY: boolean,
samplingMode: number,
compression: Nullable<string>,
): InternalTextureCreates 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
- data: Nullable<ArrayBufferView<ArrayBufferLike>[]>
create Raw Cube Texture From Url
-
createRawCubeTextureFromUrl(
url: string,
scene: Nullable<Scene>,
size: number,
format: number,
type: number,
noMipmap: boolean,
callback: (
ArrayBuffer: ArrayBuffer,
) => Nullable<
| ArrayBufferView<ArrayBufferLike>[]
| Promise<ArrayBufferView<ArrayBufferLike>[]>,
>,
mipmapGenerator: Nullable<
(
faces: ArrayBufferView<ArrayBufferLike>[],
) => ArrayBufferView<ArrayBufferLike>[][],
>,
onLoad: Nullable<() => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
): InternalTextureCreates 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
- url: string
-
createRawCubeTextureFromUrl(
url: string,
scene: Nullable<Scene>,
size: number,
format: number,
type: number,
noMipmap: boolean,
callback: (
ArrayBuffer: ArrayBuffer,
) => Nullable<
| ArrayBufferView<ArrayBufferLike>[]
| Promise<ArrayBufferView<ArrayBufferLike>[]>,
>,
mipmapGenerator: Nullable<
(
faces: ArrayBufferView<ArrayBufferLike>[],
) => ArrayBufferView<ArrayBufferLike>[][],
>,
onLoad: Nullable<() => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
samplingMode: number,
invertY: boolean,
): InternalTextureCreates 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
- url: string
-
createRawCubeTextureFromUrl(
url: string,
scene: Nullable<Scene>,
size: number,
format: number,
type: number,
noMipmap: boolean,
callback: (
ArrayBuffer: ArrayBuffer,
) => Nullable<
| ArrayBufferView<ArrayBufferLike>[]
| Promise<ArrayBufferView<ArrayBufferLike>[]>,
>,
mipmapGenerator: Nullable<
(
faces: ArrayBufferView<ArrayBufferLike>[],
) => ArrayBufferView<ArrayBufferLike>[][],
>,
onLoad: Nullable<() => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
): InternalTextureCreates 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
- url: string
-
createRawCubeTextureFromUrl(
url: string,
scene: Nullable<Scene>,
size: number,
format: number,
type: number,
noMipmap: boolean,
callback: (
ArrayBuffer: ArrayBuffer,
) => Nullable<
| ArrayBufferView<ArrayBufferLike>[]
| Promise<ArrayBufferView<ArrayBufferLike>[]>,
>,
mipmapGenerator: Nullable<
(
faces: ArrayBufferView<ArrayBufferLike>[],
) => ArrayBufferView<ArrayBufferLike>[][],
>,
onLoad: Nullable<() => void>,
onError: Nullable<(message?: string, exception?: any) => void>,
samplingMode: number,
invertY: boolean,
): InternalTextureCreates 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
- url: string
create Raw Shader Program
-
createRawShaderProgram(
pipelineContext: IPipelineContext,
vertexCode: string,
fragmentCode: string,
context?: WebGLRenderingContext,
transformFeedbackVaryings?: Nullable<string[]>,
): WebGLProgramDirectly 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: WebGLRenderingContextdefines 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
- pipelineContext: IPipelineContext
create Raw Texture
-
createRawTexture(
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
width: number,
height: number,
format: number,
generateMipMaps: boolean,
invertY: boolean,
samplingMode: number,
compression?: Nullable<string>,
type?: number,
creationFlags?: number,
useSRGBBuffer?: boolean,
): InternalTextureCreates 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
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
create Raw Texture2 D Array
-
createRawTexture2DArray(
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
width: number,
height: number,
depth: number,
format: number,
generateMipMaps: boolean,
invertY: boolean,
samplingMode: number,
compression?: Nullable<string>,
textureType?: number,
creationFlags?: number,
mipLevelCount?: number,
): InternalTextureCreates 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: numberdefines the compressed used (can be null)
OptionalcreationFlags: numberspecific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
OptionalmipLevelCount: numberdefines the number of mip levels to allocate for the texture
Returns InternalTexture
a new raw 2D array texture (stored in an InternalTexture)
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
create Raw Texture3 D
-
createRawTexture3D(
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
width: number,
height: number,
depth: number,
format: number,
generateMipMaps: boolean,
invertY: boolean,
samplingMode: number,
compression?: Nullable<string>,
textureType?: number,
creationFlags?: number,
): InternalTextureCreates 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: numberdefines the compressed used (can be null)
OptionalcreationFlags: numberspecific 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)
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
create Render Pass Id
-
Creates a render pass id
Parameters
Optionalname: stringName of the render pass (for debug purpose only)
Returns number
the id of the new render pass
create Render Target Cube Texture
-
createRenderTargetCubeTexture(
size: number,
options?: RenderTargetCreationOptions,
): RenderTargetWrapperCreates a new render target wrapper
Parameters
- size: number
defines the size of the texture
Optionaloptions: RenderTargetCreationOptionsdefines the options used to create the texture
Returns RenderTargetWrapper
a new render target wrapper
- size: number
create Render Target Texture
-
createRenderTargetTexture(
size: any,
options: boolean | RenderTargetCreationOptions,
): RenderTargetWrapperCreates a new render target wrapper
Parameters
- size: any
defines the size of the texture
- options: boolean | RenderTargetCreationOptions
defines the options used to create the texture
Returns RenderTargetWrapper
a new render target wrapper
- size: any
create Shader Program
-
createShaderProgram(
pipelineContext: IPipelineContext,
vertexCode: string,
fragmentCode: string,
defines: string,
context?: WebGLRenderingContext,
): WebGLProgramCreates 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: WebGLRenderingContextdefines the webGL context to use (if not set, the current one will be used)
Returns WebGLProgram
the new webGL program
- pipelineContext: IPipelineContext
create Texture
-
createTexture(
urlArg: Nullable<string>,
noMipmap: boolean,
invertY: boolean,
scene: Nullable<ISceneLike>,
samplingMode?: number,
onLoad?: Nullable<(texture: InternalTexture) => void>,
onError?: Nullable<(message: string, exception: any) => void>,
buffer?: Nullable<
| string
| ArrayBuffer
| ArrayBufferView<ArrayBufferLike>
| HTMLImageElement
| ImageBitmap
| Blob,
>,
fallback?: Nullable<InternalTexture>,
format?: Nullable<number>,
forcedExtension?: Nullable<string>,
mimeType?: string,
): InternalTextureUsually 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,
> = nulla 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: stringdefines an optional mime type
Returns InternalTexture
a InternalTexture for assignment back into BABYLON.Texture
- urlArg: Nullable<string>
create Transform Feedback
-
Creates a webGL transform feedback object Please makes sure to check webGLVersion property to check if you are running webGL 2+
Returns WebGLTransformFeedback
the webGL transform feedback object
create Uniform Buffer
-
Creates a uniform buffer.
Parameters
- elements: FloatArray
defines the content of the uniform buffer
Returns DataBuffer
a new data buffer
- elements: FloatArray
create Vertex Buffer
-
Creates a vertex buffer
Parameters
- vertices: FloatArray
the data for the vertex buffer
Returns DataBuffer
the new WebGL static buffer
- vertices: FloatArray
create Video Element
-
creates and returns a new video element
Parameters
- constraints: MediaTrackConstraints
video constraints
Returns any
video element
- constraints: MediaTrackConstraints
delete Instances Buffer
-
Delete a webGL buffer used with instantiation
Parameters
- buffer: WebGLBuffer
defines the webGL buffer to delete
Returns void
- buffer: WebGLBuffer
delete Query
-
Delete and release a webGL query
Parameters
- query: OcclusionQuery
defines the query to delete
Returns AbstractEngine
the current engine
- query: OcclusionQuery
delete Transform Feedback
-
Delete a webGL transform feedback object
Parameters
- value: WebGLTransformFeedback
defines the webGL transform feedback object to delete
Returns void
- value: WebGLTransformFeedback
disable Attribute By Index
-
Disable the attribute corresponding to the location in parameter
Parameters
- attributeLocation: number
defines the attribute location of the attribute to disable
Returns void
- attributeLocation: number
disable Instance Attribute
-
Disable the instance attribute corresponding to the location in parameter
Parameters
- attributeLocation: number
defines the attribute location of the attribute to disable
Returns void
- attributeLocation: number
disable Instance Attribute By Name
-
Disable the instance attribute corresponding to the name in parameter
Parameters
- name: string
defines the name of the attribute to disable
Returns void
- name: string
disable Scissor
-
Disable previously set scissor test rectangle
Returns void
display Loading UI
-
Display the loading screen
Returns void
dispose
-
Dispose and release all associated resources
Returns void
draw
-
draw(
useTriangles: boolean,
indexStart: number,
indexCount: number,
instancesCount?: number,
): voidSend 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: numberdefines the number of instances to draw (if instantiation is enabled)
Returns void
- useTriangles: boolean
draw Arrays Type
-
drawArraysType(
fillMode: number,
verticesStart: number,
verticesCount: number,
instancesCount?: number,
): voidDraw 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: numberdefines the number of instances to draw (if instantiation is enabled)
Returns void
- fillMode: number
draw Elements Type
-
drawElementsType(
fillMode: number,
indexStart: number,
indexCount: number,
instancesCount?: number,
): voidDraw 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: numberdefines the number of instances to draw (if instantiation is enabled)
Returns void
- fillMode: number
draw Point Clouds
-
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: numberdefines the number of instances to draw (if instantiation is enabled)
Returns void
- verticesStart: number
draw Un Indexed
-
drawUnIndexed(
useTriangles: boolean,
verticesStart: number,
verticesCount: number,
instancesCount?: number,
): voidDraw 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: numberdefines the number of instances to draw (if instantiation is enabled)
Returns void
- useTriangles: boolean
enable Effect
-
Activates an effect, making it the current one (ie. the one used for rendering)
Parameters
- effect: Nullable<Effect | DrawWrapper>
defines the effect to activate
Returns void
- effect: Nullable<Effect | DrawWrapper>
enable Scissor
-
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
- x: number
end Frame
-
End the current frame
Returns void
end Occlusion Query
-
Ends an occlusion query
Parameters
- algorithmType: number
defines the algorithm to use
Returns AbstractEngine
the current engine
- algorithmType: number
end Time Query
-
Ends a time query
Parameters
- token: _TimeToken
defines the token used to measure the time span
Returns number
the time spent (in ns)
- token: _TimeToken
end Transform Feedback
-
Ends a transform feedback operation
Returns void
enter Fullscreen
-
Enters full screen mode
Parameters
- requestPointerLock: boolean
defines if a pointer lock should be requested from the user
Returns void
- requestPointerLock: boolean
enter Pointerlock
-
Enters Pointerlock mode
Returns void
exit Fullscreen
-
Exits full screen mode
Returns void
exit Pointerlock
-
Exits Pointerlock mode
Returns void
extract Driver Info
-
Gets driver info if available
Returns string
flush Framebuffer
-
Force a webGL flush (ie. a flush of all waiting webGL commands)
Returns void
generate Mipmaps
-
Generates the mipmaps for a texture
Parameters
- texture: InternalTexture
texture to generate the mipmaps for
Returns void
- texture: InternalTexture
generate Mip Maps For Cubemap
-
Force the mipmap generation for the given render target texture
Parameters
- texture: InternalTexture
defines the render target texture to use
Optionalunbind: booleandefines whether or not to unbind the texture after generation. Defaults to true.
Returns void
- texture: InternalTexture
-
Force the mipmap generation for the given render target texture
Parameters
- texture: InternalTexture
defines the render target texture to use
Optionalunbind: booleandefines whether or not to unbind the texture after generation. Defaults to true.
Returns void
- texture: InternalTexture
generate Mip Maps Framebuffer
-
Generates mipmaps for the texture of the (single) render target
Parameters
- texture: RenderTargetWrapper
The render target containing the texture to generate the mipmaps for
Returns void
- texture: RenderTargetWrapper
generate Mip Maps Multi Framebuffer
-
Generates mipmaps for the texture of the (multi) render target
Parameters
- texture: RenderTargetWrapper
The render target containing the textures to generate the mipmaps for
Returns void
- texture: RenderTargetWrapper
-
Generates mipmaps for the texture of the (multi) render target
Parameters
- texture: RenderTargetWrapper
The render target containing the textures to generate the mipmaps for
Returns void
- texture: RenderTargetWrapper
get Alpha Equation
-
Gets the current alpha equation.
Parameters
OptionaltargetIndex: numberdefines the index of the target to get the alpha equation for (default is 0)
Returns number
the current alpha equation
get Alpha Mode
-
Gets the current alpha mode
Parameters
OptionaltargetIndex: numberdefines the index of the target to get the alpha mode for (default is 0)
Returns number
the current alpha mode
get Alpha To Coverage
-
Gets a boolean indicating if alpha-to-coverage is enabled.
Returns boolean
true if alpha-to-coverage is enabled
get Aspect Ratio
-
Gets current aspect ratio
Parameters
- viewportOwner: IViewportOwnerLike
defines the camera to use to get the aspect ratio
OptionaluseScreen: booleandefines if screen size must be used (or the current render target if any)
Returns number
a number defining the aspect ratio
- viewportOwner: IViewportOwnerLike
get Attributes
-
Gets the lsit of active attributes for a given webGL program
Parameters
- pipelineContext: IPipelineContext
defines the pipeline context to use
- attributesNames: string[]
defines the list of attribute names to get
Returns number[]
an array of indices indicating the offset of each attribute
- pipelineContext: IPipelineContext
get Audio Context
-
Gets the audio context specified in engine initialization options
Returns Nullable<AudioContext>
an Audio Context
get Audio Destination
-
Gets the audio destination specified in engine initialization options
Returns Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode>
an audio destination node
get Caps
-
Gets the object containing all engine capabilities
Returns EngineCapabilities
the EngineCapabilities object
get Class Name
-
Gets a string identifying the name of the class
Returns string
"Engine" string
get Color Write
-
Gets a boolean indicating if color writing is enabled
Returns boolean
the current color writing state
get Creation Options
-
Gets the options used for engine creation NOTE that modifying the object after engine creation will have no effect
Returns AbstractEngineOptions
EngineOptions object
get Current Render Pass Name
-
Gets the name of the current render pass
Returns string
name of the current render pass
get Delta Time
-
Gets the time spent between current and previous frame
Returns number
a number representing the delta time in ms
get Depth Buffer
-
Gets a boolean indicating if depth testing is enabled
Returns boolean
the current state
get Depth Function
get Depth Write
-
Gets a boolean indicating if depth writing is enabled
Returns boolean
the current depth writing state
get Font Offset
-
Get Font size information
Parameters
- font: string
font name
Returns { ascent: number; descent: number; height: number }
an object containing ascent, height and descent
- font: string
get Fps
-
Gets the current framerate
Returns number
a number representing the framerate
get Fragment Shader Source
-
Gets the source code of the fragment shader associated with a specific webGL program
Parameters
- program: WebGLProgram
defines the program to use
Returns Nullable<string>
a string containing the source code of the fragment shader associated with the program
- program: WebGLProgram
get Gl Info
-
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
get GPU Frame Time Counter
-
Get the performance counter associated with the frame time computation
Returns PerfCounter
the perf counter
get Hardware Scaling Level
-
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
get Host Document
get Host Window
get Info
-
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
get Input Element
get Input Element Client Rect
-
Gets the client rect of the HTML element used for events
Returns Nullable<ClientRect>
a client rectangle
get Loaded Textures Cache
get Lockstep Max Steps
-
Gets the max steps when engine is running in deterministic lock step
Returns number
the max steps
get Query Result
-
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
- query: OcclusionQuery
get Render Height
-
Gets the current render height
Parameters
- useScreen: boolean = false
defines if screen size must be used (or the current render target if any)
Returns number
a number defining the current render height
- useScreen: boolean = false
get Rendering Canvas
-
Gets the HTML canvas attached with the current webGL context
Returns Nullable<HTMLCanvasElement>
a HTML canvas
get Rendering Canvas Client Rect
-
Gets the client rect of the HTML canvas attached with the current webGL context
Returns Nullable<ClientRect>
a client rectangle
get Render Pass Names
-
Gets the names of the render passes that are currently created
Returns string[]
list of the render pass names
get Render Width
-
Gets the current render width
Parameters
- useScreen: boolean = false
defines if screen size must be used (or the current render target if any)
Returns number
a number defining the current render width
- useScreen: boolean = false
get Screen Aspect Ratio
-
Gets current screen aspect ratio
Returns number
a number defining the aspect ratio
get Stencil Back Function
-
Gets the current back stencil function
Returns number
a number defining the back stencil function to use
get Stencil Back Operation Depth Fail
-
Gets the current back stencil operation when depth fails
Returns number
a number defining back stencil operation to use when depth fails
get Stencil Back Operation Fail
-
Gets the current back stencil operation when stencil fails
Returns number
a number defining back stencil operation to use when stencil fails
get Stencil Back Operation Pass
-
Gets the current back stencil operation when stencil passes
Returns number
a number defining back stencil operation to use when stencil passes
get Stencil Buffer
-
Gets a boolean indicating if stencil buffer is enabled
Returns boolean
the current stencil buffer state
get Stencil Function
-
Gets the current stencil function
Returns number
a number defining the stencil function to use
get Stencil Function Mask
-
Gets the current stencil mask
Returns number
a number defining the stencil mask to use
get Stencil Function Reference
-
Gets the current stencil reference value
Returns number
a number defining the stencil reference value to use
get Stencil Mask
-
Gets the current stencil mask
Returns number
a number defining the new stencil mask to use
get Stencil Operation Depth Fail
-
Gets the current stencil operation when depth fails
Returns number
a number defining stencil operation to use when depth fails
get Stencil Operation Fail
-
Gets the current stencil operation when stencil fails
Returns number
a number defining stencil operation to use when stencil fails
get Stencil Operation Pass
-
Gets the current stencil operation when stencil passes
Returns number
a number defining stencil operation to use when stencil passes
get Time Step
-
Returns the time in ms between steps when using deterministic lock step.
Returns number
time step in (ms)
get Uniforms
-
getUniforms(
pipelineContext: IPipelineContext,
uniformsNames: string[],
): Nullable<WebGLUniformLocation>[]Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names
Parameters
- pipelineContext: IPipelineContext
defines the pipeline context to use
- uniformsNames: string[]
defines the list of uniform names
Returns Nullable<WebGLUniformLocation>[]
an array of webGL uniform locations
- pipelineContext: IPipelineContext
get Vertex Shader Source
-
Gets the source code of the vertex shader associated with a specific webGL program
Parameters
- program: WebGLProgram
defines the program to use
Returns Nullable<string>
a string containing the source code of the vertex shader associated with the program
- program: WebGLProgram
get Z Offset
-
Gets the current value of the zOffset Factor
Returns number
the current zOffset Factor state
get Z Offset Units
-
Gets the current value of the zOffset Units
Returns number
the current zOffset Units state
hide Loading UI
-
Hide the loading screen
Returns void
inline Shader Code
-
Inline functions in shader code that are marked to be inlined
Parameters
- code: string
code to inline
Returns string
inlined code
- code: string
is Deterministic Lock Step
-
Gets a boolean indicating that the engine is running in deterministic lock step mode
Returns boolean
true if engine is in deterministic lock step mode
is Occlusion Query Visible
-
Checks whether an available occlusion query indicates that any samples passed. This normalizes backend-specific query values without changing the raw value returned by getQueryResult.
Parameters
- query: OcclusionQuery
defines the occlusion query to check
Returns boolean
true when the query result is greater than zero, otherwise false
- query: OcclusionQuery
is Query Result Available
-
Parameters
- query: OcclusionQuery
Returns boolean
read Pixels
-
readPixels(
x: number,
y: number,
width: number,
height: number,
hasAlpha?: boolean,
flushRenderer?: boolean,
data?: Nullable<Uint8Array<ArrayBufferLike>>,
): Promise<ArrayBufferView<ArrayBufferLike>>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
- x: number
read Transform Feedback Buffer
-
Read data back from the bound transform feedback buffer
Parameters
- target: ArrayBufferView
defines the webGL buffer to write to
Returns void
- target: ArrayBufferView
record Vertex Array Object
-
recordVertexArrayObject(
vertexBuffers: { [key: string]: VertexBuffer },
indexBuffer: Nullable<DataBuffer>,
effect: Effect,
overrideVertexBuffers?: { [kind: string]: Nullable<VertexBuffer> },
): WebGLVertexArrayObjectRecords a vertex array object
Parameters
- vertexBuffers: { [key: string]: VertexBuffer }
defines the list of vertex buffers to store
- indexBuffer: Nullable<DataBuffer>
defines the index buffer to store
- effect: Effect
defines the effect to store
OptionaloverrideVertexBuffers: { [kind: string]: Nullable<VertexBuffer> }defines optional list of avertex buffers that overrides the entries in vertexBuffers
Returns WebGLVertexArrayObject
the new vertex array object
- vertexBuffers: { [key: string]: VertexBuffer }
register View
-
registerView(
canvas: HTMLCanvasElement,
camera?: Camera | Camera[],
clearBeforeCopy?: boolean,
): EngineViewSinceRegister 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: booleanIndicates 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
- canvas: HTMLCanvasElement
release Compute Effects
-
Forces the engine to release all cached compute effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled
Returns void
release Effects
-
Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled
Returns void
release Render Pass Id
-
Releases a render pass id
Parameters
- id: number
id of the render pass to release
Returns void
- id: number
release Vertex Array Object
-
Release and free the memory of a vertex array object
Parameters
- vao: WebGLVertexArrayObject
defines the vertex array object to delete
Returns void
- vao: WebGLVertexArrayObject
reset Texture Cache
-
Reset the texture cache to empty state
Returns void
resize
-
Resize the view according to the canvas' size
Parameters
- forceSetSize: boolean = false
true to force setting the sizes of the underlying canvas
Returns void
- forceSetSize: boolean = false
resize Image Bitmap
-
resizeImageBitmap(
image: HTMLImageElement | ImageBitmap,
bufferWidth: number,
bufferHeight: number,
): Uint8ArrayResize 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
- image: HTMLImageElement | ImageBitmap
resolve Framebuffer
-
Resolves the MSAA texture of the (single) render target into its non-MSAA version. Note that if "texture" is not a MSAA render target, no resolve is performed.
Parameters
- texture: RenderTargetWrapper
The render target texture containing the MSAA textures to resolve
Returns void
- texture: RenderTargetWrapper
resolve Multi Framebuffer
-
Resolves the MSAA textures of the (multi) render target into their non-MSAA version. Note that if "texture" is not a MSAA render target, no resolve is performed.
Parameters
- texture: RenderTargetWrapper
The render target texture containing the MSAA textures to resolve
Returns void
- texture: RenderTargetWrapper
-
Resolves the MSAA textures of the (multi) render target into their non-MSAA version. Note that if "texture" is not a MSAA render target, no resolve is performed.
Parameters
- texture: RenderTargetWrapper
The render target texture containing the MSAA textures to resolve
OptionalresolveColors: booleanIf true, resolve the color textures (default: true) - still subject to texture.resolveMSAAColors
Returns void
- texture: RenderTargetWrapper
restore Default Framebuffer
-
Unbind the current render target and bind the default framebuffer
Returns void
restore Single Attachment
-
Restores the webgl state to only draw on the main color attachment when the frame buffer associated is the canvas frame buffer
Returns void
-
Restores the webgl state to only draw on the main color attachment when the frame buffer associated is the canvas frame buffer
Returns void
restore Single Attachment For Render Target
-
Restores the webgl state to only draw on the main color attachment when the frame buffer associated is not the canvas frame buffer
Returns void
-
Restores the webgl state to only draw on the main color attachment when the frame buffer associated is not the canvas frame buffer
Returns void
restore Stencil State
-
Restores the state of the stencil buffer
Returns void
run Render Loop
-
Register and execute a render loop. The engine can have more than one render function
Parameters
- renderFunction: () => void
defines the function to continuously execute
Returns void
- renderFunction: () => void
scissor Clear
-
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
- x: number
set Alpha Constants
-
Sets alpha constants used by some alpha blending modes
Parameters
- r: number
defines the red component
- g: number
defines the green component
- b: number
defines the blue component
- a: number
defines the alpha component
Returns void
- r: number
set Alpha Equation
-
Sets the current alpha equation
Parameters
- equation: number
defines the equation to use (one of the Engine.ALPHA_EQUATION_XXX)
OptionaltargetIndex: numberdefines the index of the target to set the equation for (default is 0)
Returns void
- equation: number
set Alpha Mode
-
Sets the current alpha mode
Parameters
- mode: number
defines the mode to use (one of the Engine.ALPHA_XXX)
- noDepthWriteChange: boolean = false
defines if depth writing state should remains unchanged (false by default)
- targetIndex: number = 0
defines the index of the target to set the alpha mode for (default is 0)
Returns void
- mode: number
set Alpha To Coverage
-
Enable or disable alpha-to-coverage.
Parameters
- enable: boolean
defines the state to set
Returns void
- enable: boolean
set Array
-
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
- uniform: WebGLUniformLocation
set Array2
-
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
- uniform: WebGLUniformLocation
set Array3
-
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
- uniform: WebGLUniformLocation
set Array4
-
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
- uniform: WebGLUniformLocation
set Bool
-
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
- uniform: WebGLUniformLocation
set Color Write
-
Enable or disable color writing
Parameters
- enable: boolean
defines the state to set
Returns void
- enable: boolean
set Compressed Texture Exclusions
-
Set the compressed texture extensions or file names to skip.
Parameters
- skippedFiles: string[]
defines the list of those texture files you want to skip Example: [".dds", ".env", "myfile.png"]
Returns void
- skippedFiles: string[]
set Depth Buffer
-
Enable or disable depth buffering
Parameters
- enable: boolean
defines the state to set
Returns void
- enable: boolean
set Depth Function
-
Sets the current depth function
Parameters
- depthFunc: number
defines the function to use
Returns void
- depthFunc: number
set Depth Function To Greater
-
Sets the current depth function to GREATER
Returns void
set Depth Function To Greater Or Equal
-
Sets the current depth function to GEQUAL
Returns void
set Depth Function To Less
-
Sets the current depth function to LESS
Returns void
set Depth Function To Less Or Equal
-
Sets the current depth function to LEQUAL
Returns void
set Depth Stencil Texture
-
setDepthStencilTexture(
channel: number,
uniform: Nullable<WebGLUniformLocation>,
texture: Nullable<RenderTargetTexture>,
name?: string,
): voidSets a depth stencil texture from a render target to the according uniform.
Parameters
- channel: number
The texture channel
- uniform: Nullable<WebGLUniformLocation>
The uniform to set
- texture: Nullable<RenderTargetTexture>
The render target texture containing the depth stencil texture to apply
Optionalname: stringThe texture name
Returns void
- channel: number
-
setDepthStencilTexture(
channel: number,
uniform: Nullable<WebGLUniformLocation>,
texture: Nullable<RenderTargetTexture>,
name?: string,
): voidSets a depth stencil texture from a render target to the according uniform.
Parameters
- channel: number
The texture channel
- uniform: Nullable<WebGLUniformLocation>
The uniform to set
- texture: Nullable<RenderTargetTexture>
The render target texture containing the depth stencil texture to apply
Optionalname: stringThe texture name
Returns void
- channel: number
set Depth Write
-
Enable or disable depth writing
Parameters
- enable: boolean
defines the state to set
Returns void
- enable: boolean
set Direct Viewport
-
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
- x: number
set Dithering State
-
Sets a boolean indicating if the dithering state is enabled or disabled
Parameters
- value: boolean
defines the dithering state
Returns void
- value: boolean
set Float
-
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
- uniform: WebGLUniformLocation
set Float2
-
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
- uniform: WebGLUniformLocation
set Float3
-
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
- uniform: WebGLUniformLocation
set Float4
-
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
- uniform: WebGLUniformLocation
set Float Array
-
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
- uniform: WebGLUniformLocation
set Float Array2
-
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
- uniform: WebGLUniformLocation
set Float Array3
-
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
- uniform: WebGLUniformLocation
set Float Array4
-
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
- uniform: WebGLUniformLocation
set Hardware Scaling Level
-
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
- level: number
set Int
-
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
- uniform: Nullable<WebGLUniformLocation>
set Int2
-
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
- uniform: Nullable<WebGLUniformLocation>
set Int3
-
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
- uniform: Nullable<WebGLUniformLocation>
set Int4
-
setInt4(
uniform: Nullable<WebGLUniformLocation>,
x: number,
y: number,
z: number,
w: number,
): booleanSet 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
- uniform: Nullable<WebGLUniformLocation>
set Int Array
-
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
- uniform: WebGLUniformLocation
set Int Array2
-
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
- uniform: WebGLUniformLocation
set Int Array3
-
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
- uniform: WebGLUniformLocation
set Int Array4
-
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
- uniform: WebGLUniformLocation
set Matrices
-
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
- uniform: WebGLUniformLocation
set Matrix2x2
-
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
- uniform: WebGLUniformLocation
set Matrix3x3
-
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
- uniform: WebGLUniformLocation
set Rasterizer State
-
Sets a boolean indicating if the rasterizer state is enabled or disabled
Parameters
- value: boolean
defines the rasterizer state
Returns void
- value: boolean
set Size
-
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
- width: number
set State
-
setState(
culling: boolean,
zOffset?: number,
force?: boolean,
reverseSide?: boolean,
cullBackFaces?: boolean,
stencil?: IStencilState,
zOffsetUnits?: number,
): voidSet 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: booleandefines 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: booleantrue to cull back faces, false to cull front faces (if culling is enabled)
Optionalstencil: IStencilStatestencil states to set
- zOffsetUnits: number = 0
defines the value to apply to zOffsetUnits (0 by default)
Returns void
- culling: boolean
set State Cull Face Type
-
Sets the type of faces to cull
Parameters
OptionalcullBackFaces: booleantrue to cull back faces, false to cull front faces (if culling is enabled)
Optionalforce: booleandefines if states must be applied even if cache is up to date
Returns void
set Stencil Back Function
-
Sets the current back stencil function
Parameters
- stencilFunc: number
defines the new back stencil function to use
Returns void
- stencilFunc: number
set Stencil Back Operation Depth Fail
-
Sets the back stencil operation to use when depth fails
Parameters
- operation: number
defines the back stencil operation to use when depth fails
Returns void
- operation: number
set Stencil Back Operation Fail
-
Sets the back stencil operation to use when stencil fails
Parameters
- operation: number
defines the back stencil operation to use when stencil fails
Returns void
- operation: number
set Stencil Back Operation Pass
-
Sets the back stencil operation to use when stencil passes
Parameters
- operation: number
defines the back stencil operation to use when stencil passes
Returns void
- operation: number
set Stencil Buffer
-
Enable or disable the stencil buffer
Parameters
- enable: boolean
defines if the stencil buffer must be enabled or disabled
Returns void
- enable: boolean
set Stencil Function
-
Sets the current stencil function
Parameters
- stencilFunc: number
defines the new stencil function to use
Returns void
- stencilFunc: number
set Stencil Function Mask
-
Sets the current stencil mask
Parameters
- mask: number
defines the new stencil mask to use
Returns void
- mask: number
set Stencil Function Reference
-
Sets the current stencil reference
Parameters
- reference: number
defines the new stencil reference to use
Returns void
- reference: number
set Stencil Mask
-
Sets the current stencil mask
Parameters
- mask: number
defines the new stencil mask to use
Returns void
- mask: number
set Stencil Operation Depth Fail
-
Sets the stencil operation to use when depth fails
Parameters
- operation: number
defines the stencil operation to use when depth fails
Returns void
- operation: number
set Stencil Operation Fail
-
Sets the stencil operation to use when stencil fails
Parameters
- operation: number
defines the stencil operation to use when stencil fails
Returns void
- operation: number
set Stencil Operation Pass
-
Sets the stencil operation to use when stencil passes
Parameters
- operation: number
defines the stencil operation to use when stencil passes
Returns void
- operation: number
set Texture
-
setTexture(
channel: number,
uniform: Nullable<WebGLUniformLocation>,
texture: Nullable<ThinTexture>,
name: string,
): voidSets a texture to the according uniform.
Parameters
- channel: number
The texture channel
- uniform: Nullable<WebGLUniformLocation>
The uniform to set
- texture: Nullable<ThinTexture>
The texture to apply
- name: string
The name of the uniform in the effect
Returns void
- channel: number
set Texture Array
-
setTextureArray(
channel: number,
uniform: Nullable<WebGLUniformLocation>,
textures: ThinTexture[],
name: string,
): voidSets 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
- channel: number
set Texture Format To Use
-
Set the compressed texture format to use, based on the formats you have, and the formats supported by the hardware / browser.
Khronos Texture Container (.ktx) files are used to support this. This format has the advantage of being specifically designed for OpenGL. Header elements directly correspond to API arguments needed to compressed textures. This puts the burden on the container generator to house the arcane code for determining these for current & future formats.
for description see https://www.khronos.org/opengles/sdk/tools/KTX/ for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
Note: The result of this call is not taken into account when a texture is base64.
Parameters
- formatsAvailable: string[]
defines the list of those format families you have created on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)
Current families are astc, dxt, pvrtc, etc2, & etc1.
Returns Nullable<string>
The extension selected.
- formatsAvailable: string[]
set Texture From Post Process
-
setTextureFromPostProcess(
channel: number,
postProcess: Nullable<PostProcess>,
name: string,
): voidSets a texture to the context from a postprocess
Parameters
- channel: number
defines the channel to use
- postProcess: Nullable<PostProcess>
defines the source postprocess
- name: string
name of the channel
Returns void
- channel: number
set Texture From Post Process Output
-
setTextureFromPostProcessOutput(
channel: number,
postProcess: Nullable<PostProcess>,
name: string,
): voidBinds the output of the passed in post process to the texture channel specified
Parameters
- channel: number
The channel the texture should be bound to
- postProcess: Nullable<PostProcess>
The post process which's output should be bound
- name: string
name of the channel
Returns void
- channel: number
set Tranform Feedback Varyings
-
Specify the varyings to use with transform feedback
Parameters
- program: WebGLProgram
defines the associated webGL program
- value: string[]
defines the list of strings representing the varying names
Returns void
- program: WebGLProgram
set U Int
-
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
- uniform: Nullable<WebGLUniformLocation>
set U Int2
-
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
- uniform: Nullable<WebGLUniformLocation>
set U Int3
-
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
- uniform: Nullable<WebGLUniformLocation>
set U Int4
-
setUInt4(
uniform: Nullable<WebGLUniformLocation>,
x: number,
y: number,
z: number,
w: number,
): booleanSet 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
- uniform: Nullable<WebGLUniformLocation>
set U Int Array
-
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
- uniform: Nullable<WebGLUniformLocation>
set U Int Array2
-
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
- uniform: Nullable<WebGLUniformLocation>
set U Int Array3
-
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
- uniform: Nullable<WebGLUniformLocation>
set U Int Array4
-
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
- uniform: Nullable<WebGLUniformLocation>
set Viewport
-
Set the WebGL's viewport
Parameters
- viewport: IViewportLike
defines the viewport element to be used
OptionalrequiredWidth: numberdefines the width required for rendering. If not provided the rendering canvas' width is used
OptionalrequiredHeight: numberdefines the height required for rendering. If not provided the rendering canvas' height is used
Returns void
- viewport: IViewportLike
set Z Offset
-
Set the z offset Factor to apply to current rendering
Parameters
- value: number
defines the offset to apply
Returns void
- value: number
set Z Offset Units
-
Set the z offset Units to apply to current rendering
Parameters
- value: number
defines the offset to apply
Returns void
- value: number
snapshot Rendering Reset
-
Creates a new snapshot at the next frame using the current snapshotRenderingMode
Returns void
start Time Query
-
Starts a time query (used to measure time spent by the GPU on a specific frame) Please note that only one query can be issued at a time
Returns Nullable<_TimeToken>
a time token used to track the time span
stop Render Loop
-
stop executing a render loop function and remove it from the execution array
Parameters
OptionalrenderFunction: () => voiddefines the function to be removed. If not provided all functions will be removed.
Returns void
switch Fullscreen
-
Toggle full screen mode
Parameters
- requestPointerLock: boolean
defines if a pointer lock should be requested from the user
Returns void
- requestPointerLock: boolean
unbind All Attributes
-
Unbind all vertex attributes from the webGL context
Returns void
unbind All Textures
-
Unbind all textures from the webGL context
Returns void
un Bind Framebuffer
-
unBindFramebuffer(
rtWrapper: RenderTargetWrapper,
disableGenerateMipMaps?: boolean,
onBeforeUnbind?: () => void,
): voidUnbind 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: () => voiddefines a function which will be called before the effective unbind
Returns void
- rtWrapper: RenderTargetWrapper
unbind Instance Attributes
-
Unbind all instance attributes
Returns void
un Bind Multi Color Attachment Framebuffer
-
unBindMultiColorAttachmentFramebuffer(
rtWrapper: RenderTargetWrapper,
disableGenerateMipMaps: boolean,
onBeforeUnbind?: () => void,
): voidUnbind a list of render target textures from the webGL context This is used only when drawBuffer extension or webGL2 are active
Parameters
- rtWrapper: RenderTargetWrapper
defines the render target wrapper to unbind
- disableGenerateMipMaps: boolean
defines a boolean indicating that mipmaps must not be generated
OptionalonBeforeUnbind: () => voiddefines a function which will be called before the effective unbind
Returns void
- rtWrapper: RenderTargetWrapper
-
unBindMultiColorAttachmentFramebuffer(
rtWrapper: RenderTargetWrapper,
disableGenerateMipMaps: boolean,
onBeforeUnbind?: () => void,
): voidUnbind a list of render target textures from the webGL context This is used only when drawBuffer extension or webGL2 are active
Parameters
- rtWrapper: RenderTargetWrapper
defines the render target wrapper to unbind
- disableGenerateMipMaps: boolean
defines a boolean indicating that mipmaps must not be generated
OptionalonBeforeUnbind: () => voiddefines a function which will be called before the effective unbind
Returns void
- rtWrapper: RenderTargetWrapper
un Register View
-
Remove a registered child canvas
Parameters
- canvas: HTMLCanvasElement
defines the canvas to remove
Returns AbstractEngine
the current engine
- canvas: HTMLCanvasElement
update And Bind Instances Buffer
-
updateAndBindInstancesBuffer(
instancesBuffer: DataBuffer,
data: Float32Array,
offsetLocations: number[] | InstancingAttributeInfo[],
): voidUpdate the content of a webGL buffer used with instantiation and bind it to the webGL context
Parameters
- instancesBuffer: DataBuffer
defines the webGL buffer to update and bind
- data: Float32Array
defines the data to store in the buffer
- offsetLocations: number[] | InstancingAttributeInfo[]
defines the offsets or attributes information used to determine where data must be stored in the buffer
Returns void
- instancesBuffer: DataBuffer
update Array Buffer
-
update the bound buffer with the given data
Parameters
- data: Float32Array
defines the data to update
Returns void
- data: Float32Array
update Dynamic Index Buffer
-
Update a dynamic index buffer
Parameters
- indexBuffer: WebGLBuffer
defines the target index buffer
- indices: IndicesArray
defines the data to update
- offset: number = 0
defines the offset in the target index buffer where update should start
Returns void
- indexBuffer: WebGLBuffer
update Dynamic Texture
-
updateDynamicTexture(
texture: Nullable<InternalTexture>,
canvas: HTMLCanvasElement,
invertY: boolean,
premulAlpha?: boolean,
format?: number,
): voidUpdate 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: numberdefines the format of the data
Returns void
- texture: Nullable<InternalTexture>
update Dynamic Vertex Buffer
-
updateDynamicVertexBuffer(
vertexBuffer: WebGLBuffer,
vertices: FloatArray,
byteOffset?: number,
byteLength?: number,
): voidUpdates a dynamic vertex buffer.
Parameters
- vertexBuffer: WebGLBuffer
the vertex buffer to update
- vertices: FloatArray
the data used to update the vertex buffer
OptionalbyteOffset: numberthe byte offset of the data (optional)
OptionalbyteLength: numberthe byte length of the data (optional)
Returns void
- vertexBuffer: WebGLBuffer
update Multiple Render Target Texture Sample Count
-
updateMultipleRenderTargetTextureSampleCount(
rtWrapper: Nullable<RenderTargetWrapper>,
samples: number,
initializeBuffers?: boolean,
): numberUpdate the sample count for a given multiple render target texture
Parameters
- rtWrapper: Nullable<RenderTargetWrapper>
defines the render target wrapper to update
- samples: number
defines the sample count to set
OptionalinitializeBuffers: booleanif set to true, the engine will make an initializing call of drawBuffers
Returns number
the effective sample count (could be 0 if multisample render targets are not supported)
- rtWrapper: Nullable<RenderTargetWrapper>
-
updateMultipleRenderTargetTextureSampleCount(
rtWrapper: Nullable<RenderTargetWrapper>,
samples: number,
initializeBuffers?: boolean,
): numberUpdate the sample count for a given multiple render target texture
Parameters
- rtWrapper: Nullable<RenderTargetWrapper>
defines the render target wrapper to update
- samples: number
defines the sample count to set
OptionalinitializeBuffers: booleanif set to true, the engine will make an initializing call of drawBuffers
Returns number
the effective sample count (could be 0 if multisample render targets are not supported)
- rtWrapper: Nullable<RenderTargetWrapper>
update Raw Cube Texture
-
updateRawCubeTexture(
texture: InternalTexture,
data: ArrayBufferView<ArrayBufferLike>[],
format: number,
type: number,
invertY: boolean,
): voidUpdate 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
- texture: InternalTexture
-
updateRawCubeTexture(
texture: InternalTexture,
data: ArrayBufferView<ArrayBufferLike>[],
format: number,
type: number,
invertY: boolean,
compression: Nullable<string>,
): voidUpdate 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
- texture: InternalTexture
-
updateRawCubeTexture(
texture: InternalTexture,
data: ArrayBufferView<ArrayBufferLike>[],
format: number,
type: number,
invertY: boolean,
compression: Nullable<string>,
level: number,
): voidUpdate 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
- texture: InternalTexture
-
updateRawCubeTexture(
texture: InternalTexture,
data: ArrayBufferView<ArrayBufferLike>[],
format: number,
type: number,
invertY: boolean,
): voidUpdate 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
- texture: InternalTexture
-
updateRawCubeTexture(
texture: InternalTexture,
data: ArrayBufferView<ArrayBufferLike>[],
format: number,
type: number,
invertY: boolean,
compression: Nullable<string>,
): voidUpdate 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
- texture: InternalTexture
-
updateRawCubeTexture(
texture: InternalTexture,
data: ArrayBufferView<ArrayBufferLike>[],
format: number,
type: number,
invertY: boolean,
compression: Nullable<string>,
level: number,
): voidUpdate 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
- texture: InternalTexture
update Raw Texture
-
updateRawTexture(
texture: Nullable<InternalTexture>,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
compression?: Nullable<string>,
type?: number,
useSRGBBuffer?: boolean,
): voidUpdate 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
- texture: Nullable<InternalTexture>
update Raw Texture2 D Array
-
updateRawTexture2DArray(
texture: InternalTexture,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
): voidUpdate a raw 2D array texture
Parameters
- texture: InternalTexture
defines the texture to update
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
defines the data to store
- format: number
defines the data format
- invertY: boolean
defines if data must be stored with Y axis inverted
Returns void
- texture: InternalTexture
-
updateRawTexture2DArray(
texture: InternalTexture,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
compression: Nullable<string>,
textureType: number,
): voidUpdate a raw 2D array texture
Parameters
- texture: InternalTexture
defines the texture to update
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
defines the data to store
- format: number
defines the data format
- invertY: boolean
defines if data must be stored with Y axis inverted
- compression: Nullable<string>
defines the used compression (can be null)
- textureType: number
defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
Returns void
- texture: InternalTexture
-
updateRawTexture2DArray(
texture: InternalTexture,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
): voidUpdate a raw 2D array texture
Parameters
- texture: InternalTexture
defines the texture to update
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
defines the data to store
- format: number
defines the data format
- invertY: boolean
defines if data must be stored with Y axis inverted
Returns void
- texture: InternalTexture
-
updateRawTexture2DArray(
texture: InternalTexture,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
compression: Nullable<string>,
textureType: number,
): voidUpdate a raw 2D array texture
Parameters
- texture: InternalTexture
defines the texture to update
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
defines the data to store
- format: number
defines the data format
- invertY: boolean
defines if data must be stored with Y axis inverted
- compression: Nullable<string>
defines the used compression (can be null)
- textureType: number
defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
Returns void
- texture: InternalTexture
-
updateRawTexture2DArray(
texture: InternalTexture,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
compression: Nullable<string>,
textureType: number,
mipLevel?: number,
): voidUpdate a raw 2D array texture
Parameters
- texture: InternalTexture
defines the texture to update
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
defines the data to store
- format: number
defines the data format
- invertY: boolean
defines if data must be stored with Y axis inverted
- compression: Nullable<string>
defines the used compression (can be null)
- textureType: number
defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
OptionalmipLevel: numberdefines which mipLevel of the texture is going to be updated
Returns void
- texture: InternalTexture
update Raw Texture3 D
-
updateRawTexture3D(
texture: InternalTexture,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
): voidUpdate a raw 3D texture
Parameters
- texture: InternalTexture
defines the texture to update
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
defines the data to store
- format: number
defines the data format
- invertY: boolean
defines if data must be stored with Y axis inverted
Returns void
- texture: InternalTexture
-
updateRawTexture3D(
texture: InternalTexture,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
compression: Nullable<string>,
textureType: number,
): voidUpdate a raw 3D texture
Parameters
- texture: InternalTexture
defines the texture to update
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
defines the data to store
- format: number
defines the data format
- invertY: boolean
defines if data must be stored with Y axis inverted
- compression: Nullable<string>
defines the used compression (can be null)
- textureType: number
defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
Returns void
- texture: InternalTexture
-
updateRawTexture3D(
texture: InternalTexture,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
): voidUpdate a raw 3D texture
Parameters
- texture: InternalTexture
defines the texture to update
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
defines the data to store
- format: number
defines the data format
- invertY: boolean
defines if data must be stored with Y axis inverted
Returns void
- texture: InternalTexture
-
updateRawTexture3D(
texture: InternalTexture,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
compression: Nullable<string>,
textureType: number,
): voidUpdate a raw 3D texture
Parameters
- texture: InternalTexture
defines the texture to update
- data: Nullable<ArrayBufferView<ArrayBufferLike>>
defines the data to store
- format: number
defines the data format
- invertY: boolean
defines if data must be stored with Y axis inverted
- compression: Nullable<string>
defines the used compression (can be null)
- textureType: number
defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
Returns void
- texture: InternalTexture
update Render Target Texture Sample Count
-
updateRenderTargetTextureSampleCount(
rtWrapper: Nullable<RenderTargetWrapper>,
samples: number,
): numberUpdates the sample count of a render target texture
Parameters
- rtWrapper: Nullable<RenderTargetWrapper>
defines the render target wrapper to update
- samples: number
defines the sample count to set
Returns number
the effective sample count (could be 0 if multisample render targets are not supported)
- rtWrapper: Nullable<RenderTargetWrapper>
-
updateRenderTargetTextureSampleCount(
rtWrapper: Nullable<RenderTargetWrapper>,
samples: number,
): numberUpdates the sample count of a render target texture
Parameters
- rtWrapper: Nullable<RenderTargetWrapper>
defines the render target wrapper to update
- samples: number
defines the sample count to set
Returns number
the effective sample count (could be 0 if multisample render targets are not supported)
- rtWrapper: Nullable<RenderTargetWrapper>
update Texture Array Layer From Image Source
-
updateTextureArrayLayerFromImageSource(
texture: InternalTexture,
source: ImageSource,
layer: number,
invertY?: boolean,
premultiplyAlpha?: boolean,
): voidUploads 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: booleandefines if the source must be stored with the Y axis inverted (false by default)
OptionalpremultiplyAlpha: booleandefines if the source alpha must be premultiplied (false by default)
Returns void
- texture: InternalTexture
update Texture Comparison Function
-
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
- texture: InternalTexture
update Texture Data
-
updateTextureData(
texture: InternalTexture,
imageData: ArrayBufferView,
xOffset: number,
yOffset: number,
width: number,
height: number,
faceIndex?: number,
lod?: number,
generateMipMaps?: boolean,
): voidUpdate 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
- texture: InternalTexture
update Texture Dimensions
-
updateTextureDimensions(
texture: InternalTexture,
width: number,
height: number,
depth?: number,
): voidUpdate the dimensions of a texture
Parameters
- texture: InternalTexture
texture to update
- width: number
new width of the texture
- height: number
new height of the texture
- depth: number = 1
new depth of the texture
Returns void
- texture: InternalTexture
update Texture Sampling Mode
-
Update the sampling mode of a given texture
Parameters
- samplingMode: number
defines the required sampling mode
- texture: InternalTexture
defines the texture to update
Returns void
- samplingMode: number
update Texture Wrapping Mode
-
updateTextureWrappingMode(
texture: InternalTexture,
wrapU: Nullable<number>,
wrapV?: Nullable<number>,
wrapR?: Nullable<number>,
): voidUpdate the sampling mode of a given texture
Parameters
- texture: InternalTexture
defines the texture to update
- wrapU: Nullable<number>
defines the texture wrap mode of the u coordinates
- wrapV: Nullable<number> = null
defines the texture wrap mode of the v coordinates
- wrapR: Nullable<number> = null
defines the texture wrap mode of the r coordinates
Returns void
- texture: InternalTexture
update Uniform Buffer
-
updateUniformBuffer(
_uniformBuffer: DataBuffer,
_elements: FloatArray,
_offset?: number,
_count?: number,
): voidUpdates a uniform buffer.
Parameters
- _uniformBuffer: DataBuffer
defines the target uniform buffer
- _elements: FloatArray
defines the content to update
Optional_offset: numberdefines the offset in the uniform buffer where update should start
Optional_count: numberdefines the size of the data to update
Returns void
- _uniformBuffer: DataBuffer
update Video Texture
-
updateVideoTexture(
texture: Nullable<InternalTexture>,
video: HTMLVideoElement | Nullable<ExternalTexture>,
invertY: boolean,
): voidUpdate a video texture
Parameters
- texture: Nullable<InternalTexture>
defines the texture to update
- video: HTMLVideoElement | Nullable<ExternalTexture>
defines the video element to use
- invertY: boolean
defines if data must be stored with Y axis inverted
Returns void
- texture: Nullable<InternalTexture>
-
updateVideoTexture(
texture: Nullable<InternalTexture>,
video: HTMLVideoElement | Nullable<ExternalTexture>,
invertY: boolean,
): voidUpdate a video texture
Parameters
- texture: Nullable<InternalTexture>
defines the texture to update
- video: HTMLVideoElement | Nullable<ExternalTexture>
defines the video element to use
- invertY: boolean
defines if data must be stored with Y axis inverted
Returns void
- texture: Nullable<InternalTexture>
update Wrapped Web GL Texture
-
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
- internalTexture: InternalTexture
wipe Caches
-
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: booleandefines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)
Returns void
wrap Web GL Texture
-
wrapWebGLTexture(
texture: WebGLTexture,
hasMipMaps?: boolean,
samplingMode?: number,
width?: number,
height?: number,
): InternalTextureWraps 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
- texture: WebGLTexture
StaticDefault Loading Screen Factory
-
Method called to create the default loading screen. This can be overridden in your own app.
Parameters
- canvas: HTMLCanvasElement
The rendering canvas element
Returns ILoadingScreen
The loading screen
- canvas: HTMLCanvasElement
Staticis Supported
-
Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)
Returns boolean
true if the engine can be created
StaticMark All Materials As Dirty
-
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) => booleandefines a predicate used to filter which materials should be affected
Returns void
- flag: number
The null engine class provides support for headless version of babylon.js. This can be used in server side scenario or for testing purposes