#[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: f32Padding 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: f32Padding 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: f32Padding so the field layout matches the shader-side struct.
density: f32Base density at height_reference (per world unit).
height_falloff: f32Exponential height-falloff rate; 0 = homogeneous medium.
height_reference: f32World-space Y at which density equals density.
max_distance: f32Ray-march cap in world units.
phase_g: f32Henyey-Greenstein anisotropy in (-0.95, 0.95).
ambient: f32Ambient (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: f32Pre-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§
impl Copy for FogParams
impl NoUninit for FogParams
Auto Trait Implementations§
impl Freeze for FogParams
impl RefUnwindSafe for FogParams
impl Send for FogParams
impl Sync for FogParams
impl Unpin for FogParams
impl UnsafeUnpin for FogParams
impl UnwindSafe for FogParams
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