#[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 shadow_map_index: i32,
pub shadow_bias: f32,
pub shadow_normal_bias: f32,
pub _unused: f32,
}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: 72 bytes (18 × 4-byte fields), padded from 64 after shadow fields were added.
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).
shadow_map_index: i32Index into the shadow texture array, or -1 if no shadow.
shadow_bias: f32Shadow bias.
shadow_normal_bias: f32Shadow normal bias.
_unused: f32Padding/Reserved.
Implementations§
Source§impl GpuLight
impl GpuLight
Sourcepub const TYPE_DIRECTIONAL: u32 = 0
pub const TYPE_DIRECTIONAL: u32 = 0
Light type constant for directional lights.
Sourcepub const TYPE_POINT: u32 = 1
pub const TYPE_POINT: u32 = 1
Light type constant for point lights.
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
§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
bits
as &Self.