NullEngine

Description

class NullEngine extends Engine

The null engine class provides support for headless version of babylon.js.

This can be used in server side scenario or for testing purposes

Constructor

new NullEngine(options)

Parameters

Name Type Description
optional options NullEngineOptions

Methods

isDeterministicLockStep() boolean

getLockstepMaxSteps() number

createVertexBuffer(vertices) WebGLBuffer

Parameters

Name Type Description
vertices FloatArray

createIndexBuffer(indices) WebGLBuffer

Parameters

Name Type Description
indices IndicesArray

clear(color, backBuffer, depth, stencil) void

Parameters

Name Type Description
color Color4
backBuffer boolean
depth boolean

getRenderWidth(useScreen) number

Parameters

Name Type Description
optional useScreen boolean

getRenderHeight(useScreen) number

Parameters

Name Type Description
optional useScreen boolean

setViewport(viewport, requiredWidth, requiredHeight) void

Parameters

Name Type Description
viewport Viewport
optional requiredWidth number
optional requiredHeight number

createShaderProgram(vertexCode, fragmentCode, defines, context) WebGLProgram

Parameters

Name Type Description
vertexCode string
fragmentCode string
defines string

getUniforms(shaderProgram, uniformsNames) WebGLUniformLocation[]

Parameters

Name Type Description
shaderProgram WebGLProgram
uniformsNames string[]

getAttributes(shaderProgram, attributesNames) number[]

Parameters

Name Type Description
shaderProgram WebGLProgram
attributesNames string[]

bindSamplers(effect) void

Parameters

Name Type Description
effect Effect

enableEffect(effect) void

Parameters

Name Type Description
effect Effect

setState(culling, zOffset, force, reverseSide) void

Parameters

Name Type Description
culling boolean
optional zOffset number
optional force boolean

setIntArray(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array Int32Array

setIntArray2(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array Int32Array

setIntArray3(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array Int32Array

setIntArray4(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array Int32Array

setFloatArray(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array Float32Array

setFloatArray2(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array Float32Array

setFloatArray3(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array Float32Array

setFloatArray4(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array Float32Array

setArray(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array number[]

setArray2(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array number[]

setArray3(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array number[]

setArray4(uniform, array) void

Parameters

Name Type Description
uniform WebGLUniformLocation
array number[]

setMatrices(uniform, matrices) void

Parameters

Name Type Description
uniform WebGLUniformLocation
matrices Float32Array

setMatrix(uniform, matrix) void

Parameters

Name Type Description
uniform WebGLUniformLocation
matrix Matrix

setMatrix3x3(uniform, matrix) void

Parameters

Name Type Description
uniform WebGLUniformLocation
matrix Float32Array

setMatrix2x2(uniform, matrix) void

Parameters

Name Type Description
uniform WebGLUniformLocation
matrix Float32Array

setFloat(uniform, value) void

Parameters

Name Type Description
uniform WebGLUniformLocation
value number

setFloat2(uniform, x, y) void

Parameters

Name Type Description
uniform WebGLUniformLocation
x number
y number

setFloat3(uniform, x, y, z) void

Parameters

Name Type Description
uniform WebGLUniformLocation
x number
y number

setBool(uniform, bool) void

Parameters

Name Type Description
uniform WebGLUniformLocation
bool number

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

Parameters

Name Type Description
uniform WebGLUniformLocation
x number
y number
z number

setColor3(uniform, color3) void

Parameters

Name Type Description
uniform WebGLUniformLocation
color3 Color3

setColor4(uniform, color3, alpha) void

Parameters

Name Type Description
uniform WebGLUniformLocation
color3 Color3
alpha number

setAlphaMode(mode, noDepthWriteChange) void

Parameters

Name Type Description
mode number
optional noDepthWriteChange boolean

bindBuffers(vertexBuffers, indexBuffer, effect) void

Parameters

Name Type Description
vertexBuffers { [key: string]: VertexBuffer }
indexBuffer WebGLBuffer
effect Effect

wipeCaches(bruteForce) void

Parameters

Name Type Description
optional bruteForce boolean

draw(useTriangles, indexStart, indexCount, instancesCount) void

Parameters

Name Type Description
useTriangles boolean
indexStart number
indexCount number

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

Parameters

Name Type Description
urlArg string
noMipmap boolean
invertY boolean
scene Scene
optional samplingMode number
optional onLoad Nullable<() => void>
optional onError Nullable<(message: string, exception: any) => void>
optional buffer Nullable<ArrayBuffer> or HTMLImageElement
optional fallBack InternalTexture

createRenderTargetTexture(size, options, RenderTargetCreationOptions) InternalTexture

Parameters

Name Type Description
size any
options boolean or RenderTargetCreationOptions

updateTextureSamplingMode(samplingMode, texture) void

Parameters

Name Type Description
samplingMode number
texture InternalTexture

bindFramebuffer(texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport) void

Parameters

Name Type Description
texture InternalTexture
optional faceIndex number
optional requiredWidth number
optional requiredHeight number

unBindFramebuffer(texture, disableGenerateMipMaps, onBeforeUnbind) void

Parameters

Name Type Description
texture InternalTexture
optional disableGenerateMipMaps boolean
optional onBeforeUnbind

createDynamicVertexBuffer(vertices) WebGLBuffer

Parameters

Name Type Description
vertices FloatArray

updateDynamicIndexBuffer(indexBuffer, indices, offset) void

Parameters

Name Type Description
indexBuffer WebGLBuffer
indices IndicesArray
optional offset number

updateDynamicVertexBuffer(vertexBuffer, vertices, offset, count) void

Parameters

Name Type Description
vertexBuffer WebGLBuffer
vertices FloatArray
optional offset number