StdBatchFactory
class StdBatchFactory
Factory for producing "standard" (based on state, geometry, & textures) batches of display-objects.
NOTE: Instead of "building" batches, this factory actually keeps the batches in a buffer so they can be accessed together at the end.
Shared Textures: If display-objects in the same batch use the same base-texture, then that base-texture is not uploaded twice. This allows for more better batch density when you use texture atlases (textures with same base-texture). This is one reason why textures are treated as "special" uniforms.
Constructor
new StdBatchFactory(renderer: BatchRenderer) → {}
Name | Type | Description |
---|---|---|
renderer | BatchRenderer |
Summary
Properties from StdBatchFactory
Array<PIXI.DisplayObject> |
|
object |
|
number |
|
number |
|
string |
|
|
|
number |
|
Array<any> |
|
|
Methods from StdBatchFactory
Array<object> |
|
void |
|
boolean |
Puts the display-object into the current batch, if possible. |
boolean |
|
void |
Clears the batch pool. |
number |
Size of the batch pool built since last reset. |
void |
|
object |
|
any |
|
boolean |
|
Public Properties
_batchBuffer: Array<PIXI.DisplayObject>
_textureBuffer: object
_textureLimit: number
Max. no of textures per batch (should be <= texture units of GPU)
_textureProperty: string
Property in which textures are kept of display-objects
Protected Properties
protected _batchCount: number = 0
Number of batches created since last reset.
protected _batchPool: Array
Pool to batch objects into which data is fed.
protected _renderer
Public Methods
access() → {Array<object>}
Returns the built batch pool. The array returned may be larger than the pool itself.
Type | Description |
---|---|
Array<object> |
build(batch: number) → {void}
Creates the batch object and pushes it into the pool This also resets any state so that a new batch can be started again.
Name | Type | Description |
---|---|---|
batch | number |
Type | Description |
---|---|
void |
put(targetObject: PIXI.DisplayObject, state: PIXI.State) → {boolean}
Puts the display-object into the current batch, if possible.
Name | Type | Description |
---|---|---|
targetObject | PIXI.DisplayObject |
object to add |
state | PIXI.State |
state required by that object |
Type | Description |
---|---|
boolean |
whether the object was added to the batch. If it wasn't, you should "build" it. |
ready() → {boolean}
Type | Description |
---|---|
boolean |
|
size() → {number}
Size of the batch pool built since last reset.
Type | Description |
---|---|
number |
Protected Methods
protected _buildBatch(batch: object) → {void}
Should add any information required to render the batch. If you override this,
you must call super._buildBatch
and clear any state.
_buildBatch(batch: any): void
{
super._buildBatch(batch);
batch.depth = this.generateDepth();
// if applicable
this.resetDepthGenerator();
}
Name | Type | Description |
---|---|---|
batch | object |
Type | Description |
---|---|
void |
protected _newBatch() → {object}
_newBatch(): CustomBatch
{
return new CustomBatch();
}
Type | Description |
---|---|
object |
a new batch |
protected _nextBatch(geometryOffset: number) → {any}
Name | Type | Attributes | Description |
---|---|---|---|
geometryOffset | number |
<optional> |
Type | Description |
---|---|
any |
protected _put(displayObject: PIXI.DisplayObject) → {boolean}
Should store any information from the display-object to be put into the batch.
Name | Type | Description |
---|---|---|
displayObject | PIXI.DisplayObject |
Type | Description |
---|---|
boolean |
|