Builder

Builder for creating and configuring light components. All builder methods return this Builder for method chaining.

Parameters

type

Type of light to create

Constructors

Link copied to clipboard
constructor(type: LightManager.Type)

Types

Link copied to clipboard

Functions

Link copied to clipboard

Build and attach the light component to an entity. If the entity already has a light, it is destroyed first. Supports up to 2048 lights per Engine.

Link copied to clipboard

Whether this light casts light (enabled by default). Useful for lights that cast shadows without illuminating the scene.

Link copied to clipboard

Enable shadows for this light (disabled by default). Only directional and spot lights can cast shadows.

Link copied to clipboard
fun color(linearR: Float, linearG: Float, linearB: Float): LightManager.Builder

Set the light's color in linear sRGB. Default: white (1, 1, 1).

Link copied to clipboard

Set the light's initial direction in world space (should be a unit vector). Ignored for point lights. Default: (0, -1, 0) (downward).

Link copied to clipboard

Set the falloff distance for point and spot lights (ignored for directional lights). Beyond this distance, the light has no effect. Defines the light's sphere of influence, impacting performance. Minimize overlapping spheres of influence for best performance. Default: 1 meter.

Link copied to clipboard

Set the light's intensity. Meaning depends on light type:

fun intensity(watts: Float, efficiency: Float): LightManager.Builder

Set the light's intensity from electrical watts and efficiency. Commercial lightbulbs often list wattage; efficiency depends on bulb type:

Link copied to clipboard

Set the light's intensity in candela (luminous intensity). For directional lights, equivalent to intensity. Overrides prior intensity or intensityCandela calls.

Link copied to clipboard
fun lightChannel(channel: Int, enable: Boolean = true): LightManager.Builder

Enable or disable a light channel (0-7). Channel 0 enabled by default. Use channels to selectively control which lights affect which objects.

Link copied to clipboard

Set the light's initial position in world space (ignored for directional lights). Default: origin (0, 0, 0).

Link copied to clipboard

Set shadow map quality and performance parameters.

Link copied to clipboard

Define a spot light's angular falloff via inner and outer cones (half-angles in radians). Both angles are clamped to 0.00873, π/2 to avoid precision issues. Ignored for directional and point lights. For Type.FOCUSED_SPOT (physically correct), outer cone angle affects total illumination. For Type.SPOT, outer cone and illumination are decoupled (easier to tweak).

Link copied to clipboard

Set the sun's angular radius in degrees (only for Type.SUN lights). Earth's sun appears 0.526°-0.545°; range 0.25°, 20.0°. Default: 0.545°.

Link copied to clipboard

Set the sun's halo falloff exponent. Must be at least 1.0. Default: 80.0. Controls how quickly the halo dims away from the sun's edge.

Link copied to clipboard

Set the sun's halo radius as a multiplier of sunAngularRadius. Must be at least 1.0. Default: 10.0.