/** * A WebGL Batcher for rendering textured triangle meshes. * Uses indexed drawing to efficiently render arbitrary triangle geometry. * * Owns mesh-mode GL state ownership (since 19.7 / #1468): * * - {@link MeshBatcher#bind} enters mesh mode — enables `DEPTH_TEST` + * `LEQUAL` + `depthMask`, disables `BLEND`, and runs a one-shot * `clearDepth(1.0) + clear(DEPTH_BUFFER_BIT)` if the active target's * depth attachment is still dirty. Subsequent mesh draws against the * same target rely on the accumulated depth buffer. * - {@link MeshBatcher#unbind} exits mesh mode — restores non-mesh * defaults (`BLEND` on, `DEPTH_TEST` off, `depthMask` false) that the * 2D rendering paths assume. * - Subscribes to {@link event.RENDER_TARGET_CHANGED} (emitted by the * renderer at frame-start `clear()`, non-camera FBO bind, post-effect * FBO unbind) to re-arm the lazy depth clear whenever the active * framebuffer's attachments change identity. * * The WebGLRenderer doesn't know any of this — `setBatcher("mesh")` calls * `bind()` and the batcher sets up its own pass. Same lifecycle ports * cleanly to a future WebGPU renderer: `bind()` becomes "begin a * depth-enabled `RenderPassEncoder`", `unbind()` ends it. * @category Rendering */ export default class MeshBatcher extends MaterialBatcher { /** * Initialize the mesh batcher * @ignore */ init(renderer: any): void; /** * Tracks whether the active framebuffer's depth attachment still * needs a clear before this batcher's next draw. Flipped to * `true` by the `RENDER_TARGET_CHANGED` listener installed * below (frame start, post-effect FBO bind/unbind), back to * `false` by the first `bind()` of the new target after the * lazy clear runs. Lifts depth clearing from per-mesh (legacy) * to per-target — same model Three.js uses. The GPU's `LEQUAL` * depth test then resolves inter-mesh occlusion per pixel * against the accumulated buffer. * @ignore */ _depthDirty: boolean | undefined; _onTargetChanged: (() => void) | null | undefined; /** * Add a textured mesh to the batch. When the mesh has a * `vertexColors` array (multi-material OBJ + bound MTL), each * vertex's `aColor` attribute comes from that buffer instead of * the shared `tint` argument — so multi-material rendering needs * no extra draw calls per material vs single-material (large * meshes still get chunked across multiple flushes to fit the * vertex/index buffer limits — same behavior as single-material). * The shared `tint` is then multiplied into each vertex color * CPU-side (via `mulPackedARGB`, before `pushMesh`), preserving * runtime flash / fade / team-color effects — the mesh shader * itself just does `texture * aColor`, no extra uniform. * @param {object} mesh - a Mesh object with vertices, uvs, indices, and texture properties * @param {number} tint - tint color in UINT32 (argb) format */ addMesh(mesh: object, tint: number): void; } import { MaterialBatcher } from "./material_batcher.js"; //# sourceMappingURL=mesh_batcher.d.ts.map