LightManager

class LightManager(nativeHandle: NativePointer)

LightManager allows you to create light sources in the scene.

At least one light must be added to a scene to see anything (unless using Material.Shading.UNLIT).

Light types (directional, point, spot):

  • Directional lights: parallel rays from infinitely far (e.g., sun); cast shadows

  • Point lights: emit from a position in all directions; intensity diminishes with inverse square law

  • Spot lights: emit from a position within a cone; two cone angles control falloff

Performance tips:

  • Prefer spot lights over point lights; use smallest outer cone angle possible

  • Use smallest falloff distance to minimize sphere-of-influence overlap

  • Non-overlapping lights have negligible overhead (hundreds are fine)

Shadow support:

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer)

Types

Link copied to clipboard

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

Link copied to clipboard
object Companion
Link copied to clipboard

Utility methods for computing cascaded shadow map split positions. Use these to populate ShadowOptions.cascadeSplitPositions.

Link copied to clipboard

Shadow map quality and performance parameters. Controls resolution, stability, bias, cascading, and filtering techniques.

Link copied to clipboard

Light type determines behavior and allowed parameters.

Properties

Link copied to clipboard

Returns the number of light components (may include inactive/destroyed lights). Check with EntityManager.isAlive() before use if needed.

Link copied to clipboard

All entities with a light component, in no particular order.

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Functions

Link copied to clipboard
fun destroy(entity: Entity)

Destroy the light component on an entity.

Link copied to clipboard
fun empty(): Boolean

Returns true if there are no light components.

Link copied to clipboard
fun getColor(instance: EntityInstance, out: FloatArray? = null): FloatArray

Get the light's color in linear sRGB.

Link copied to clipboard
fun getDirection(instance: EntityInstance, out: FloatArray? = null): FloatArray

Get the light's direction in world space.

Link copied to clipboard

Returns the Entity of the component from its Instance.

Link copied to clipboard

Get the light's falloff distance.

Link copied to clipboard

Get the light component instance for an entity.

Link copied to clipboard

Get the light's luminous intensity in candela.

Link copied to clipboard
fun getLightChannel(instance: EntityInstance, channel: Int): Boolean

Check if a light channel is enabled on this light.

Link copied to clipboard
fun getPosition(instance: EntityInstance, out: FloatArray? = null): FloatArray

Get the light's position in world space.

Link copied to clipboard

Returns the shadow-map options of a light.

Link copied to clipboard

Get the spot light's inner cone angle in radians. The value may differ slightly from what was set due to recomputation.

Link copied to clipboard

Get the spot light's outer cone angle in radians.

Link copied to clipboard

Get the sun's angular radius in degrees.

Link copied to clipboard

Get the sun's halo falloff exponent.

Link copied to clipboard

Get the sun's halo size multiplier.

Link copied to clipboard

Get the type of a light.

Link copied to clipboard

Returns whether a particular entity has a light component.

Link copied to clipboard

Whether this light is a directional light (Type.DIRECTIONAL or Type.SUN).

Link copied to clipboard

Whether this light is a Type.POINT light.

Link copied to clipboard

Check whether this light casts shadows.

Link copied to clipboard

Whether this light is a spot light (Type.SPOT or Type.FOCUSED_SPOT).

Link copied to clipboard
fun setColor(instance: EntityInstance, r: Float, g: Float, b: Float)

Dynamically update the light's color in linear sRGB.

Link copied to clipboard
fun setDirection(instance: EntityInstance, x: Float, y: Float, z: Float)

Dynamically update the light's direction in world space. Ignored for point lights. Should be a unit vector.

Link copied to clipboard
fun setFalloff(instance: EntityInstance, radius: Float)

Dynamically update the light's falloff distance for point/spot lights. Ignored for directional lights.

Link copied to clipboard
fun setIntensity(instance: EntityInstance, intensity: Float)

Dynamically update the light's intensity. Meaning depends on light type:

fun setIntensity(instance: EntityInstance, watts: Float, efficiency: Float)

Dynamically update the light's intensity from watts and efficiency. Equivalent to setIntensity(watts * 683.0 * efficiency).

Link copied to clipboard
fun setIntensityCandela(instance: EntityInstance, intensity: Float)

Dynamically update the light's intensity in candela. For directional lights, equivalent to setIntensity. For Type.FOCUSED_SPOT, the returned value depends on outer cone angle.

Link copied to clipboard
fun setLightChannel(instance: EntityInstance, channel: Int, enable: Boolean = true)

Enable or disable a light channel (0-7) on this light. Channel 0 is enabled by default.

Link copied to clipboard
fun setPosition(instance: EntityInstance, x: Float, y: Float, z: Float)

Dynamically update the light's position in world space. Ignored for directional lights.

Link copied to clipboard
fun setShadowCaster(instance: EntityInstance, shadowCaster: Boolean)

Dynamically enable or disable shadow casting for this light. Only directional and spot lights can cast shadows.

Link copied to clipboard

Sets the shadow-map options of a light.

Link copied to clipboard
fun setSpotLightCone(instance: EntityInstance, inner: Float, outer: Float)

Dynamically update a spot light's cone angles (half-angles in radians). Ignored for directional and point lights.

Link copied to clipboard
fun setSunAngularRadius(instance: EntityInstance, angularRadius: Float)

Dynamically update the sun's angular radius in degrees. Only applicable to Type.SUN lights.

Link copied to clipboard
fun setSunHaloFalloff(instance: EntityInstance, haloFalloff: Float)

Dynamically update the sun's halo falloff exponent. Only applicable to Type.SUN lights.

Link copied to clipboard
fun setSunHaloSize(instance: EntityInstance, haloSize: Float)

Dynamically update the sun's halo radius as a multiplier of angular radius. Only applicable to Type.SUN lights.