#[repr(C)]pub struct GpuLight {
pub position: [f32; 3],
pub range: f32,
pub color: [f32; 3],
pub intensity: f32,
pub direction: [f32; 3],
pub kind: u32,
pub cos_inner: f32,
pub cos_outer: f32,
pub shadow_index: i32,
pub data_index: i32,
}Expand description
One local light in the per-scene storage buffer the forward pass iterates
(bound at Metal fragment buffer(8)). 64 bytes = four 16-byte lanes, so every
packed_float3 sits inside one lane with no GPU alignment promotion. Must match
the GpuLight struct in the single-source shaders.
Fields§
§position: [f32; 3]World-space position (point / spot).
range: f32Maximum reach in metres; attenuation reaches zero at this distance.
color: [f32; 3]Linear RGB light colour.
intensity: f32Radiance scale.
direction: [f32; 3]Unit vector the light points along (spot / area). Zero for a point light.
kind: u32LIGHT_KIND_* discriminant.
cos_inner: f32Spot cone: cosine of the inner (full-bright) and outer (cutoff) half-angles.
Both zero for a point light; the shader gates the cone term on kind.
cos_outer: f32Cosine of the spot cone’s outer (cutoff) half-angle.
shadow_index: i32Index into the spot shadow atlas, or -1 when the light casts no shadow.
data_index: i32Index into the AreaLightData table for an area light, or -1 for a point /
spot light. A rect needs two edge vectors that do not fit in the spare
fields here, so the extra data lives in a parallel table (the same shape
shadow_index uses for the spot shadow slices).
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpuLight
impl RefUnwindSafe for GpuLight
impl Send for GpuLight
impl Sync for GpuLight
impl Unpin for GpuLight
impl UnsafeUnpin for GpuLight
impl UnwindSafe for GpuLight
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<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 more