Class: StdBatchFactory

.brend~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.

new StdBatchFactory (renderer)

Name Type Description
renderer PIXI.brend.BatchRenderer
See:
  • PIXI.brend.AggregateUniformsBatchFactory

Members

_batchBuffer protected

Display-objects in current batch

_batchCount number protected

Number of batches created since last reset.

_batchPool Array.<any> protected

Pool to batch objects into which data is fed.

_renderer PIXI.brend.BatchRenderer protected

_textureBuffer object

_textureCount number

Textures per display-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

Methods

_buildBatch (batch) protected

Should add any information required to render the batch. If you override this, you must call super._buildBatch and clear any state.

Name Type Description
batch object
Example
_buildBatch(batch: any): void
{
     super._buildBatch(batch);
     batch.depth = this.generateDepth();

     // if applicable
     this.resetDepthGenerator();
}

_newBatch ()object protected

Returns:
Type Description
object a new batch
Example
_newBatch(): CustomBatch
{
     return new CustomBatch();
}

_nextBatch (geometryOffset)

Name Type Description
geometryOffset number

_put (displayObject)boolean

Should store any information from the display-object to be put into the batch.

Name Type Description
displayObject PIXI.DisplayObject
Returns:
Type Description
boolean
  • whether the display-object was "compatible" with other display-objects in the batch. If not, it should not have been added.

access ()Array.<object>

Returns the built batch pool. The array returned may be larger than the pool itself.

Returns:
Type Description
Array.<object>

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 PIXI.brend.Batch

put (targetObject, 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

Returns:
Type Description
boolean whether the object was added to the batch. If it wasn't, you should "build" it.

ready ()boolean

Returns:
Type Description
boolean
  • whether this factory is ready to start a new batch from "start". If not, then the current batch must be built before starting a new one.

Clears the batch pool.

Size of the batch pool built since last reset.