Creates a batch renderer the renders display-objects with the described geometry.
To register a batch-renderer plugin, you must use the API provided by PIXI.brend.BatchRendererPluginFactory
.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
renderer |
PIXI.Renderer |
renderer to attach to |
||||||||||||||||||||||||||||||||||||||||||||||||
options |
object |
|
- See:
Example
import * as PIXI from 'pixi.js';
import { BatchRendererPluginFactory } from 'pixi-batch-renderer';
// Define the geometry of your display-object and create a BatchRenderer using
// BatchRendererPluginFactory. Register it as a plugin with PIXI.Renderer.
PIXI.Renderer.registerPlugin('ExampleBatchRenderer', BatchRendererPluginFactory.from(...));
class ExampleObject extends PIXI.Container
{
_render(renderer: PIXI.Renderer): void
{
// BatchRenderer will handle the whole rendering process for you!
renderer.batch.setObjectRenderer(renderer.plugins['ExampleBatchRenderer']);
renderer.plugins['ExampleBatchRenderer'].render(this);
}
}
Extends
- PIXI.ObjectRenderer
Members
-
_attribRedirects Array.<PIXI.brend.AttributeRedirect> protectedreadonly
-
Attribute redirects
-
Batch drawer class. Its constructor takes one argument - this batch renderer.
- Default Value:
- PIXI.brend.BatchDrawer
-
-
Batch-factory class.
- Default Value:
- PIXI.brend.StdBatchFactory
-
Batch-geometry factory class. Its constructor takes one argument - this batch renderer.
- Default Value:
- PIXI.brend.BatchGeometryFactory
-
-
-
Indexes the display-object in the batch.
-
Indices property
-
Shader generating function (takes the batch renderer)
-
State generating function (takes a display-object)
- Default Value:
- () => PIXI.State.for2d()
-
Texture ID attribute
-
Texture(s) property
-
Textures per display-object
- Default Value:
- 1
-
Indexes the uniforms of the display-object in the uniform arrays. This is not equal to the in-batch ID because equal uniforms are not uploaded twice.
-
_uniformRedirects Array.<PIXI.brend.UniformRedirect> protectedreadonly
-
Uniform redirects. If you use uniforms in your shader, be sure to use one the compatible batch factories (like
PIXI.brend.AggregateUniformsBatchFactory
).- Default Value:
- null
-
Vertex count property (optional)
-
The options used to create this batch renderer.
Methods
-
Internal method that is called whenever the renderer's WebGL context changes.
-
Forces buffered display-objects to be rendered immediately. This should not be called unless absolutely necessary like the following scenarios:
-
before directly rendering your display-object, to preserve render-order.
-
to do a nested render pass (calling
Renderer#render
inside arender
method) because the PixiJS renderer is not re-entrant.
-
-
Adds the display-object to be rendered in a batch. Your display-object's render/_render method should call this as follows:
renderer.setObjectRenderer(<BatchRenderer>); <BatchRenderer>.render(this);
Name Type Description displayObject
PIXI.DisplayObject -
This is an internal method. It ensures that the batch renderer is ready to start buffering display-objects. This is automatically invoked by the renderer's batch system.
-
Internal method that stops buffering of display-objects and flushes any existing buffers.