Class: GeometryPacker

GeometryPacker

Packs the geometry of display-object batches into a composite attribute and index buffer.

It works by generating an optimized packer function, which can add objects to the composite geometry. This geometry is interleaved and is in accordance with what PIXI.brend.BatchRenderer.generateCompositeGeometry would return.

new GeometryPacker (attributeRedirects, indexProperty, vertexCountProperty, vertexSize, texturePerObject)

Name Type Description
attributeRedirects Array.<PIXI.brend.AttributeRedirect>
indexProperty string

property where indicies are kept; null/undefined if not required.

vertexCountProperty string | number

property where no. of vertices for each object are kept. This could also be a constant.

vertexSize number

vertex size, calculated by default. This should exclude the vertex attribute

texturePerObject number

no. of textures per object

Members

compositeAttributes PIXI.ViewableBuffer

This is the currently active composite attribute buffer. It may contain garbage in unused locations.

compositeIndices Uint16Array

This is the currently active composite index buffer. It may contain garbage in unused locations.

It will be null if indexProperty was not given.

packerFunction PIXI.brend.PackerFunction

A generated function that will append an object's attributes and indices to composite buffers.

The composite attribute buffer is interleaved.

The composite index buffer has adjusted indices. It accounts for the new positions of vertices in the composite attribute buffer.

You can overwrite this property with a custom packer function.

Methods

pack (targetObject, textureId)

Name Type Description
targetObject PIXI.DisplayObject
textureId number

reset (batchVertexCount, batchIndexCount)

Name Type Description
batchVertexCount number
batchIndexCount number