Class ThinEngine
Hierarchy (View Summary)
- AbstractEngine
- ThinEngine
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
new ThinEngine(
canvasOrContext: Nullable<
| HTMLCanvasElement
| OffscreenCanvas
| WebGLRenderingContext
| WebGL2RenderingContext,
>,
antialias?: boolean,
options?: EngineOptions,
adaptToDeviceRatio?: boolean,
): ThinEngineCreates a new engine
Parameters
- canvasOrContext: Nullable<
| HTMLCanvasElement
| OffscreenCanvas
| WebGLRenderingContext
| WebGL2RenderingContext,
>defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which already used the WebGL context
Optionalantialias: booleandefines whether anti-aliasing should be enabled (default value is "undefined", meaning that the browser may or may not enable it)
Optionaloptions: EngineOptionsdefines further options to be sent to the getContext() function
OptionaladaptToDeviceRatio: booleandefines whether to adapt to the device's viewport characteristics (default: false)
Returns ThinEngine
- canvasOrContext: Nullable<
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
loading UI Text
Sets the current loading screen text
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.
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
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
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
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
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
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
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
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>
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>
- 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
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]: Nullable<VertexBuffer> },
indexBuffer: Nullable<DataBuffer>,
effect: Effect,
overrideVertexBuffers?: { [kind: string]: Nullable<VertexBuffer> },
): voidBind a list of vertex buffers to the webGL context
Parameters
- vertexBuffers: { [key: string]: Nullable<VertexBuffer> }
defines the list of vertex buffers to bind
- indexBuffer: Nullable<DataBuffer>
defines the index buffer to bind
- effect: Effect
defines the effect associated with the vertex buffers
OptionaloverrideVertexBuffers: { [kind: string]: Nullable<VertexBuffer> }defines optional list of avertex buffers that overrides the entries in vertexBuffers
Returns void
- vertexBuffers: { [key: string]: Nullable<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,
lodLevel?: number,
layer?: number,
): voidBinds the frame buffer to the specified texture.
Parameters
- rtWrapper: RenderTargetWrapper
The render target wrapper to render to
- faceIndex: number = 0
The face of the texture to render to in case of cube texture and if the render target wrapper is not a multi render target
OptionalrequiredWidth: 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
- lodLevel: number = 0
Defines the lod level to bind to the frame buffer
- layer: number = 0
Defines the 2d array index to bind to the frame buffer if the render target wrapper is not a multi render target
Returns void
- 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 Samplers
-
Binds an effect to the webGL context
Parameters
- effect: Effect
defines the effect to bind
Returns void
- effect: Effect
bind Uniform Block
-
Bind a specific block at a given index in a specific shader program
Parameters
- pipelineContext: IPipelineContext
defines the pipeline context to use
- blockName: string
defines the block name
- index: number
defines the index where to bind the block
Returns void
- pipelineContext: IPipelineContext
-
Bind a specific block at a given index in a specific shader program
Parameters
- pipelineContext: IPipelineContext
defines the pipeline context to use
- blockName: string
defines the block name
- index: number
defines the index where to bind the block
Returns void
- 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
-
Bind a buffer to the current webGL context at a given location
Parameters
- buffer: DataBuffer
defines the buffer to bind
- location: number
defines the index where to bind the buffer
- name: string
Name of the uniform variable to bind
Returns void
- 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(
color: Nullable<IColor4Like>,
backBuffer: boolean,
depth: boolean,
stencil?: boolean,
stencilClearValue?: number,
): voidClear the current render buffer or the current render target (if any is set up)
Parameters
- color: Nullable<IColor4Like>
defines the color to use
- backBuffer: boolean
defines if the back buffer must be cleared
- depth: boolean
defines if the depth buffer must be cleared
- stencil: boolean = false
defines if the stencil buffer must be cleared
- stencilClearValue: number = 0
defines the value to use to clear the stencil buffer (default is 0)
Returns void
- color: Nullable<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
-
Create a dynamic uniform buffer
Parameters
- elements: FloatArray
defines the content of the uniform buffer
Optionallabel: stringdefines a name for the buffer (for debugging purpose)
Returns DataBuffer
the webGL uniform buffer
- elements: FloatArray
create Dynamic Vertex Buffer
-
Creates a dynamic vertex buffer
Parameters
- data: number | DataArray
the data for the dynamic vertex buffer
Optional_label: stringdefines the label of the buffer (for debug purpose)
Returns DataBuffer
the new WebGL dynamic buffer
- data: number | DataArray
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
Optionalupdatable: booleandefines if the index buffer must be updatable
Optional_label: stringdefines the label of the buffer (for debug purpose)
Returns DataBuffer
a new webGL buffer
- indices: IndicesArray
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 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,
mipLevelCount?: number,
): 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)
Optionalcompression: Nullable<string>defines the compression used (null by default)
Optionaltype: numberdefines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)
OptionalcreationFlags: numberspecific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
OptionaluseSRGBBuffer: booleandefines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
OptionalmipLevelCount: numberdefines the number of mip levels to allocate for the texture
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 cube 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 cube wrapper
- size: number
-
createRenderTargetCubeTexture(
size: number,
options?: RenderTargetCreationOptions,
): RenderTargetWrapperCreates a new render target cube 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 cube wrapper
- size: number
create Render Target Texture
-
createRenderTargetTexture(
size: TextureSize,
options: boolean | RenderTargetCreationOptions,
): RenderTargetWrapperCreates a new render target texture
Parameters
- size: TextureSize
defines the size of the texture
- options: boolean | RenderTargetCreationOptions
defines the options used to create the texture
Returns RenderTargetWrapper
a new render target wrapper ready to render texture
- size: TextureSize
-
createRenderTargetTexture(
size: TextureSize,
options: boolean | RenderTargetCreationOptions,
): RenderTargetWrapperCreates a new render target texture
Parameters
- size: TextureSize
defines the size of the texture
- options: boolean | RenderTargetCreationOptions
defines the options used to create the texture
Returns RenderTargetWrapper
a new render target wrapper ready to render texture
- size: TextureSize
create Shader Program
-
createShaderProgram(
pipelineContext: IPipelineContext,
vertexCode: string,
fragmentCode: string,
defines: Nullable<string>,
context?: WebGLRenderingContext,
transformFeedbackVaryings?: Nullable<string[]>,
): 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: Nullable<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)
- transformFeedbackVaryings: Nullable<string[]> = null
defines the list of transform feedback varyings to use
Returns WebGLProgram
the new webGL program
- pipelineContext: IPipelineContext
create Texture
-
createTexture(
url: 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,
loaderOptions?: any,
creationFlags?: number,
useSRGBBuffer?: boolean,
): InternalTextureUsually called from Texture.ts. Passed information to create a WebGLTexture
Parameters
- url: Nullable<string>
defines a value which contains one of the following:
- A conventional http URL, e.g. 'http://...' or 'file://...'
- A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
- An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
- noMipmap: boolean
defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file
- invertY: boolean
when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)
- scene: Nullable<ISceneLike>
needed for loading to the correct scene
- samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE
mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)
- onLoad: Nullable<(texture: InternalTexture) => void> = null
optional callback to be called upon successful completion
- onError: Nullable<(message: string, exception: any) => void> = null
optional callback to be called upon failure
- buffer: Nullable<
| string
| ArrayBuffer
| ArrayBufferView<ArrayBufferLike>
| HTMLImageElement
| ImageBitmap
| Blob,
> = 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
OptionalloaderOptions: anyoptions to be passed to the loader
OptionalcreationFlags: numberspecific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
OptionaluseSRGBBuffer: booleandefines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
Returns InternalTexture
a InternalTexture for assignment back into BABYLON.Texture
- url: Nullable<string>
create Uniform Buffer
-
Create an uniform buffer
Parameters
- elements: FloatArray
defines the content of the uniform buffer
Optionallabel: stringdefines a name for the buffer (for debugging purpose)
Returns DataBuffer
the webGL uniform buffer
- elements: FloatArray
create Vertex Buffer
-
Creates a vertex buffer
Parameters
- data: number | DataArray
the data or size for the vertex buffer
Optional_updatable: booleanwhether the buffer should be created as updatable
Optional_label: stringdefines the label of the buffer (for debug purpose)
Returns DataBuffer
the new WebGL static buffer
- data: number | DataArray
create Video Element
-
creates and returns a new video element
Parameters
- constraints: MediaTrackConstraints
video constraints
Returns any
video element
- constraints: MediaTrackConstraints
delete Query
-
Delete and release a webGL query
Parameters
- query: OcclusionQuery
defines the query to delete
Returns AbstractEngine
the current engine
- query: OcclusionQuery
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
enter Fullscreen
-
Enters full screen mode
Parameters
- requestPointerLock: boolean
defines if a pointer lock should be requested from the user
Returns void
- requestPointerLock: boolean
exit Fullscreen
-
Exits full screen 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 list of active attributes for a given webGL program
Parameters
- pipelineContext: IPipelineContext
defines the pipeline context to use
- attributesNames: string[]
defines the list of attribute names to get
Returns number[]
an array of indices indicating the offset of each attribute
- 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 Error
-
Get the current error code of the webGL context
Returns number
the error code
get Font Offset
-
Get Font size information
Parameters
- font: string
font name
Returns { ascent: number; descent: number; height: number }
- font: string
get Fps
-
Gets the current framerate
Returns number
a number representing the framerate
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 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
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
- 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
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)
OptionalnoDepthWriteChange: booleandefines if depth writing state should remains unchanged (false by default)
OptionaltargetIndex: numberdefines the index of the target to set the alpha mode for (default is 0)
Returns void
- mode: number
-
Sets the current alpha mode
Parameters
- mode: number
defines the mode to use (one of the Engine.ALPHA_XXX)
OptionalnoDepthWriteChange: booleandefines if depth writing state should remains unchanged (false by default)
OptionaltargetIndex: numberdefines 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: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- array: FloatArray
defines the array of number to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Array2
-
Set the value of an uniform to an array of number (stored as vec2)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- array: FloatArray
defines the array of number to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Array3
-
Set the value of an uniform to an array of number (stored as vec3)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- array: FloatArray
defines the array of number to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Array4
-
Set the value of an uniform to an array of number (stored as vec4)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- array: FloatArray
defines the array of number to store
Returns boolean
true if the value was set
- uniform: Nullable<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 Float
-
Set the value of an uniform to a number (float)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- value: number
defines the float number to store
Returns boolean
true if the value was transferred
- uniform: Nullable<WebGLUniformLocation>
set Float2
-
Set the value of an uniform to a vec2
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- x: number
defines the 1st component of the value
- y: number
defines the 2nd component of the value
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Float3
-
Set the value of an uniform to a vec3
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- x: number
defines the 1st component of the value
- y: number
defines the 2nd component of the value
- z: number
defines the 3rd component of the value
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Float4
-
setFloat4(
uniform: Nullable<WebGLUniformLocation>,
x: number,
y: number,
z: number,
w: number,
): booleanSet the value of an uniform to a vec4
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- x: number
defines the 1st component of the value
- y: number
defines the 2nd component of the value
- z: number
defines the 3rd component of the value
- w: number
defines the 4th component of the value
Returns boolean
true if the value was set
- uniform: Nullable<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: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- array: Int32Array
defines the array of int32 to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Int Array2
-
Set the value of an uniform to an array of int32 (stored as vec2)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- array: Int32Array
defines the array of int32 to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Int Array3
-
Set the value of an uniform to an array of int32 (stored as vec3)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- array: Int32Array
defines the array of int32 to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Int Array4
-
Set the value of an uniform to an array of int32 (stored as vec4)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- array: Int32Array
defines the array of int32 to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Matrices
-
setMatrices(
uniform: Nullable<WebGLUniformLocation>,
matrices: DeepImmutable<FloatArray>,
): booleanSet the value of an uniform to an array of float32 (stored as matrices)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- matrices: DeepImmutable<FloatArray>
defines the array of float32 to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Matrix2x2
-
Set the value of an uniform to a matrix (2x2)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- matrix: Float32Array
defines the Float32Array representing the 2x2 matrix to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
set Matrix3x3
-
Set the value of an uniform to a matrix (3x3)
Parameters
- uniform: Nullable<WebGLUniformLocation>
defines the webGL uniform location where to store the value
- matrix: Float32Array
defines the Float32Array representing the 3x3 matrix to store
Returns boolean
true if the value was set
- uniform: Nullable<WebGLUniformLocation>
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 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(
texture: RenderTargetWrapper,
disableGenerateMipMaps?: boolean,
onBeforeUnbind?: () => void,
): voidUnbind the current render target texture from the webGL context
Parameters
- texture: RenderTargetWrapper
defines the render target wrapper to unbind
OptionaldisableGenerateMipMaps: booleandefines a boolean indicating that mipmaps must not be generated
OptionalonBeforeUnbind: () => voiddefines a function which will be called before the effective unbind
Returns void
- texture: 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: DataBuffer
defines the target index buffer
- indices: IndicesArray
defines the data to update
Optionaloffset: numberdefines the offset in the target index buffer where update should start
Returns void
- indexBuffer: DataBuffer
update Dynamic Texture
-
updateDynamicTexture(
texture: Nullable<InternalTexture>,
source: ICanvas | ImageSource,
invertY?: boolean,
premulAlpha?: boolean,
format?: number,
forceBindTexture?: boolean,
allowGPUOptimization?: boolean,
): voidUpdate the content of a dynamic texture
Parameters
- texture: Nullable<InternalTexture>
defines the texture to update
- source: ICanvas | ImageSource
defines the source containing the data
OptionalinvertY: booleandefines if data must be stored with Y axis inverted
OptionalpremulAlpha: booleandefines if alpha is stored as premultiplied
Optionalformat: numberdefines the format of the data
OptionalforceBindTexture: booleanif the texture should be forced to be bound eg. after a graphics context loss (Default: false)
OptionalallowGPUOptimization: booleantrue to allow some specific GPU optimizations (subject to engine feature "allowGPUOptimizationsForGUI" being true)
Returns void
- texture: Nullable<InternalTexture>
-
updateDynamicTexture(
texture: Nullable<InternalTexture>,
source: ICanvas | ImageSource,
invertY?: boolean,
premulAlpha?: boolean,
format?: number,
forceBindTexture?: boolean,
allowGPUOptimization?: boolean,
): voidUpdate the content of a dynamic texture
Parameters
- texture: Nullable<InternalTexture>
defines the texture to update
- source: ICanvas | ImageSource
defines the source containing the data
OptionalinvertY: booleandefines if data must be stored with Y axis inverted
OptionalpremulAlpha: booleandefines if alpha is stored as premultiplied
Optionalformat: numberdefines the format of the data
OptionalforceBindTexture: booleanif the texture should be forced to be bound eg. after a graphics context loss (Default: false)
OptionalallowGPUOptimization: booleantrue to allow some specific GPU optimizations (subject to engine feature "allowGPUOptimizationsForGUI" being true)
Returns void
- texture: Nullable<InternalTexture>
update Dynamic Vertex Buffer
-
updateDynamicVertexBuffer(
vertexBuffer: DataBuffer,
data: DataArray,
byteOffset?: number,
byteLength?: number,
): voidUpdates a dynamic vertex buffer.
Parameters
- vertexBuffer: DataBuffer
the vertex buffer to update
- data: DataArray
the data used to update the vertex buffer
OptionalbyteOffset: numberthe byte offset of the data
OptionalbyteLength: numberthe byte length of the data
Returns void
- vertexBuffer: DataBuffer
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,
): 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
Returns void
- texture: Nullable<InternalTexture>
-
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>
defines the compression used (null by default)
- type: number
defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)
- useSRGBBuffer: boolean
defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
Returns void
- texture: Nullable<InternalTexture>
-
updateRawTexture(
texture: Nullable<InternalTexture>,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: 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
Returns void
- texture: Nullable<InternalTexture>
-
updateRawTexture(
texture: Nullable<InternalTexture>,
data: Nullable<ArrayBufferView<ArrayBufferLike>>,
format: number,
invertY: boolean,
compression: Nullable<string>,
type: number,
useSRGBBuffer: boolean,
mipLevel?: number,
): 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>
defines the compression used (null by default)
- type: number
defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)
- useSRGBBuffer: boolean
defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
OptionalmipLevel: numberdefines which mipLevel of the texture is going to be updated
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 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
-
updateTextureSamplingMode(
samplingMode: number,
texture: InternalTexture,
generateMipMaps?: boolean,
): voidUpdate the sampling mode of a given texture
Parameters
- samplingMode: number
defines the required sampling mode
- texture: InternalTexture
defines the texture to update
- generateMipMaps: boolean = false
defines whether to generate mipmaps for the texture
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,
): voidUpdate an existing uniform buffer
Parameters
- uniformBuffer: DataBuffer
defines the target uniform buffer
- elements: FloatArray
defines the content to update
Optionaloffset: numberdefines the offset in the uniform buffer where update should start
Optionalcount: 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>
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
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
- 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 base engine class (root of all engines)