pub struct PointLight {
pub color: LinearRgba,
pub intensity: f32,
pub range: f32,
}Expand description
A point light source that emits light in all directions from a single point.
Point lights simulate local light sources like light bulbs or candles. They have a position (provided by the entity’s transform) and attenuate with distance according to the inverse-square law.
§Examples
use khora_core::renderer::light::PointLight;
use khora_core::math::LinearRgba;
// Create a warm indoor light
let lamp = PointLight {
color: LinearRgba::new(1.0, 0.9, 0.7, 1.0),
intensity: 100.0,
range: 10.0,
};Fields§
§color: LinearRgbaThe color of the light in linear RGB space.
intensity: f32The intensity of the light in lumens.
Higher values create brighter lights. This is used in conjunction with the physically-based attenuation formula.
range: f32The maximum range of the light in world units.
Beyond this distance, the light has no effect. This is used for performance optimization to cull lights that won’t contribute to a fragment’s lighting.
Trait Implementations§
Source§impl Clone for PointLight
impl Clone for PointLight
Source§fn clone(&self) -> PointLight
fn clone(&self) -> PointLight
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 PointLight
impl Debug for PointLight
Source§impl Default for PointLight
impl Default for PointLight
Source§impl PartialEq for PointLight
impl PartialEq for PointLight
impl Copy for PointLight
impl StructuralPartialEq for PointLight
Auto Trait Implementations§
impl Freeze for PointLight
impl RefUnwindSafe for PointLight
impl Send for PointLight
impl Sync for PointLight
impl Unpin for PointLight
impl UnwindSafe for PointLight
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