pub struct DirectionalLight {
pub direction: Vec3,
pub color: LinearRgba,
pub intensity: f32,
}Expand description
A directional light source that illuminates from a uniform direction.
Directional lights simulate infinitely distant light sources like the sun. They have no position, only a direction, and cast parallel rays with no falloff.
§Examples
use khora_core::renderer::light::DirectionalLight;
use khora_core::math::{Vec3, LinearRgba};
// Create a warm sunlight
let sun = DirectionalLight {
direction: Vec3::new(-0.5, -1.0, -0.3).normalize(),
color: LinearRgba::new(1.0, 0.95, 0.8, 1.0),
intensity: 1.0,
};Fields§
§direction: Vec3The direction the light is pointing (normalized).
This vector points from the light source towards the scene.
For a sun at noon, this would be (0, -1, 0).
color: LinearRgbaThe color of the light in linear RGB space.
intensity: f32The intensity multiplier for the light.
A value of 1.0 represents standard intensity. Higher values create brighter lights, useful for HDR rendering.
Trait Implementations§
Source§impl Clone for DirectionalLight
impl Clone for DirectionalLight
Source§fn clone(&self) -> DirectionalLight
fn clone(&self) -> DirectionalLight
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DirectionalLight
impl Debug for DirectionalLight
Source§impl Default for DirectionalLight
impl Default for DirectionalLight
Source§impl PartialEq for DirectionalLight
impl PartialEq for DirectionalLight
impl Copy for DirectionalLight
impl StructuralPartialEq for DirectionalLight
Auto Trait Implementations§
impl Freeze for DirectionalLight
impl RefUnwindSafe for DirectionalLight
impl Send for DirectionalLight
impl Sync for DirectionalLight
impl Unpin for DirectionalLight
impl UnwindSafe for DirectionalLight
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more