TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/danielitoCode/Spatial/llms.txt
Use this file to discover all available pages before exploring further.
spatial-light module provides the Light object and the LightData data contract. In Core #1, LightData is metadata only — current renderers render flat colors and do not evaluate light contributions. The contract exists so scene code is fully forward-compatible with future lighting milestones: you can author lighting intent today and the renderer will pick it up automatically when a lighting phase ships.
Import
spatial-light
Light object
Light is a Kotlin object that exposes factory helpers for creating LightData contract values.
Light.directional()
Creates directional light metadata using the shared spatial-core contract type.
Parameters
The X component of the light direction vector. Together with
dirY and dirZ, this defines the direction the light travels (not the position of the light source). The vector does not need to be normalized — renderers are expected to normalize it internally.The Y component of the light direction vector. The default value of
-1.0 points the light straight downward, simulating an overhead sun.The Z component of the light direction vector.
A scalar multiplier for the light’s brightness. Values above
1.0 produce a brighter light; values below 1.0 produce a dimmer light. Must be non-negative.The red channel of the light color in the
[0, 1] range. Combined with g and b, the default values of (1.0, 1.0, 1.0) represent pure white light.The green channel of the light color in the
[0, 1] range.The blue channel of the light color in the
[0, 1] range.LightData
LightData is a pure data contract type defined in spatial-core. Light.directional() constructs and returns one. It carries no rendering logic and has no dependency on Android, Compose, or OpenGL.
data class, LightData instances are immutable value objects with structural equality and a generated copy() method. This makes them safe to hold in Compose state and to compare across recompositions.
Core #1 limitation
You can create and store
LightData values today for forward compatibility. When a lighting milestone ships and the renderer gains light evaluation support, it will read the LightData you have already defined — no scene-level API changes required.Example
LightData describing a warm, slightly off-axis sun — direction tilted at roughly 34° from straight-down, intensity boosted 20% above default, and color tinted toward a soft yellow-white. The values are pure data and impose no runtime cost until an evaluating renderer is present.