Skip to main content

FogFroxelParams

Struct FogFroxelParams 

Source
#[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: u32

Explicit 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: f32

Camera 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: f32

Camera 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

Source§

fn clone(&self) -> FogFroxelParams

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FogFroxelParams

Source§

impl Debug for FogFroxelParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl NoUninit for FogFroxelParams

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.