LightSource class
Describes a light source in the 3-D scene.
three_d_ui_builder uses this to compute dynamic shadows and surface highlights in the painter layer. All shading is approximated using custom painters — no GPU hardware lighting is used.
Three types are supported:
- LightSource.directional — a distant light with a constant direction.
- LightSource.point — a positional point light with falloff.
- LightSource.ambient — uniform omnidirectional fill light.
- Annotations
Constructors
- LightSource.ambient({Color color = Colors.white, double intensity = 0.3})
-
Uniform ambient light — no direction, no shadows.
const
- LightSource.directional({Vec3 direction = const Vec3(-0.4, -0.8, 0.4), Color color = Colors.white, double intensity = 0.9})
-
A directional light shining from
direction.const - LightSource.point({required Vec3 position, Color color = Colors.white, double intensity = 1.0, double radius = 400})
-
A point light at
positionwith decayradius.const
Properties
- color → Color
-
Colour of the emitted light.
final
- direction → Vec3
-
Light direction (used by LightType.directional; should be normalised).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- intensity → double
-
Intensity multiplier in
0, 1.final - position → Vec3
-
World-space position (used by LightType.point).
final
- radius → double
-
Maximum reach of a LightType.point light in logical pixels.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → LightType
-
final
Methods
-
diffuseFactor(
Vec3 point, Vec3 normal) → double -
Computes the diffuse lighting factor
0, 1for a surface atpointwith the given outwardnormal. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited