/** * Backend-neutral base class for renderer batchers. * * A batcher accumulates vertices into a CPU staging buffer and turns them * into GPU work in batches — one draw call for many shapes/sprites. This * class defines the lifecycle contract shared by every backend: * * - `init(renderer, settings)` — build (or rebuild after a context/device * loss) the batcher's GPU-facing state; called by the constructor * - `bind()` / `unbind()` — the renderer switches the active batcher * - `flush()` — turn the pending vertices into GPU work * - `reset()` — drop transient state (game reset / context restore) * - `destroy()` — release every GPU resource the batcher owns * * Custom batchers extend the class matching the renderer they target — * {@link WebGLBatcher} for the WebGL renderer, `WebGPUBatcher` for the * WebGPU renderer — and are registered through `renderer.addBatcher()`, * which accepts any Batcher subclass. * @category Rendering */ export class Batcher { /** * Initialize (or re-initialize after a context/device loss) this batcher. * Derived classes override this with their full `(renderer, settings)` * signature and own the whole body; the base implementation only stores * the renderer reference. * @param {Renderer} renderer - the owning renderer */ init(renderer: Renderer): void; /** * the renderer this batcher is bound to * @type {Renderer} */ renderer: Renderer | undefined; /** * called by the renderer when this batcher becomes the current one */ bind(): void; /** * called by the renderer when this batcher is being replaced by another */ unbind(): void; /** * turn the pending vertices into GPU work */ flush(): void; /** * reset the batcher's transient state (game reset / context restore) */ reset(): void; /** * release every GPU resource this batcher owns */ destroy(): void; } export default Batcher; import type Renderer from "../renderer.js"; //# sourceMappingURL=batcher.d.ts.map