A MeshBatch represents a collection of meshes that share the same rendering properties and can be rendered together in a single draw call using a DrawTechnique.

interface MeshBatch {
    bin?: string;
    gpuMemoryBatchIndex: number;
    hasNormals: boolean;
    hasUVs: boolean;
    mipmap: boolean;
    numIndices: number;
    numVertices: number;
    primBaseIndex: number;
    primitive: number;
    saoSupported: boolean;
    shadowsSupported: boolean;
    triplanar: boolean;
    getDrawArraysParamsForMesh(
        meshIndex: number,
    ): { count: number; first: number };
    getMeshAtIndex(meshIndex: number): SceneMesh;
    hasMeshesInRenderPass(viewIndex: number, renderPass: number): boolean;
}

Implemented by

Properties

bin?: string

Free-form bin identifier shared by every mesh in this batch — the value of SceneMesh.bin that the MeshManager hashed into this batch's bucket. undefined means the implicit "default" bin.

The renderer honours the SceneMesh.bin contract by iterating batches twice per frame: once for bin === undefined batches (the main scene), then gl.clear(gl.DEPTH_BUFFER_BIT), then once for bin === "overlay" batches (gizmo handles, HUD, etc.), so the overlay-bin meshes render as "floating" on top of everything else.

gpuMemoryBatchIndex: number

The index of this batch's memory in the GPUMemoryManager system. This indexes the GPUMemoryEditor.dataTextures.batches array. Before drawing this batch, the renderer will bind the corresponding data textures from that array, which contain the mesh data needed for rendering.

hasNormals: boolean

Whether the batch's geometries carry per-vertex normals.

Mirrors the hasNormals axis the MeshManager splits batches on. The renderer uses this flag to dispatch between the smooth-shaded and flat-shaded DrawTechnique variants — geometries within a batch always agree on this, so the dispatch is per-batch, not per-mesh.

hasUVs: boolean

Whether the batch's geometries carry per-vertex UV coordinates.

Independent axis from hasNormals. The renderer uses this to select draw-technique variants that bind a UV data texture and emit a vUV varying — the foundation for material-texture support.

mipmap: boolean

Whether the batch's per-batch atlases ship with a full mip pyramid and are sampled trilinearly.

Set when at least one mesh in the batch carries a material referencing a SceneTexture with SceneTextureParams.mipmap === true. Routes to the mipmap-bearing atlas variant; non-opted-in textures stay on the cheap single-level path.

numIndices: number

The total number of indices in all meshes of this batch. This is used with WebGL draw calls to determine how many indices to draw when drawing this batch.

numVertices: number

The total number of vertices in all meshes of this batch. This is used for various calculations and optimizations related to rendering.

primBaseIndex: number

Base primitive base index for this batch.

primitive: number

Primitive type of the meshes in this batch.

saoSupported: boolean

Whether this batch supports Screen Space Ambient Occlusion (SSAO) rendering.

shadowsSupported: boolean

Whether this batch supports directional shadow-map rendering.

triplanar: boolean

Whether the batch's textures must be sampled via the triplanar world-space fallback rather than the standard UV-attribute path.

Set when the batch's meshes share (material has any texture) && (geometry has no UVs) — typical of BIM, sweeps and lofted curve geometry. Mutually exclusive with hasUVs: the renderer dispatches triplanar batches to a sibling shader variant that derives sample coordinates from world position, blended by world normal.

Methods