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 holding the uniform redirects |
|
| Object<string, Array<UniformGroup>> |
|
| number |
|
| Array<number> |
|
Methods from AggregateUniformsBatch
| void |
|
Properties inherited from StdBatch
| number |
Index of the first vertex of this batch's geometry in the uploaded geometry. |
| PIXI.State |
State required to render this batch. |
| Array<PIXI.Texture> |
Textures that are used by the display-object's in this batch. |
| Map<number, number> |
Map of base-texture UIDs to texture indices into |
Methods inherited from StdBatch
Public Properties
uniformBuffer: Object<string, Array<UniformGroup>> = undefined
The buffer of uniform arrays of the display-objects
uniformLength: number = 0
No. of uniforms buffered (per uniform name)
uniformMap: Array<number> = undefined
Array mapping the in-batch ID to the uniform ID.