Skip to content

ComponentLightWrapper

public class ComponentLightWrapper : TransformNodeWrapper

Component-logic handle on a ComponentLight, exposed as Rendering.<Name>. It is a transform node (aim it, move it, cast from it) that also LIGHTS the scene: drive Energy from a winding current and an indicator dims with the real one, set Colour from a channel mix and an RGB LED works, toggle Enabled from a relay and a headlight switches.

Agnostic by construction: nothing here says LED, headlight or bulb. It is the same shape as FieldEmitterWrapper on purpose - a lamp that must both illuminate the bench and be readable by a photoresistor carries one of each and drives them from the same number.

Writes are compare-before-write, because component logic re-assigns these every frame and an engine light setter dirties the renderer unconditionally, which defeats render-on-demand and keeps the GPU busy on a still scene. Off the main thread a changed value is posted deferred, the same rule the transform setters follow: the light is a scene node.

public double Energy { get; set; }

Brightness multiplier, unitless; a negative value is taken as 0. Zero is as dark as Enabled false, but keeps the light in the scene, which is what you want when a value is being ramped. On a light that emits lux, what a sensor reads scales by the same factor.

public bool Enabled { get; set; }

Whether the light shines. Off contributes no light at all (and, on a light that emits lux, nothing for a sensor to read). What a switch or a relay drives.

public Color Colour { get; set; }

The light’s colour. An RGB indicator mixes this from three currents.

public double LuxAtReference { get; }

The lux this light publishes on its axis at LuxReferenceDistance when Energy is 1, as authored on the light (its Lux At Reference). Read-only, so logic that turns a lux figure into a brightness writes Energy = lux / LuxAtReference and never keeps a second copy of the number that can drift from the light’s. A sensor sees it only when the light’s Emit Lux box is ticked. A plain number on the node, so safe to read from any thread.

public double LuxReferenceDistance { get; }

The distance in mm at which LuxAtReference is quoted (the light’s Measured At). Read-only, and safe to read from any thread.

public double Range { get; set; }

Reach in mm (never below 0.001). Ignored by a directional light, which has no position to reach from.

Generated from the CRUMB source, commit fcec660d, 2026-10-29.