DirectionalLightComponent class Scene graph

An engine Component that places a DirectionalLight in the scene.

While the owning node is part of a live scene, the component registers its light with the scene's render layer so the renderer can find it, and unregisters it when the node leaves the scene.

Light travels along the owning node's local +Z axis. The node's world-space rotation aims the light; its translation and scale have no effect. The default constructor checks DirectionalLight.direction only when the component is created. Later mutations of that field remain ignored.

Inheritance

Constructors

DirectionalLightComponent(DirectionalLight light)
Creates a component that lights the scene with light.
DirectionalLightComponent.aimed(DirectionalLight light, Vector3 localDirection)
Creates a component that travels along localDirection.

Properties

enabled bool
Whether this component's update hook runs each frame.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isAttached bool
Whether this component is currently attached to a node.
no setterinherited
isLoaded bool
Whether onLoad has completed.
no setterinherited
isMounted bool
Whether the owning node is part of a live scene graph.
no setterinherited
light DirectionalLight
The light this component contributes.
getter/setter pair
localDirection → Vector3?
The fixed node-local travel direction set by DirectionalLightComponent.aimed (a copy), or null when the node's rotation aims the light.
no setter
node Node
The node this component is attached to.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
worldDirection → Vector3
The light's world-space travel direction.
no setter

Methods

cloneFor(Node cloneOwner) Component?
Clones carry the light, sharing the light object like other clone payloads (geometry, materials).
override
fixedUpdate(double fixedDt) → void
Called once per fixed physics step while the component is mounted, enabled, and loaded. fixedDt is the fixed timestep of the surrounding PhysicsWorld, not the frame interval.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAttach() → void
Called when this component is added to a node.
inherited
onDetach() → void
Called when this component is removed from a node.
inherited
onLoad() Future<void>
Optional asynchronous setup, such as loading an asset.
inherited
onMount() → void
Called when the owning node enters a live scene graph.
override
onUnmount() → void
Called when the owning node leaves a live scene graph.
override
toString() String
A string representation of this object.
inherited
update(double deltaSeconds) → void
Called once per frame while the component is mounted, enabled, and loaded. deltaSeconds is the elapsed time since the previous tick. A traversal visits each component at most once. Removing this component or an earlier sibling is safe. A component inserted before the current traversal position starts on the next frame. Reordering component or child lists during traversal is unsupported.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited