/** * The lights of a set that take part in rendering, in the forms the renderer consumes. A layer * owns one for its lights and rebuilds it lazily when they change, and the lightmapper owns one * for the single light it bakes at a time. * * The central form is the light slots: the lights applied at runtime, in the order that gives each * its slot in a shader - `light_` is the light at index N. The slot order is the same for every * mesh instance in a pass whatever its light mask selects, so a light's uniforms are dispatched * once per pass and each shader reads its own slots. The shader generator, the shader variant hash * and the light dispatch all read this one array, so they cannot disagree. * * @ignore */ export class LightList { /** * The lights applied at runtime, in slot order. Directional lights, then - when clustered * lighting is disabled - omni and spot lights, since clustered lighting supplies the local * lights another way. A light that only contributes to a lightmap reaches nothing at runtime * and takes no slot. * * @type {Light[]} */ slots: Light[]; /** * The enabled directional lights, in no particular order. Read by the shadow cull and the * gsplat shadow renderer, which look for the shadow casters among them. * * @type {Light[]} */ directional: Light[]; /** * The keys of the slot lights, joined in slot order. Identifies the layout of the lights, and * so the shader code and the uniform layout they generate. * * @type {string} */ key: string; /** * A hash of {@link LightList#key}, for the shader variant hash. * * @type {number} */ hash: number; /** * Whether the slots were built for clustered lighting. * * @type {boolean} */ clustered: boolean; /** * Rebuilds every form from the given lights. The arrays are reused, so nothing is allocated * on a rebuild but the key. * * @param {Light[]} lights - The lights of the set, enabled or not. * @param {boolean} clustered - Whether clustered lighting is enabled, in which case the local * lights take no slot. */ update(lights: Light[], clustered: boolean): void; } import type { Light } from '../light.js';