RenderingGroup

Description

class RenderingGroup

Constructor

new RenderingGroup(index, scene, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn)

Creates a new rendering group.

Parameters

Name Type Description
index number The rendering group index
scene Scene
optional opaqueSortCompareFn Nullable<(a: SubMesh, b: SubMesh) => number> The opaque sort comparison function. If null no order is applied
optional alphaTestSortCompareFn Nullable<(a: SubMesh, b: SubMesh) => number> The alpha test sort comparison function. If null no order is applied

Members

index : number

onBeforeTransparentRendering : () => void

opaqueSortCompareFn : Nullable<(a: SubMesh, b: SubMesh) => number>

Set the opaque sort comparison function.

If null the sub meshes will be render in the order they were created

alphaTestSortCompareFn : Nullable<(a: SubMesh, b: SubMesh) => number>

Set the alpha test sort comparison function.

If null the sub meshes will be render in the order they were created

transparentSortCompareFn : Nullable<(a: SubMesh, b: SubMesh) => number>

Set the transparent sort comparison function.

If null the sub meshes will be render in the order they were created

Methods

render(customRenderFunction, renderSprites, renderParticles, activeMeshes) void

Render all the sub meshes contained in the group.

@returns true if rendered some submeshes.

Parameters

Name Type Description
customRenderFunction Nullable<(opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, depthOnlySubMeshes: SmartArray<SubMesh>) => void> Used to override the default render behaviour of the group.
renderSprites boolean
renderParticles boolean

static defaultTransparentSortCompare(a, b) number

Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)

are rendered back to front if in the same alpha index.

     * @param a The first submesh

@returns The result of the comparison

Parameters

Name Type Description
a SubMesh The first submesh
b SubMesh The second submesh

static backToFrontSortCompare(a, b) number

Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)

are rendered back to front.

     * @param a The first submesh

@returns The result of the comparison

Parameters

Name Type Description
a SubMesh The first submesh
b SubMesh The second submesh

static frontToBackSortCompare(a, b) number

Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)

are rendered front to back (prevent overdraw).

     * @param a The first submesh

@returns The result of the comparison

Parameters

Name Type Description
a SubMesh The first submesh
b SubMesh The second submesh

prepare() void

Resets the different lists of submeshes to prepare a new frame.

dispose() void

dispatch(subMesh) void

Inserts the submesh in its correct queue depending on its material.

Parameters

Name Type Description
subMesh SubMesh The submesh to dispatch

dispatchSprites(spriteManager) void

Parameters

Name Type Description
spriteManager SpriteManager

dispatchParticles(particleSystem) void

Parameters

Name Type Description
particleSystem IParticleSystem