Class: AggregateUniformsBatch

.brend~AggregateUniformsBatch

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.

new AggregateUniformsBatch ()

Extends

Members

geometryOffset number inherited overrides

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

Renderer holding the uniform redirects

state PIXI.State inherited overrides

State required to render this batch.

textureBuffer Array.<PIXI.Texture> inherited overrides

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

uidMap Map.<number, number> inherited overrides

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

uniformBuffer Object.<string, Array.<UniformGroup>>

The buffer of uniform arrays of the display-objects

uniformLength number

No. of uniforms buffered (per uniform name)

uniformMap Array.<number>

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

Methods

Reset this batch to become "fresh"!

Uploads the resources required before rendering this batch. If you override this, you must call super.upload.

Name Type Description
renderer PIXI.Renderer