Utility to handle indirect drawing.

Create a buffer, fill it with all the added geometries attributes and tell all the geometries to start using this buffer for indirect drawing.

Example

const geometry = new Geometry()

// assuming 'renderer' is a valid renderer or curtains instance
const indirectBuffer = new IndirectBuffer(renderer, {
label: 'Custom indirect buffer',
geometries: [geometry]
})

// if every geometries have been added, create the buffer.
indirectBuffer.create()

// from now on, any Mesh using 'geometry' as geometry will be rendered using indirect drawing.

Constructors

Properties

type: string

The type of the IndirectBuffer.

renderer: Renderer

The Renderer used to create this IndirectBuffer.

uuid: string

The universal unique id of this IndirectBuffer.

Options used to create this IndirectBuffer.

geometries: Map<string, Geometry | IndexedGeometry>

Map of Geometry or IndexedGeometry that will use this IndirectBuffer.

buffer: Buffer

The Buffer that will hold the geometries attributes.

Accessors

Methods

  • Get the byte offset in the buffer at a given index.

    Parameters

    • index: number = 0

      Index to get the byte offset from.

    Returns number

    • Byte offset in the buffer at a given index.