directionalLight property

DirectionalLight? get directionalLight

A single analytic directional light (e.g. a sun) layered on top of the image-based lighting. Null (the default) means IBL only.

This is a convenience over attaching a DirectionalLightComponent to a node: the light is attached to root (so its direction is the light's own DirectionalLight.direction, unaffected by any node transform). For lights that should move or aim with a node, attach a DirectionalLightComponent to that node instead. The renderer shades the first directional light it finds in the graph.

Implementation

DirectionalLight? get directionalLight => _directionalLightComponent?.light;
set directionalLight (DirectionalLight? value)

Implementation

set directionalLight(DirectionalLight? value) {
  final existing = _directionalLightComponent;
  if (existing != null) {
    root.removeComponent(existing);
    _directionalLightComponent = null;
  }
  if (value != null) {
    final component = DirectionalLightComponent(value);
    root.addComponent(component);
    _directionalLightComponent = component;
  }
}