gameforge - v0.1.12
    Preparing search index...

    Class BufferSystem

    System plugin to the renderer to manage buffers.

    WebGL uses Buffers as a way to store objects to the GPU. This system makes working with them a lot easier.

    Buffers are used in three main places in WebGL

    • geometry information
    • Uniform information (via uniform buffer objects - a WebGL 2 only feature)
    • Transform feedback information. (WebGL 2 only feature)

    This system will handle the binding of buffers to the GPU as well as uploading them. With this system, you never need to work directly with GPU buffers, but instead work with the PIXI.Buffer class.

    PIXI

    Implements

    Index

    Constructors

    • Parameters

      • renderer: Renderer

        The renderer this System works for.

      Returns BufferSystem

    Properties

    boundBufferBases: { [key: number]: Buffer }

    Cache keeping track of the base bound buffer bases

    CONTEXT_UID: number
    managedBuffers: { [key: number]: Buffer }

    Cache for all buffers by id, used in case renderer gets destroyed or for profiling

    Methods

    • This binds specified buffer. On first run, it will create the webGL buffers for the context too

      Parameters

      • buffer: Buffer

        the buffer to bind to the renderer

      Returns void

    • Binds an uniform buffer to at the given index.

      A cache is used so a buffer will not be bound again if already bound.

      Parameters

      • buffer: Buffer

        the buffer to bind

      • index: number

        the base index to bind it to.

      Returns void

    • Binds a buffer whilst also binding its range. This will make the buffer start from the offset supplied rather than 0 when it is read.

      Parameters

      • buffer: Buffer

        the buffer to bind

      • Optionalindex: number

        the base index to bind at, defaults to 0

      • Optionaloffset: number

        the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc

      Returns void

    • Sets up the renderer context and necessary buffers.

      Returns void

    • Protected

      creates and attaches a GLBuffer object tied to the current context.

      Parameters

      Returns GLBuffer

    • Disposes buffer

      Parameters

      • buffer: Buffer

        buffer with data

      • OptionalcontextLost: boolean

        If context was lost, we suppress deleteVertexArray

      Returns void

    • dispose all WebGL resources of all managed buffers

      Parameters

      • OptionalcontextLost: boolean

        If context was lost, we suppress gl.delete calls

      Returns void

    • Parameters

      Returns void

    • Will ensure the data in the buffer is uploaded to the GPU.

      Parameters

      • buffer: Buffer

        the buffer to update

      Returns void