Whether LitProgram.dispose has run.
Deletes the GL program (§83). Idempotent.
Only call this on a live context — see UnlitProgram.dispose.
Uploads the scene ambient term (§68), straight RGB. Accepts the
SceneLights record's own live array — copied into scratch, as every
upload here is.
Uploads a straight-alpha, linear-light RGBA colour (§57, §60a) — the
material's base color, scaled by its opacity exactly as
UnlitProgram.setColor does. Accepts the material's own live array; the
values are copied into scratch, so the material keeps ownership of its
array.
Uploads the directional light (§68): the world-space unit vector the
light travels along (SceneLights.direction — the fragment stage
negates it for the surface term) and its color premultiplied by intensity
(SceneLights.directionalColor). A frame with no directional light
uploads black, which zeroes the Lambert term — see the fragment source.
Selects whether this draw samples the bound albedo texture (§57's map,
R-19). Identical in contract to UnlitProgram.setFeatures — mirrored on
the CPU, uploaded only on change, sampler unit uploaded lazily — minus the
vertex-colour switch, which §57 puts on UnlitMaterial alone.
Uploads the frame's hemisphere (§68) — or nothing, for a scene that has none. See HemisphereLightUniforms for the contract and for why "nothing" is load-bearing.
Uploads one render item's world matrix and its derived normal matrix.
One-target morph weight; a no-op on the default lit program.
Uploads the frame's point and spot lights (§68, R-17) — or nothing, for a scene that has none. See PunctualLightUniforms for the contract and for why "nothing" is load-bearing.
Selects whether the draw about to be issued is shadowed (§49's
receiveShadow, §69) — see ShadowUniforms.setReceiving, whose
contract this is verbatim.
Uploads the frame's shadow matrix, biases and tap size (§69, R-18) — or nothing, for a frame in which no light casts. Call once per viewport; see ShadowUniforms for the contract and for why "nothing" is load-bearing.
Uploads projection * view for the viewport being drawn. Column-major, so
transpose is false — the engine's Matrix4 layout is already GL's (§7b).
Makes this the current program. Call before any upload below.
StaticcreateCompiles and links the lit program on gl.
Fails exactly as UnlitProgram.create does — see it for the
contract; the messages name "lit" and the §89 code is the same.
Staticcreate
The Lambert-lit pipeline (§57
LitMaterial, §68, §120 "lighting") — added by the lighting packet, 2026-08-04.It shares
gl-geometry.ts's vertex arrays with the other pipelines: the position stream sits at the fixed POSITION_ATTRIBUTE_LOCATION and the normal stream — when the geometry has one — at the fixed NORMAL_ATTRIBUTE_LOCATION, so one geometry cache serves all four programs. Light uniforms are per frame state uploaded per viewport (they live in the program object, exactly like the view-projection): the scene ambient term, one directional light, and up to @fourjs/render!MAX_PUNCTUAL_LIGHTS point and spot lights (R-17, 2026-08-09). Shadows (§69), tone mapping (§60a), and §68's remaining light types are staged where@fourjs/scene'slight.tsrecords.Owns its GL objects and nothing else; the renderer re-creates it on context restore exactly as it re-creates the unlit one (§61).