AggregateUniformsBatch

class AggregateUniformsBatch extends StdBatch

Allows usage of uniforms when rendering display-objects in batches. It expects you to aggregate each display-object's uniforms in an array and that the shader will pick the appropriate uniform at runtime (an index into the uniforms array will be passed).

Usage in shader:

// Your display-objects' affine transforms are aggregated into this array.
uniform mat3d affineTransform[];

// For WebGL1+ machines, your uniforms may be fetched by the uniform-ID attrib (float).
varying float vUniformID;

// For WebGL-2 only, to prevent interpolation overhead, you may use the flat in variables. You
// can configure this in AggregateUniformShaderFactory.
flat in int uniformID;

No Aggregation Mode

Aggregating uniforms into arrays requries a uniform-ID attribute to be uploaded as well. This may cost a lot of memory if your uniforms don't really change a lot. For these cases, you can disable uniform aggregation by not passing a uniformIDAttrib. This will make batches only have one value for each uniform. The uniforms will still be uploaded as 1-element arrays, however.

Summary


Properties from AggregateUniformsBatch

renderer

Renderer holding the uniform redirects

Object<string, Array<UniformGroup>>
uniformBuffer = undefined
number
uniformLength = 0
Array<number>
uniformMap = undefined

Methods from AggregateUniformsBatch

void
reset()

Properties inherited from StdBatch

number
geometryOffset

Index of the first vertex of this batch's geometry in the uploaded geometry.

PIXI.State
state = undefined

State required to render this batch.

Array<PIXI.Texture>
textureBuffer = undefined

Textures that are used by the display-object's in this batch.

Map<number, number>
uidMap = undefined

Map of base-texture UIDs to texture indices into uSamplers.

Methods inherited from StdBatch

Public Properties


renderer AggregateUniformsBatch.ts:43
renderer

Renderer holding the uniform redirects

uniformBuffer AggregateUniformsBatch.ts:48
uniformBuffer: Object<string, Array<UniformGroup>> = undefined

The buffer of uniform arrays of the display-objects

uniformLength AggregateUniformsBatch.ts:60
uniformLength: number = 0

No. of uniforms buffered (per uniform name)

uniformMap AggregateUniformsBatch.ts:54
uniformMap: Array<number> = undefined

Array mapping the in-batch ID to the uniform ID.

Public Methods


reset AggregateUniformsBatch.ts:83
reset() → {void}
Returns:
Type Description
void

Powered by webdoc!