CLASSES
TagsA - Z

Engine

Engine

Description

class Engine

The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.

Constructor

new Engine(canvas, antialias, options, adaptToDeviceRatio)

@constructor

Parameters

Name Type Description
canvas HTMLCanvasElement The canvas
optional antialias boolean True if this engine should support antialiasing, false otherwise.
optional options EngineOptions - further options to be sent to the getContext function Can contains these parameters : generateDepthBuffer, generateMipMaps, samplingMode

Members

static Instances : Engine[]

static LastCreatedEngine : Engine

static LastCreatedScene : Scene

static NEVER : number

static ALWAYS : number

static LESS : number

static EQUAL : number

static LEQUAL : number

static GREATER : number

static GEQUAL : number

static NOTEQUAL : number

static KEEP : number

static REPLACE : number

static INCR : number

static DECR : number

static INVERT : number

static INCR_WRAP : number

static DECR_WRAP : number

static ALPHA_DISABLE : number

Alpha disable

static ALPHA_ONEONE : number

static ALPHA_ADD : number

Add Alpha

static ALPHA_COMBINE : number

Combine Alpha

static ALPHA_SUBTRACT : number

static ALPHA_MULTIPLY : number

static ALPHA_MAXIMIZED : number

static ALPHA_PREMULTIPLIED : number

static ALPHA_PREMULTIPLIED_PORTERDUFF : number

static ALPHA_INTERPOLATE : number

static ALPHA_SCREENMODE : number

static DELAYLOADSTATE_NONE : number

The delay when you don't load

static DELAYLOADSTATE_LOADED : number

The delay for loaded

static DELAYLOADSTATE_LOADING : number

The delay of loading

static DELAYLOADSTATE_NOTLOADED : number

The delay

static TEXTUREFORMAT_ALPHA : number

static TEXTUREFORMAT_LUMINANCE : number

static TEXTUREFORMAT_LUMINANCE_ALPHA : number

static TEXTUREFORMAT_RGB : number

static TEXTUREFORMAT_RGBA : number

static TEXTURETYPE_UNSIGNED_INT : number

static TEXTURETYPE_FLOAT : number

static TEXTURETYPE_HALF_FLOAT : number

static SCALEMODE_FLOOR : number

static SCALEMODE_NEAREST : number

static SCALEMODE_CEILING : number

static Version : string

static CollisionsEpsilon : number

This member is static : use Engine.CollisionsEpsilon

Default value : 0.001

static CodeRepository : string

static ShadersRepository : string

This member is static : use Engine.ShadersRepository

Default value : "Babylon/Shaders/"

Used as the source directory of shaders on the host machine

isFullscreen : boolean

Default value: false

True if fullscreen, false otherwise

isPointerLock : boolean

Default value: false

True if the pointer is locked, false otherwise

cullBackFaces : boolean

Default value: true

True if back faces should be culled, false otherwise

renderEvenInBackground : boolean

Default value: true

If true, the engine will compute all frames even if the app is in background

preventCacheWipeBetweenFrames : boolean

enableOfflineSupport : undefined

scenes : Scene[]

An array of Scene

onResizeObservable : Observable<Engine>

Observable event triggered each time the rendering canvas is resized

onCanvasBlurObservable : Observable<Engine>

Observable event triggered each time the canvas lost focus

vrDisplaysPromise : any

static audioEngine : AudioEngine

texturesSupported : Array<string>

textureFormatInUse : string

emptyTexture : WebGLTexture

emptyCubeTexture : WebGLTexture

webGLVersion : number

isStencilEnable : boolean

Returns true if the stencil buffer has been enabled through the creation option of the context.

drawCalls : number

The number of draw calls submitted last frame

drawCallsPerfCounter : PerfCounter

onLoad : undefined

Methods

static MarkAllMaterialsAsDirty(flag, predicate) void

Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation

Parameters

Name Type Description
flag number
optional predicate (mat: Material) => boolean

resetTextureCache() void

getGlInfo() { vendor: string, renderer: string, version: string }

getAspectRatio(camera, useScreen) number

Parameters

Name Type Description
camera Camera @param camera
optional useScreen boolean

getRenderWidth(useScreen) number

Parameters

Name Type Description
optional useScreen boolean

getRenderHeight(useScreen) number

Parameters

Name Type Description
optional useScreen boolean

getRenderingCanvas() HTMLCanvasElement

Returns the rendering canvas

getRenderingCanvasClientRect() ClientRect

setHardwareScalingLevel(level) void

Set the hardware scaling level. The engine is then resized with these new parameters (width/level, height/level).

Parameters

Name Type Description
level number @param level

getHardwareScalingLevel() number

Returns the hardware scaling level

getLoadedTexturesCache() WebGLTexture[]

Returns all loaded textures from the caches

getCaps() EngineCapabilities

Returns the engine capabilities

getDepthFunction() number

setDepthFunction(depthFunc) void

Parameters

Name Type Description
depthFunc number

setDepthFunctionToGreater() void

Set the Depth function to greater

setDepthFunctionToGreaterOrEqual() void

Set the Depth function to greater or equal

setDepthFunctionToLess() void

Set the Depth function to less

setDepthFunctionToLessOrEqual() void

Set the Depth function to less or equal

getStencilBuffer() boolean

setStencilBuffer(enable) void

Parameters

Name Type Description
enable boolean Set true if the alpha testing is enabled, false otherwise.

getStencilMask() number

setStencilMask(mask) void

Parameters

Name Type Description
mask number

getStencilFunction() number

getStencilFunctionReference() number

getStencilFunctionMask() number

setStencilFunction(stencilFunc) void

Parameters

Name Type Description
stencilFunc number

setStencilFunctionReference(reference) void

Parameters

Name Type Description
reference number

setStencilFunctionMask(mask) void

Parameters

Name Type Description
mask number

getStencilOperationFail() number

getStencilOperationDepthFail() number

getStencilOperationPass() number

setStencilOperationFail(operation) void

Parameters

Name Type Description
operation number

setStencilOperationDepthFail(operation) void

Parameters

Name Type Description
operation number

setStencilOperationPass(operation) void

Parameters

Name Type Description
operation number

setDitheringState(value) void

Parameters

Name Type Description
value boolean @param value

stopRenderLoop(renderFunction) void

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

Parameters

Name Type Description
optional renderFunction () => void @param renderFunction

runRenderLoop(renderFunction) void

Register and execute a render loop. The engine can have more than one render function.

@example

engine.runRenderLoop(function () {

 scene.render()

})

Parameters

Name Type Description
renderFunction () => void @param renderFunction

switchFullscreen(requestPointerLock) void

Toggle full screen mode.

Parameters

Name Type Description
requestPointerLock boolean If true, the user requests a pointer lock

clear(color, backBuffer, depth, stencil) void

Parameters

Name Type Description
color Color4 The clear color used
backBuffer boolean True if this method should clear the color buffer
depth boolean

scissorClear(x, y, width, height, clearColor) void

Parameters

Name Type Description
x number @param x
y number @param y
width number The width of the rectangle
height number The height of the rectangle

setViewport(viewport, requiredWidth, requiredHeight) void

Set the WebGL's viewport

Parameters

Name Type Description
viewport Viewport @param viewport
optional requiredWidth number The required width of the viewport. By defaults, equals to the rendering canvas width
optional requiredHeight number The required height of the viewport. By defaults, equals to the rendering canvas height

setDirectViewport(x, y, width, height) Viewport

Directly set the WebGL Viewport

The x, y, width & height are directly passed to the WebGL call

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

Parameters

Name Type Description
x number @param x
y number @param y
width number The width of the rectangle

beginFrame() void

Method used at the beginning of the frame rendering. Currently, measure the number of frames per seconds (FPS).

endFrame() void

Method used at the end of a frame rendering. Flushes the frame buffer of the canvas.

resize() void

resize the view according to the canvas' size.

@example

window.addEventListener("resize", function () {

 engine.resize();

});

setSize(width, height) void

force a specific size of the canvas

Parameters

Name Type Description
width number The width of the rectangle
height number The height of the rectangle

isVRDevicePresent(callback) void

Parameters

Name Type Description
callback (result: boolean) => void

getVRDevice(name, callback) void

Parameters

Name Type Description
name string
callback (device: any) => void

initWebVR() void

enableVR(vrDevice) void

Parameters

Name Type Description
vrDevice any

disableVR() void

bindFramebuffer(texture, faceIndex, requiredWidth, requiredHeight) void

Parameters

Name Type Description
texture WebGLTexture @param texture
optional faceIndex number
optional requiredWidth number The required width of the viewport. By defaults, equals to the rendering canvas width

unBindFramebuffer(texture, disableGenerateMipMaps, onBeforeUnbind) void

Parameters

Name Type Description
texture WebGLTexture @param texture
optional disableGenerateMipMaps boolean
optional onBeforeUnbind () => void

generateMipMapsForCubemap(texture) void

Parameters

Name Type Description
texture WebGLTexture @param texture

flushFramebuffer() void

Flushes the frame buffer

restoreDefaultFramebuffer() void

Restore the default frame buffer

createUniformBuffer(elements, Float32Array) WebGLBuffer

Parameters

Name Type Description
elements number[] or Float32Array

createDynamicUniformBuffer(elements, Float32Array) WebGLBuffer

Parameters

Name Type Description
elements number[] or Float32Array

updateUniformBuffer(uniformBuffer, elements, Float32Array, offset, count) void

Parameters

Name Type Description
uniformBuffer WebGLBuffer
elements number[] or Float32Array
optional offset number

createVertexBuffer(vertices, Float32Array) WebGLBuffer

Parameters

Name Type Description
vertices number[] or Float32Array The array of vertices

createDynamicVertexBuffer(vertices, Float32Array) WebGLBuffer

Parameters

Name Type Description
vertices number[] or Float32Array The array of vertices

updateDynamicVertexBuffer(vertexBuffer, vertices, Float32Array, offset, count) void

Parameters

Name Type Description
vertexBuffer WebGLBuffer The given vertex buffer
vertices number[] or Float32Array The array of vertices
optional offset number

createIndexBuffer(indices) WebGLBuffer

Create a new index buffer

Parameters

Name Type Description
indices IndicesArray @param indices

bindArrayBuffer(buffer) void

Parameters

Name Type Description
buffer WebGLBuffer The buffer

bindUniformBuffer(buffer) void

Parameters

Name Type Description
optional buffer WebGLBuffer The buffer

bindUniformBufferBase(buffer, location) void

Parameters

Name Type Description
buffer WebGLBuffer The buffer
location number

bindUniformBlock(shaderProgram, blockName, index) void

Parameters

Name Type Description
shaderProgram WebGLProgram The given shader program
blockName string
index number

updateArrayBuffer(data) void

Parameters

Name Type Description
data Float32Array the data object to associate to the key for this Engine instance the data object to associate to the key for this Engine instance

recordVertexArrayObject(vertexBuffers, indexBuffer, effect) WebGLVertexArrayObject

Parameters

Name Type Description
vertexBuffers { [key: string]: VertexBuffer } The given vextex buffer
indexBuffer WebGLBuffer The given index buffer
effect Effect @param effect

bindVertexArrayObject(vertexArrayObject, indexBuffer) void

Parameters

Name Type Description
vertexArrayObject WebGLVertexArrayObject
indexBuffer WebGLBuffer The given index buffer

bindBuffersDirectly(vertexBuffer, indexBuffer, vertexDeclaration, vertexStrideSize, effect) void

Parameters

Name Type Description
vertexBuffer WebGLBuffer The given vertex buffer
indexBuffer WebGLBuffer The given index buffer
vertexDeclaration number[] The given vertex declaration
vertexStrideSize number The given vertex

bindBuffers(vertexBuffers, indexBuffer, effect) void

Parameters

Name Type Description
vertexBuffers { [key: string]: VertexBuffer } The given vextex buffer
indexBuffer WebGLBuffer The given index buffer
effect Effect @param effect

unbindInstanceAttributes() void

releaseVertexArrayObject(vao) void

Parameters

Name Type Description
vao WebGLVertexArrayObject

createInstancesBuffer(capacity) WebGLBuffer

Create a dynamic instance buffer

Parameters

Name Type Description
capacity number The size of this dynamic buffer

deleteInstancesBuffer(buffer) void

Delete an existing instance buffer

Parameters

Name Type Description
buffer WebGLBuffer The buffer

updateAndBindInstancesBuffer(instancesBuffer, data, offsetLocations, InstancingAttributeInfo) void

Parameters

Name Type Description
instancesBuffer WebGLBuffer The instances buffer
data Float32Array the data object to associate to the key for this Engine instance the data object to associate to the key for this Engine instance

applyStates() void

draw(useTriangles, indexStart, indexCount, instancesCount) void

Draw

Parameters

Name Type Description
useTriangles boolean @param useTriangles
indexStart number @param indexStart
indexCount number @param indexCount

drawPointClouds(verticesStart, verticesCount, instancesCount) void

Parameters

Name Type Description
verticesStart number
verticesCount number
optional instancesCount number

drawUnIndexed(useTriangles, verticesStart, verticesCount, instancesCount) void

Parameters

Name Type Description
useTriangles boolean @param useTriangles
verticesStart number
verticesCount number

createEffect(baseName, attributesNamesOrOptions, EffectCreationOptions, uniformsNamesOrEngine, Engine, samplers, defines, fallbacks, onCompiled, onError, indexParameters) Effect

Parameters

Name Type Description
baseName any The base name of the effect (The name of file without .fragment.fx or .vertex.fx)
attributesNamesOrOptions string[] or EffectCreationOptions
uniformsNamesOrEngine string[] or Engine
optional samplers string[] An array of samplers (the objects used to read textures)
optional defines string The shader defines string
optional fallbacks EffectFallbacks @param fallbacks
optional onCompiled (effect: Effect) => void Function launched when the effect is compiled
optional onError (effect: Effect, errors: string) => void Function when error occurs.

createEffectForParticles(fragmentName, uniformsNames, samplers, defines, fallbacks, onCompiled, onError) Effect

Compiled/linked your shaders into a simple object.

Parameters

Name Type Description
fragmentName string The name of the Particules
optional uniformsNames string[] The uniforms names
optional samplers string[] An array of samplers (the objects used to read textures)
optional defines string The shader defines string
optional fallbacks EffectFallbacks @param fallbacks
optional onCompiled (effect: Effect) => void Function launched when the effect is compiled

createShaderProgram(vertexCode, fragmentCode, defines, context) WebGLProgram

Parameters

Name Type Description
vertexCode string The vertex shader code
fragmentCode string The fragment shader code
defines string The shader defines string

getUniforms(shaderProgram, uniformsNames) WebGLUniformLocation[]

Return the uniforms location for the given shader program

Parameters

Name Type Description
shaderProgram WebGLProgram The given shader program
uniformsNames string[] The uniforms names

getAttributes(shaderProgram, attributesNames) number[]

Return the attributes for the given shader program

Parameters

Name Type Description
shaderProgram WebGLProgram The given shader program
attributesNames string[] The name of the attributes

enableEffect(effect) void

Enable effect

Parameters

Name Type Description
effect Effect @param effect

setIntArray(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array Int32Array

setIntArray2(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array Int32Array

setIntArray3(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array Int32Array

setIntArray4(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array Int32Array

setFloatArray(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array Float32Array

setFloatArray2(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array Float32Array

setFloatArray3(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array Float32Array

setFloatArray4(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array Float32Array

setArray(uniform, array) void

Set array of given shader

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array number[]

setArray2(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array number[]

setArray3(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array number[]

setArray4(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
array number[]

setMatrices(uniform, matrices) void

Set matrices for a given shader

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
matrices Float32Array @param matrices

setMatrix(uniform, matrix) void

Set matrix for a given shader

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
matrix Matrix @param matrix

setMatrix3x3(uniform, matrix) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
matrix Float32Array @param matrix

setMatrix2x2(uniform, matrix) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
matrix Float32Array @param matrix

setFloat(uniform, value) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
value number @param value

setFloat2(uniform, x, y) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
x number @param x
y number @param y

setFloat3(uniform, x, y, z) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
x number @param x
y number @param y

setBool(uniform, bool) void

Set bool for this given shader

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
bool number @param bool

setFloat4(uniform, x, y, z, w) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
x number @param x
y number @param y
z number The z axis

setColor3(uniform, color3) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
color3 Color3 The color of the shader

setColor4(uniform, color3, alpha) void

Parameters

Name Type Description
uniform WebGLUniformLocation The uniforms of the shader
color3 Color3 The color of the shader
alpha number The alpha of the shader

setState(culling, zOffset, force, reverseSide) void

Parameters

Name Type Description
culling boolean @param culling
optional zOffset number
optional force boolean @param force

setDepthBuffer(enable) void

Enable or disable the depth buffer

Parameters

Name Type Description
enable boolean Set true if the alpha testing is enabled, false otherwise.

getDepthWrite() boolean

Get the depth mask

setDepthWrite(enable) void

Enables or disables the depth mask

Parameters

Name Type Description
enable boolean Set true if the alpha testing is enabled, false otherwise.

setColorWrite(enable) void

Enables or disables the writing or red, blue, green and alpha

Parameters

Name Type Description
enable boolean Set true if the alpha testing is enabled, false otherwise.

setAlphaConstants(r, g, b, a) void

Parameters

Name Type Description
r number
g number
b number

setAlphaMode(mode, noDepthWriteChange) void

Parameters

Name Type Description
mode number @param mode
optional noDepthWriteChange boolean

getAlphaMode() number

setAlphaTesting(enable) void

Enables or disables the alpha testing

Parameters

Name Type Description
enable boolean Set true if the alpha testing is enabled, false otherwise.

getAlphaTesting() boolean

Returns true if the alpha testing is enabled, false otherwise.

wipeCaches(bruteForce) void

Parameters

Name Type Description
optional bruteForce boolean

setTextureFormatToUse(formatsAvailable) string

Set the compressed texture format to use, based on the formats you have, and the formats

supported by the hardware / browser.

     * Khronos [Texture](/classes/3.0/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.

     * @param {Array<string>} formatsAvailable- 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 The extension selected.

Parameters

Name Type Description
formatsAvailable Array<string>

createTexture(urlArg, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, HTMLImageElement, fallBack, format) WebGLTexture

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

                    1. A conventional http URL, e.g. 'http://...' or 'file://...'

                    2. A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'

                    3. An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'

     * @param {boolean} noMipmap- When true, no mipmaps shall be generated.  Ignored for compressed textures.  They must be in the file.

     * @returns {WebGLTexture} for assignment back into BABYLON.[Texture](/classes/3.0/Texture)

Parameters

Name Type Description
urlArg string
noMipmap boolean Set true if you want to activate Mipmap, false otherwise.
invertY boolean @param invertY
scene Scene The scene where the cube texture
optional samplingMode number
optional onLoad () => void Function when load.
optional onError () => void Function when error occurs.
optional buffer ArrayBuffer or HTMLImageElement The buffer
optional fallBack WebGLTexture

updateRawTexture(texture, data, format, invertY, compression) void

Parameters

Name Type Description
texture WebGLTexture @param texture
data ArrayBufferView the data object to associate to the key for this Engine instance the data object to associate to the key for this Engine instance
format number
invertY boolean @param invertY

createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, compression) WebGLTexture

Parameters

Name Type Description
data ArrayBufferView the data object to associate to the key for this Engine instance the data object to associate to the key for this Engine instance
width number The width of the rectangle
height number The height of the rectangle
format number
generateMipMaps boolean True if you want to generate Mipmap, false otherwise.
invertY boolean @param invertY
samplingMode number

createDynamicTexture(width, height, generateMipMaps, samplingMode) WebGLTexture

Parameters

Name Type Description
width number The width of the rectangle
height number The height of the rectangle
generateMipMaps boolean True if you want to generate Mipmap, false otherwise.

updateTextureSamplingMode(samplingMode, texture) void

Parameters

Name Type Description
samplingMode number
texture WebGLTexture @param texture

updateDynamicTexture(texture, canvas, invertY, premulAlpha, format) void

Parameters

Name Type Description
texture WebGLTexture @param texture
canvas HTMLCanvasElement The canvas
invertY boolean @param invertY
optional premulAlpha boolean

updateVideoTexture(texture, video, invertY) void

Update the given dynamic texture with the video given in parameter

Parameters

Name Type Description
texture WebGLTexture @param texture
video HTMLVideoElement The video
invertY boolean @param invertY

createRenderTargetTexture(size, options) WebGLTexture

Create a new render target texture old version had a "generateMipMaps" arg instead of options. if options.generateMipMaps is undefined, consider that options itself if the generateMipmaps value in the same way, generateDepthBuffer is defaulted to true

Parameters

Name Type Description
size any Can be an object with the two parameters width and height.
options any Can contains these parameters : generateDepthBuffer, generateMipMaps, samplingMode

createMultipleRenderTarget(size, options) WebGLTexture[]

Parameters

Name Type Description
size any Can be an object with the two parameters width and height.
options any Can contains these parameters : generateDepthBuffer, generateMipMaps, samplingMode

updateRenderTargetTextureSampleCount(texture, samples) number

Parameters

Name Type Description
texture WebGLTexture @param texture
samples number

createRenderTargetCubeTexture(size, options) WebGLTexture

Parameters

Name Type Description
size number Can be an object with the two parameters width and height.
optional options any Can contains these parameters : generateDepthBuffer, generateMipMaps, samplingMode

createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, format) WebGLTexture

Parameters

Name Type Description
rootUrl string @param rootUrl
scene Scene The scene where the cube texture
files string[]
optional noMipmap boolean Set true if you want to activate Mipmap, false otherwise.
optional onLoad () => void Function when load.
optional onError () => void Function when error occurs.

updateTextureSize(texture, width, height) void

Parameters

Name Type Description
texture WebGLTexture @param texture
width number The width of the rectangle
height number The height of the rectangle

updateRawCubeTexture(texture, data, format, type, invertY, compression, level) void

Parameters

Name Type Description
texture WebGLTexture @param texture
data ArrayBufferView[] the data object to associate to the key for this Engine instance the data object to associate to the key for this Engine instance
format number
type number
invertY boolean @param invertY
optional compression string

createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression) WebGLTexture

Parameters

Name Type Description
data ArrayBufferView[] the data object to associate to the key for this Engine instance the data object to associate to the key for this Engine instance
size number Can be an object with the two parameters width and height.
format number
type number
generateMipMaps boolean True if you want to generate Mipmap, false otherwise.
invertY boolean @param invertY
samplingMode number

createRawCubeTextureFromUrl(url, scene, size, format, type, noMipmap, callback, mipmmapGenerator) (url, scene, size, format, type, noMipmap, callback, mipmmapGenerator)

Parameters

Name Type Description
url string The texture url
scene Scene The scene where the cube texture
size number Can be an object with the two parameters width and height.
format number
type number
noMipmap boolean Set true if you want to activate Mipmap, false otherwise.
callback (ArrayBuffer: ArrayBuffer) => ArrayBufferView[]