![]() |
Lysa Nodes
0.0
Lysa Nodes — Scene Graph for the Lysa Engine
|
Like all nodes, lights are automatically registered with and removed from the renderer when they are added to or removed from the scene tree.
Environment Environment sets the constant-colour ambient term for the scene. The single constructor argument combines RGB colour and intensity in a float4:
The first three components are the RGB sky colour; the fourth is the intensity multiplier (0–1). A neutral white at 0.20 keeps shadowed surfaces visible without a colour cast.
At most one Environment node is active per scene. Adding a second one replaces the first.
DirectionalLight DirectionalLight inherits from Light, which inherits from both Node and lysa::Light. The constructor takes a float4{r, g, b, intensity}:
Direction is encoded in the node's transform (rotation only; translation has no effect on a directional light):
Shadow maps are configured via dedicated methods before addChild:
The float4x4 multiplication convention follows the rest of the engine: mul(A, B) applies A first, then B. Composing rotation_x(-50°) outer with rotation_y(35°) inner places the sun in the upper-right hemisphere.
OmniLight OmniLight represents a point light with spherical attenuation. Its primary constructor takes range first, then colour:
setPosition uses the standard Node method; the light's world position is derived from globalTransform[3].xyz via the Light::updateGlobalTransform override, which calls lysa::Scene::updateLight automatically.
Light nodes share shared_ptr ownership with the scene tree and live as long as either the tree or any external reference holds them. Declaring them as member fields of RotatingAssetScene is unnecessary but is still a valid pattern.
To remove a light at runtime call removeChild(lightNode). There is no separate removeLight call; the _detachFromScene path unregisters the light from the renderer automatically.
Next : Rotation