#[repr(C)]pub struct GpuLight {
pub position: [f32; 3],
pub range: f32,
pub color: [f32; 3],
pub intensity: f32,
pub direction: [f32; 3],
pub light_type: u32,
pub inner_cone_cos: f32,
pub outer_cone_cos: f32,
pub _padding: [f32; 2],
}Expand description
GPU-friendly representation of a light source for compute shader processing.
This structure is designed for efficient GPU transfer and compute shader access. It uses a unified layout that can represent all light types.
§Memory Layout
Total size: 64 bytes (16 × 4-byte floats), well-aligned for GPU access.
Fields§
§position: [f32; 3]Light position in world space (ignored for directional lights).
range: f32Maximum range of the light (point/spot lights only).
color: [f32; 3]Light color (RGB, linear space).
intensity: f32Light intensity multiplier.
direction: [f32; 3]Light direction (normalized, for directional/spot lights).
light_type: u32Light type: 0 = directional, 1 = point, 2 = spot.
inner_cone_cos: f32Cosine of inner cone angle (spot lights only).
outer_cone_cos: f32Cosine of outer cone angle (spot lights only).
_padding: [f32; 2]Padding to ensure 64-byte alignment.
Implementations§
Trait Implementations§
impl Copy for GpuLight
impl Pod for GpuLight
impl StructuralPartialEq for GpuLight
Auto Trait Implementations§
impl Freeze for GpuLight
impl RefUnwindSafe for GpuLight
impl Send for GpuLight
impl Sync for GpuLight
impl Unpin 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
Mutably borrows from an owned value. Read more
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§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.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.