pub struct SpotLight {
pub direction: Vec3,
pub color: LinearRgba,
pub intensity: f32,
pub range: f32,
pub inner_cone_angle: f32,
pub outer_cone_angle: f32,
}Expand description
A spot light source that emits light in a cone from a single point.
Spot lights are like point lights but restricted to a cone of influence. They’re useful for flashlights, stage lights, and car headlights.
§Examples
use khora_core::renderer::light::SpotLight;
use khora_core::math::{Vec3, LinearRgba};
// Create a flashlight
let flashlight = SpotLight {
direction: Vec3::new(0.0, 0.0, -1.0),
color: LinearRgba::WHITE,
intensity: 200.0,
range: 20.0,
inner_cone_angle: 15.0_f32.to_radians(),
outer_cone_angle: 30.0_f32.to_radians(),
};Fields§
§direction: Vec3The direction the spotlight is pointing (normalized).
color: LinearRgbaThe color of the light in linear RGB space.
intensity: f32The intensity of the light in lumens.
range: f32The maximum range of the light in world units.
inner_cone_angle: f32The angle in radians at which the light begins to fall off.
Within this angle from the center of the cone, the light is at full intensity.
outer_cone_angle: f32The angle in radians at which the light is fully attenuated.
Beyond this angle from the center of the cone, there is no light. The region between inner and outer cone angles has smooth falloff.
Trait Implementations§
impl Copy for SpotLight
impl StructuralPartialEq for SpotLight
Auto Trait Implementations§
impl Freeze for SpotLight
impl RefUnwindSafe for SpotLight
impl Send for SpotLight
impl Sync for SpotLight
impl Unpin for SpotLight
impl UnwindSafe for SpotLight
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