BatchGeometryFactory

class BatchGeometryFactory extends IBatchGeometryFactory

Factory class that generates the geometry for a whole batch by feeding on the individual display-object geometries. This factory is reusable, i.e. you can build another geometry after a build call.

Optimizations: To speed up geometry generation, this compiles an optimized packing function that pushes attributes without looping through the attribute redirects.

Default Format: If you are not using a custom draw-call issuer, then the batch geometry must have an interleaved attribute data buffer and one index buffer.

Customization: If you want to customize the batch geometry, then you must also define your draw call issuer.

inBatchID Support: If you specified an inBatchID attribute in the batch-renderer, then this will support it automatically. The aggregate-uniforms pipeline doesn't need a custom geometry factory.

Constructor


new BatchGeometryFactory(renderer: BatchRenderer) → {}
Parameters:
Name Type Description
renderer BatchRenderer

Summary


Properties from BatchGeometryFactory

Methods from BatchGeometryFactory

void
append(targetObject: PIXI.DisplayObject, batch_: any)
PIXI.Geometry
build()
void
init(verticesBatched: number, indiciesBatched: number)
void
release(geom: PIXI.Geometry)
PIXI.ViewableBuffer
protected getAttributeBuffer(size: number)

Allocates an attribute buffer with sufficient capacity to hold size elements.

Uint16Array
protected getIndexBuffer(size: number)

Allocates an index buffer (Uint16Array) with sufficient capacity to hold size indices.

Protected Properties


_geometryPool BatchGeometryFactory.ts:260
protected _geometryPool: PIXI.Geometry

Batch geometries that can be reused.

See: IBatchGeometryFactory#release
_indexCountProperty BatchGeometryFactory.ts:408
protected _indexCountProperty: Resolvable<number>
geometryMerger BatchGeometryFactory.ts:382
protected geometryMerger: IGeometryMerger

This lazy getter returns the geometry-merger function. This function takes one argument - the display-object to be appended to the batch - and pushes its geometry to the batch geometry.

You can overwrite this property with a custom geometry-merger function if customizing BatchGeometryFactory.

Public Methods


append BatchGeometryFactory.ts:290
append(targetObject: PIXI.DisplayObject, batch_: any) → {void}

Append's the display-object geometry to this batch's geometry. You must override this you need to "modify" the geometry of the display-object before merging into the composite geometry (for example, adding an ID to a special uniform)

Parameters:
Name Type Description
targetObject PIXI.DisplayObject
batch_ any
Returns:
Type Description
void
build BatchGeometryFactory.ts:336
build() → {PIXI.Geometry}

 build(): PIXI.Geometry
 {
      // Make sure you're not allocating new geometries if _geometryPool has some
      // already. (Otherwise, a memory leak will result!)
      const geom: ExampleGeometry = (this._geometryPool.pop() || new ExampleGeometry(
          // ...your arguments... //)) as ExampleGeometry;

      // Put data into geometry's buffer

      return geom;
 }
Returns:
Type Description
PIXI.Geometry

the generated batch geometry

init BatchGeometryFactory.ts:270
init(verticesBatched: number, indiciesBatched: number) → {void}

Ensures this factory has enough space to buffer the given number of vertices and indices. This should be called before feeding display-objects from the batch.

Parameters:
Name Type Attributes Description
verticesBatched number
indiciesBatched number

<optional>

Returns:
Type Description
void
release BatchGeometryFactory.ts:372
release(geom: PIXI.Geometry) → {void}
Parameters:
Name Type Description
geom PIXI.Geometry

releases back the geometry to be reused. It is expected that it is not used externally again.

Returns:
Type Description
void

Protected Methods


getAttributeBuffer BatchGeometryFactory.ts:416
protected getAttributeBuffer(size: number) → {PIXI.ViewableBuffer}

Allocates an attribute buffer with sufficient capacity to hold size elements.

Parameters:
Name Type Description
size number
Returns:
Type Description
PIXI.ViewableBuffer
getIndexBuffer BatchGeometryFactory.ts:443
protected getIndexBuffer(size: number) → {Uint16Array}

Allocates an index buffer (Uint16Array) with sufficient capacity to hold size indices.

Parameters:
Name Type Description
size number
Returns:
Type Description
Uint16Array

Powered by webdoc!