Renderer · function

createPointLightBuffer

A buffer for the selection to fill, sized to what the caller can actually bind.

Explained in Hello world.

function createPointLightBuffer(capacity?: number): PointLightBuffer
import { createPointLightBuffer } from '@driftengine/core';

Parameters

ParameterTypeDescription
capacity?number

In depth

capacity exists because clustered lighting can carry far more than the shader's uniform arrays. The froxel table takes up to MAX_CLUSTERED_LIGHTS, and this helper used to hand it sixteen whatever a world offered — so the capability was real and unreachable through the one path every consumer uses. A consumer with RenderQuality.clusteredLights on asks for a wider buffer; everything else takes the default and is unchanged.

scratchDistance grows with it, and that is not incidental: the shaded list is kept sorted in it, so a buffer wider than the array holding its distances writes past the end. It was sized from POINT_SHADOW_POOL because the pool happened to be the larger of the two.