#[repr(C)]pub struct FogFroxelParams {
pub view: [[f32; 4]; 4],
pub froxel_dims: [u32; 3],
pub _pad_align: u32,
pub z_near: f32,
pub z_far: f32,
pub _pad: [f32; 2],
}Expand description
Per-frame uniform consumed by the volumetric-fog froxel compute kernel and
the matching fragment-shader sample path. Carries the view matrix (so the
compute kernel + the fragment sampler can map between world-space froxel
positions and the volume’s Z axis) and the discrete volume dimensions. Used
by the froxel-volume fog path; only worlds that declare a VolumetricFog
bind it.
Bound at the fog fragment shader + the froxel kernel. Layout must stay in
sync with FogFroxelParams in shaders/fog.slang, the single source both
halves compile from on every backend. 96 bytes.
Fields§
§view: [[f32; 4]; 4]View matrix (world → view), so the compute kernel can pick a CSM cascade for each froxel and the fragment sampler can map a scene depth into the volume’s Z slice index.
froxel_dims: [u32; 3]Number of froxels along screen-x / screen-y / view-z.
_pad_align: u32Explicit 4-byte pad so the MSL uint3 froxel_dims (which the
MSL alignment rules promote to a 16-byte slot) and the Rust
[u32; 3] (which #[repr(C)] packs to 12 bytes) describe the
same on-wire layout. Without this padding z_near lands at
offset 76 in Rust but offset 80 in MSL, swapping z_near /
z_far and inverting the volume’s Z mapping.
z_near: f32Camera near-plane in view units. The fragment sampler maps a scene
view-z to a normalised volume w via (z - z_near) / (z_far - z_near)
for linear Z.
z_far: f32Camera far-plane mirror: FogSettings.max_distance. The volume
covers [z_near, max_distance] along view-space depth. Beyond
max_distance the sampler clamps to the last slice (already
fully-integrated).
_pad: [f32; 2]Padding so the field layout matches the shader-side struct.
Trait Implementations§
Source§impl Clone for FogFroxelParams
impl Clone for FogFroxelParams
Source§fn clone(&self) -> FogFroxelParams
fn clone(&self) -> FogFroxelParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more