Light class

Light source in the scene.

Inheritance

Constructors

Light({String name = 'light', LightType type = LightType.directional, Color color = const Color(0xFFFFFFFF), double intensity = 1.0, Color? groundColor, Vector3? direction, double range = 0, double spotAngle = 0.5})
Light.ambient({Color color = const Color(0xFF404040), Color? groundColor, double intensity = 0.3})
Creates a default ambient light.
factory
Light.directional({Vector3? direction, Color color = const Color(0xFFFFFFFF), double intensity = 1.0})
Creates a default directional light (sun-like).
factory
Light.point({Vector3? position, Color color = const Color(0xFFFFFFFF), double intensity = 1.0, double range = 10})
Creates a point light.
factory

Properties

childCount → int
no setterinherited
children → List<Node>
no setterinherited
color ↔ Color
getter/setter pair
direction ↔ Vector3
Direction for directional/spot lights.
getter/setter pair
groundColor ↔ Color?
Optional lower-hemisphere color for ambient lights.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
intensity ↔ double
getter/setter pair
isRenderable → bool
Whether this node contributes pixels during a render pass.
no setterinherited
isTransparent → bool
Whether this node requires back-to-front alpha ordering.
no setterinherited
localAabb → Aabb
Override to provide local-space bounding box.
no setterinherited
localMatrix → Matrix4
Local transform matrix.
no setterinherited
name ↔ String
getter/setter pairinherited
ownWorldAabb → Aabb
Computes the AABB of this node's own geometry in world space (without descendants). Used for self-hits in raycasting and physics.
no setterinherited
parent → Node?
no setterinherited
pointable ↔ Pointable?
getter/setter pairinherited
range ↔ double
Range for point/spot lights (0 = infinite).
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
spotAngle ↔ double
Spot angle in radians (for spot lights only).
getter/setter pair
transform → Transform3D
finalinherited
type → LightType
final
visible ↔ bool
getter/setter pairinherited
worldAabb → Aabb
Computes the AABB of this node AND all its descendants in world space. Group nodes have no geometry, so their own box would be a phantom ±0.5m cube at their position — using it for culling wrongly discarded entire subtrees. The union is cached and invalidated on any transform or hierarchy change in the subtree.
no setterinherited
worldMatrix → Matrix4
World transform matrix (accumulated from root).
no setterinherited
worldPosition → Vector3
World position extracted from world matrix.
no setterinherited

Methods

addChild(Node child) → void
inherited
calculateIntensity(Vector3 surfacePoint, Vector3 surfaceNormal) → double
Calculates the light contribution at a given surface point and normal.
collectVisible() → List<Node>
Collects all visible nodes in the tree.
inherited
findChild(String name) → Node?
Finds a child by name recursively.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onRender(Canvas canvas, Matrix4 viewProjection) → void
Override for custom rendering.
inherited
onTransformChanged() → void
Called when any transform property changes.
inherited
onUpdate(double dt) → void
Override for custom per-frame logic.
inherited
removeChild(Node child) → void
inherited
removeFromParent() → void
inherited
render(Canvas canvas, Matrix4 viewProjection) → void
Renders this node and children to the canvas.
inherited
toString() → String
A string representation of this object.
inherited
traverse(void visitor(Node child)) → void
Traverses the tree depth-first, calling visitor for each node.
inherited
update(double dt) → void
Called once per frame before rendering.
inherited

Operators

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