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<SpotLight, CnResult>
fn from_baked(bytes: &[u8]) -> Result<SpotLight, 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.Source§impl<'de> Deserialize<'de> for SpotLight
impl<'de> Deserialize<'de> for SpotLight
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SpotLight, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SpotLight, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<SpotLight> for ComponentAsset
impl From<SpotLight> for ComponentAsset
Source§fn from(c: SpotLight) -> ComponentAsset
fn from(c: SpotLight) -> ComponentAsset
impl RuntimeComponent for SpotLight
Source§impl Serialize for SpotLight
impl Serialize for SpotLight
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for SpotLight
impl RefUnwindSafe for SpotLight
impl Send for SpotLight
impl Sync for SpotLight
impl Unpin for SpotLight
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().