#[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 moreimpl Copy for FogFroxelParams
Source§impl Debug for FogFroxelParams
impl Debug for FogFroxelParams
impl NoUninit for FogFroxelParams
Auto Trait Implementations§
impl Freeze for FogFroxelParams
impl RefUnwindSafe for FogFroxelParams
impl Send for FogFroxelParams
impl Sync for FogFroxelParams
impl Unpin for FogFroxelParams
impl UnsafeUnpin for FogFroxelParams
impl UnwindSafe for FogFroxelParams
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