Nano WebGPU API - v0.11.0
    Preparing search index...

    Class BatchManager

    BatchManager organizes visible scene meshes into discrete material/geometry instanced batches. Allocates and grows GPU STORAGE buffers containing transformation matrix arrays to drive instanced draw calls, drastically optimizing drawing bottlenecks. Reuses data buffers to prevent garbage collector memory churning pressure.

    Index

    Constructors

    Methods

    • Releases all allocated instanced storage buffers from GPU memory and unregisters from the VRAM tracker.

      Returns void

    • Resolves the InstanceBatch details mapped to the specified key.

      Parameters

      • key: string

        The batch identification key.

      Returns InstanceBatch | undefined

      The target InstanceBatch, or undefined if not allocated.

    • Exposes visible batch groupings sorted by instanced keys.

      Returns Map<string, Mesh[]>

      Read-only Map of mesh groups.

    • Scans visible mesh configurations and partitions them into instanced batches. Reuses array collections from previous frames to eliminate garbage collection allocations. Must be executed every frame prior to rendering sequences.

      Parameters

      • meshes: readonly Mesh[]

        Flat list of all meshes in the scene.

      Returns void

    • Bundles and uploads coordinate arrays for active batches, growing GPU STORAGE buffers as needed. Propagates updated visible mesh statistics into performance trackers.

      Parameters

      Returns void