Documentation
    Preparing search index...

    Interface RenderBatching

    The batching support a WebglRenderer draws through when an application assigns one — the interface, so the renderer names no implementation and this module drops out of a bundle that never asks for it.

    Implemented by GlBatching; construct one with createGlBatching.

    interface RenderBatching {
        dispose(): void;
        draw(
            gl: BatchGlContext,
            program: UnlitProgram,
            batch: RenderBatch,
            useMap: boolean,
        ): void;
        forget(): void;
        next(
            items: readonly RenderItem[],
            from: number,
            layerMask?: number,
        ): RenderBatch | null;
    }

    Implemented by

    Index
    • Deletes the GL objects on a live context (§83).

      Returns void

    • Uploads batch and issues its single draw call, leaving the batch's vertex array bound (the renderer binds a geometry's array before its next ordinary draw, exactly as it does after a particle system's).

      Uniform state — the model matrix (identity: positions arrive in world space), the colour, and the two feature switches — is uploaded here through program, so a caller that never links this module never links those calls either. Everything a caller shares with the ordinary draw path — the program switch, §57's render state, the texture bind — stays with the caller.

      Parameters

      • gl: BatchGlContext
      • program: UnlitProgram
      • batch: RenderBatch
      • useMap: boolean

        whether a texture is bound for this draw; false makes the batch draw untextured, which is the same outcome an unlit item with an unresolvable map has.

      Returns void

      nothing; the caller counts the draw (§84) from batch.indexCount.

    • Drops the GL objects without touching the context (§61 context loss).

      Returns void

    • Plans and assembles the batch starting at items[from], or null when that item does not start one. See @fourjs/render's RenderBatcher.next: the returned record is pooled and valid until the next call.

      layerMask is optional since R-8 (2026-08-09), and the renderer no longer passes one: it hands this method a list buildViewRenderList has already reduced to what the view draws, so the mask would be vacuous. Omitting it means every layer, which is what a pre-filtered list needs. It stays in the signature for a caller that batches over an unfiltered frame list, where a masked-out item must still end a run.

      Parameters

      • items: readonly RenderItem[]
      • from: number
      • OptionallayerMask: number

      Returns RenderBatch | null