pub struct PointLight {
pub color: LinearRgba,
pub intensity: f32,
pub range: f32,
pub shadow_enabled: bool,
pub shadow_bias: f32,
pub shadow_normal_bias: 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,
shadow_enabled: false,
shadow_bias: 0.01,
shadow_normal_bias: 0.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.
shadow_enabled: boolWhether this light casts shadows.
shadow_bias: f32Constant bias to apply to depth values to prevent shadow acne.
shadow_normal_bias: f32Normal-based bias to apply to prevent shadow acne on sloped surfaces.
Trait Implementations§
Source§impl Clone for PointLight
impl Clone for PointLight
Source§fn clone(&self) -> PointLight
fn clone(&self) -> PointLight
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more