@stereograph/teiaviewer - v18.14.0-dev
    Preparing search index...

    Class MultiDrawRenderList

    Manages a list of draw ranges for WebGL multiDraw calls.

    Designed for use in a batched rendering pipeline where multiple geometry ranges need to be drawn in a single GPU call. Handles range collection, interval merging, and buffer writing.

    const list = new MultiDrawRenderList();

    // Each frame:
    list.reset();
    for (const visibleObject of visibleObjects) {
    list.push(visibleObject.drawRange);
    }
    const drawCount = list.updateMultiDrawBuffers(starts, counts, bytesPerElement);
    renderer.multiDraw(starts, counts, drawCount);
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    • get length(): number

      Number of active ranges

      Returns number

    Methods

    • Adds a draw range to the list for the current frame.

      Parameters

      • range: BufferRange

        The draw range to add. start is a index offset, count is the number of indices.

      Returns void

    • Resets the list for the next frame.

      Must be called at the beginning of each frame before pushing new ranges.

      Returns void

    • Merges overlapping or contiguous ranges and writes the results into the provided multiDraw buffers.

      Ranges are sorted by start and merged in a single linear pass. Merging reduces the number of draw calls when adjacent geometry shares contiguous buffer regions.

      Must be called after all push calls for the current frame, and before issuing the multiDraw GPU call.

      Parameters

      • multiDrawStarts: Int32Array

        Output buffer for draw call start offsets, in bytes. Must be large enough to hold all merged intervals.

      • multiDrawCounts: Int32Array

        Output buffer for draw call element counts. Must be the same size as multiDrawStarts.

      • bytesPerElement: number

        Byte size of one index element.

      Returns number

      The number of merged draw calls written to the output buffers. Returns 0 if no ranges were pushed.