Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AbstractBatchRenderer

Renderer dedicated to drawing and batching sprites.

This is the default batch renderer. It buffers objects with texture-based geometries and renders them in batches. It uploads multiple textures to the GPU to reduce to the number of draw calls.

memberof

PIXI

Hierarchy

Index

Constructors

constructor

Properties

MAX_TEXTURES

MAX_TEXTURES: number

Protected _aBuffers

_aBuffers: ViewableBuffer[]

Protected _aIndex

_aIndex: number

Protected _attributeBuffer

_attributeBuffer: ViewableBuffer

Protected _bufferSize

_bufferSize: number

Protected _bufferedElements

_bufferedElements: IBatchableElement[]

Protected _bufferedTextures

_bufferedTextures: BaseTexture<Resource, IAutoDetectOptions>[]

Protected _dcIndex

_dcIndex: number

Protected _flushId

_flushId: number

Protected _iBuffers

_iBuffers: Uint16Array[]

Protected _iIndex

_iIndex: number

Protected _indexBuffer

_indexBuffer: Uint16Array

Protected _indexCount

_indexCount: number

Private _packedGeometries

_packedGeometries: any

Private _packedGeometryPoolSize

_packedGeometryPoolSize: any

Protected _shader

_shader: Shader

Protected _tempBoundTextures

_tempBoundTextures: BaseTexture<Resource, IAutoDetectOptions>[]

Protected _vertexCount

_vertexCount: number

Protected geometryClass

geometryClass: typeof BatchGeometry

Protected renderer

renderer: Renderer

Protected shaderGenerator

shaderGenerator: BatchShaderGenerator

size

size: number

Readonly state

state: State

Protected vertexSize

vertexSize: number

Static _drawCallPool

_drawCallPool: BatchDrawCall[]

Pool of BatchDrawCall objects that flush used to create "batches" of the objects being rendered.

These are never re-allocated again. Shared between all batch renderers because it can be only one "flush" working at the moment.

static
member

{PIXI.BatchDrawCall[]}

Static _textureArrayPool

_textureArrayPool: BatchTextureArray[]

Pool of BatchDrawCall objects that flush used to create "batches" of the objects being rendered.

These are never re-allocated again. Shared between all batch renderers because it can be only one "flush" working at the moment.

static
member

{PIXI.BatchTextureArray[]}

Methods

bindAndClearTexArray

  • Bind textures for current rendering

    Parameters

    Returns void

buildDrawCalls

  • Populating drawcalls for rendering

    Parameters

    Returns void

buildTexturesAndDrawCalls

  • buildTexturesAndDrawCalls(): void
  • Returns void

contextChange

  • contextChange(): void
  • Handles the contextChange signal.

    It calculates this.MAX_TEXTURES and allocating the packed-geometry object pool.

    Returns void

destroy

  • destroy(): void
  • Destroys this AbstractBatchRenderer. It cannot be used again.

    Returns void

drawBatches

  • drawBatches(): void
  • Returns void

flush

  • flush(): void
  • Renders the content now and empties the current batch.

    Returns void

Private getAttributeBuffer

  • Fetches an attribute buffer from this._aBuffers that can hold atleast size floats.

    Parameters

    • size: number

      minimum capacity required

    Returns ViewableBuffer

    • buffer than can hold atleast size floats

Private getIndexBuffer

  • getIndexBuffer(size: number): Uint16Array
  • Fetches an index buffer from this._iBuffers that can have at least size capacity.

    Parameters

    • size: number

      minimum required capacity

    Returns Uint16Array

    • buffer that can fit size indices.

initFlushBuffers

  • initFlushBuffers(): void
  • Makes sure that static and dynamic flush pooled objects have correct dimensions

    Returns void

onPrerender

  • onPrerender(): void
  • Handles the prerender signal.

    It ensures that flushes start from the first geometry object again.

    Returns void

packInterleavedGeometry

  • Takes the four batching parameters of element, interleaves and pushes them into the batching attribute/index buffers given.

    It uses these properties: vertexData uvs, textureId and indicies. It also uses the "tint" of the base-texture, if present.

    Parameters

    • element: IBatchableElement

      element being rendered

    • attributeBuffer: ViewableBuffer

      attribute buffer.

    • indexBuffer: Uint16Array

      index buffer

    • aIndex: number

      number of floats already in the attribute buffer

    • iIndex: number

      number of indices already in indexBuffer

    Returns void

render

  • Buffers the "batchable" object. It need not be rendered immediately.

    Parameters

    Returns void

start

  • start(): void
  • Starts a new sprite batch.

    Returns void

stop

  • stop(): void
  • Stops and flushes the current batch.

    Returns void

updateGeometry

  • updateGeometry(): void
  • Returns void

Generated using TypeDoc