#[repr(C)]pub struct SingleLightUniform {
pub light_view_proj: [[f32; 4]; 4],
pub pos_or_dir: [f32; 3],
pub light_type: u32,
pub color: [f32; 3],
pub intensity: f32,
pub range: f32,
pub inner_angle: f32,
pub outer_angle: f32,
pub _pad_align: u32,
pub spot_direction: [f32; 3],
pub _pad: [f32; 5],
}Expand description
GPU-side per-light uniform (one entry in the LightsUniform array).
Layout (144 bytes, 16-byte aligned):
- light_view_proj:
[[f32; 4]; 4]= 64 bytes (shadow matrix; only used forlights[0]) - pos_or_dir:
[f32; 3]= 12 bytes (direction for directional, position for point/spot) - light_type: u32 = 4 bytes (0=directional, 1=point, 2=spot)
- color:
[f32; 3]= 12 bytes - intensity: f32 = 4 bytes
- range: f32 = 4 bytes
- inner_angle: f32 = 4 bytes
- outer_angle: f32 = 4 bytes
- _pad_align: u32 = 4 bytes (bridge to 16-byte boundary for spot_direction)
- spot_direction:
[f32; 3]= 12 bytes (spot only; at offset 112 to match WGSL vec3 align) - _pad:
[f32; 5]= 20 bytes (tail padding to 144) Total: 64+12+4+12+4+4+4+4+4+12+20 = 144 bytes
Note: WGSL vec3<f32> has AlignOf=16, so spot_direction must start at offset 112.
The _pad_align field bridges the 4-byte gap between offset 108 and 112.
Fields§
§light_view_proj: [[f32; 4]; 4]Light-space view-projection matrix for shadow map rendering.
pos_or_dir: [f32; 3]World-space position (point/spot) or direction (directional) of the light.
light_type: u32Light type discriminant: 0=directional, 1=point, 2=spot.
color: [f32; 3]Linear RGB color of the light emission.
intensity: f32Luminous intensity multiplier.
range: f32Maximum attenuation range (world units) for point/spot lights.
inner_angle: f32Cosine of the inner cone half-angle (spot lights).
outer_angle: f32Cosine of the outer cone half-angle (spot lights; smooth falloff edge).
_pad_align: u32Alignment padding — bridges 4-byte gap to align spot_direction to offset 112.
spot_direction: [f32; 3]World-space unit direction the spot cone points toward.
_pad: [f32; 5]Tail padding to reach 144-byte struct size.
Trait Implementations§
Source§impl Clone for SingleLightUniform
impl Clone for SingleLightUniform
Source§fn clone(&self) -> SingleLightUniform
fn clone(&self) -> SingleLightUniform
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SingleLightUniform
impl Pod for SingleLightUniform
Auto Trait Implementations§
impl Freeze for SingleLightUniform
impl RefUnwindSafe for SingleLightUniform
impl Send for SingleLightUniform
impl Sync for SingleLightUniform
impl Unpin for SingleLightUniform
impl UnsafeUnpin for SingleLightUniform
impl UnwindSafe for SingleLightUniform
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
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.