Skip to main content

FogParams

Struct FogParams 

Source
#[repr(C)]
pub struct FogParams {
Show 17 fields pub inv_vp: [[f32; 4]; 4], pub color: [f32; 4], pub cam_pos: [f32; 3], pub _pad0: f32, pub sun_dir: [f32; 3], pub _pad1: f32, pub sun_color: [f32; 3], pub _pad2: f32, pub density: f32, pub height_falloff: f32, pub height_reference: f32, pub max_distance: f32, pub phase_g: f32, pub ambient: f32, pub viewport: [f32; 2], pub inv_max_distance: f32, pub _pad3: [f32; 3],
}
Expand description

Per-frame uniform consumed by the volumetric-fog ray-march. Carries the clamped authored tunables plus the view inputs the shader needs to reconstruct world positions from depth and integrate sun-aligned scattering. Pushed verbatim to the fog fragment shader, so the layout must stay in sync with FogParams in metal/shaders/fog.metal. 176 bytes.

Fields§

§inv_vp: [[f32; 4]; 4]

Inverse view-projection: reconstructs world position from depth.

§color: [f32; 4]

Linear-space fog tint (RGB); alpha unused.

§cam_pos: [f32; 3]

World-space camera position. The marcher starts here and walks the view ray to the scene point. _pad keeps cam_pos 16-byte aligned inside MSL.

§_pad0: f32

Padding so the field layout matches the shader-side struct.

§sun_dir: [f32; 3]

First directional light’s world-space direction (toward the light), used for the Henyey-Greenstein phase and the per-step sun radiance.

§_pad1: f32

Padding so the field layout matches the shader-side struct.

§sun_color: [f32; 3]

First directional light’s colour pre-multiplied with its intensity. Drives the per-step sun in-scatter alongside the phase function.

§_pad2: f32

Padding so the field layout matches the shader-side struct.

§density: f32

Base density at height_reference (per world unit).

§height_falloff: f32

Exponential height-falloff rate; 0 = homogeneous medium.

§height_reference: f32

World-space Y at which density equals density.

§max_distance: f32

Ray-march cap in world units.

§phase_g: f32

Henyey-Greenstein anisotropy in (-0.95, 0.95).

§ambient: f32

Ambient (sky-side) scattering term added each step.

§viewport: [f32; 2]

Width / height of the HDR resolve target in pixels: drives the screen→NDC conversion in the fragment shader.

§inv_max_distance: f32

Pre-computed reciprocal of max_distance; the shader uses it to skip a per-step 1 / max_distance divide.

§_pad3: [f32; 3]

Padding so the field layout matches the shader-side struct.

Trait Implementations§

Source§

impl Clone for FogParams

Source§

fn clone(&self) -> FogParams

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 FogParams

Source§

impl Debug for FogParams

Source§

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

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

impl NoUninit for FogParams

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more