Skip to content

Scene.lights

Summary

Scene.lights returns all light instances currently attached to the scene, including disabled lights. Use this collection for inspection, UI listing, or bulk parameter edits.

Syntax

Scene.lights: readonly Light[]
const lights = scene.lights;

Parameters

This property does not take parameters.

Returns

readonly Light[] - Ordered list of scene lights.

Type Details

LightType

type LightType = "ambient" | "directional" | "point";

Example

const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);

const scene = wgpu.createScene();
scene.addLight(wgpu.createLight.ambient({ intensity: 0.2 }));
scene.addLight(wgpu.createLight.point({ position: [1, 2, 1], range: 10 }));
console.log(scene.lights.length, scene.lights.map(l => l.type));

See Also