Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

DirectionalLight

A directional light in addition to the scene's sun: parallel light arriving from one direction everywhere in the world, the way a body far enough away delivers it. A second star over an alien planet, a moon hanging opposite the sun, a cold fill from the far side of a set.

The sun is Light { kind = "directional" } — one direction, one colour and the cascade set, held as a single field, so a second Light of that kind moves the sun rather than joining it. This component adds a light instead. Several can coexist; they share the scene's light buffer with point, spot and area lights, so the cap is the combined count (64).

Public fields: directionX/Y/Z (the direction the light TRAVELS, normalised by the engine), colorR/G/B, intensity, mobility (auto / static / mixed / dynamic — how a GI bake treats it).

Input aliases accepted by component.add: direction, color, brightness.

Methods: :resolveMobility(), :lightMobility().

lighting.lightRows() reports one of these with kind = "distant"; the row's direction, color and intensity are what the shading reads, and its position follows the carrying entity. A GI bake gathers it the way it gathers the sun, so a mobility = "static" light is baked whole and its live contribution withheld.

entity(id).component.add("DirectionalLight", {
    direction = { 0.3, -0.5, 0.4 },
    color = { 0.7, 0.8, 1.0 },
    intensity = 0.6,
})