pub struct SpotLight {
pub position: [f32; 3],
pub direction: [f32; 3],
pub color: [f32; 3],
pub intensity: f32,
pub range: f32,
pub inner_angle: f32,
pub outer_angle: f32,
pub cast_shadows: bool,
}Expand description
A cone-shaped local light: a point light restricted to the cone around
direction, with a soft edge between inner_angle and outer_angle.
Distance attenuation matches PointLight; the cone adds an angular falloff that is full brightness inside the inner cone and fades to black at the outer cone. Spot lights share the same per-scene local-light budget as point lights and are culled by the same clustered pass. Secondary effects (volumetric fog, SDF raymarching, and reflection-probe capture) do not consider them.
SpotLight {
position: [0.0, 4.0, -2.0],
direction: [0.0, -1.0, 0.0],
color: [1.0, 0.9, 0.7],
intensity: 20.0,
range: 10.0,
inner_angle: 18.0,
..Default::default()
};Fields§
§position: [f32; 3]World-space position of the light source.
direction: [f32; 3]Direction the cone points, away from the light. Does not need to be normalised; defaults to straight down when degenerate.
color: [f32; 3]Linear-space RGB colour of the light.
intensity: f32Intensity multiplier applied to the colour.
range: f32Maximum reach in world units; attenuation is zero at this distance.
inner_angle: f32Half-angle in degrees of the fully lit inner cone. Clamped to
outer_angle.
outer_angle: f32Half-angle in degrees at which the cone fades to black. Clamped to (0, 89.9].
cast_shadows: boolWhether this light casts shadows. Shadowed spots claim one slice of the spot shadow map in declaration order; once the slices are used up the remaining spots still light the scene but cast nothing.
Trait Implementations§
Source§impl Component for SpotLight
impl Component for SpotLight
Source§const NAME: &'static str = "SpotLight"
const NAME: &'static str = "SpotLight"
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Source§impl ComponentSlot for SpotLight
impl ComponentSlot for SpotLight
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.