Documentation
    Preparing search index...

    Type Alias RenderItem

    RenderItem:
        | UnlitRenderItem
        | LitRenderItem
        | StandardRenderItem
        | SpriteRenderItem
        | ParticleRenderItem
        | SkinnedUnlitRenderItem
        | SkinnedLitRenderItem
        | NodeRenderItem

    One draw (§64), as a discriminated union on RenderItemKind.

    for (const item of buildRenderList(scene, out)) {
    if (item.kind === "sprite") {
    bind(item.material.texture); // narrowed to SpriteMaterial
    } else if (item.kind === "particles") {
    upload(item.instances, item.count);
    } else {
    upload(item.material.color); // narrowed to UnlitMaterial
    }
    }

    A union rather than one interface with a widened material so that a backend gets the concrete material type from an ordinary kind check, with no cast and no instanceof on the draw path. The builders pay for that with one documented cast where the invariant is actually established — see itemAt.