This will hook onto the renderer's contextChange
and prerender signals.
| Name | Type | Description |
|---|---|---|
renderer |
PIXI.Renderer |
The renderer this works for. |
Extends
Members
-
_shader PIXI.Shader protected
-
This shader is generated by
this.shaderGenerator.It is generated specifically to handle the required number of textures being batched together.
-
The class that represents the geometry of objects that are going to be batched with this.
- Default Value:
- PIXI.BatchGeometry
-
Maximum number of textures that can be uploaded to the GPU under the current context. It is initialized properly in
this.contextChange. -
renderer PIXI.Renderer inherited
-
The renderer this manager works for.
-
shaderGenerator PIXI.BatchShaderGenerator protected
-
This is used to generate a shader that can color each vertex based on a
aTextureIdattribute that points to an texture inuSampler.This enables the objects with different textures to be drawn in the same draw call.
You can customize your shader by creating your custom shader generator.
-
The number of bufferable objects before a flush occurs automatically.
- Default Value:
- settings.SPRITE_MAX_TEXTURES
-
state PIXI.State readonly
-
The WebGL state in which this renderer will work.
-
Size of data being buffered per vertex in the attribute buffers (in floats). By default, the batch-renderer plugin uses 6:
aVertexPosition 2 aTextureCoords 2 aColor 1 aTextureId 1
Methods
-
Handles the
contextChangesignal.It calculates
this.MAX_TEXTURESand allocating the packed-geometry object pool. -
destroy () overrides
-
Destroys this
AbstractBatchRenderer. It cannot be used again. -
flush () overrides
-
Renders the content now and empties the current batch.
-
Handles the
prerendersignal.It ensures that flushes start from the first geometry object again.
-
Takes the four batching parameters of
element, interleaves and pushes them into the batching attribute/index buffers given.It uses these properties:
vertexDatauvs,textureIdandindicies. It also uses the "tint" of the base-texture, if present.Name Type Description elementPIXI.Sprite element being rendered
attributeBufferPIXI.ViewableBuffer attribute buffer.
indexBufferUint16Array index buffer
aIndexnumber number of floats already in the attribute buffer
iIndexnumber number of indices already in
indexBuffer -
render (sprite) overrides
-
Buffers the "batchable" object. It need not be rendered immediately.
Name Type Description spritePIXI.Sprite the sprite to render when using this spritebatch
-
start () overrides
-
Starts a new sprite batch.
-
Stops and flushes the current batch.