pub struct FogSettings {
pub color: [f32; 3],
pub density: f32,
pub height_falloff: f32,
pub height_reference: f32,
pub max_distance: f32,
pub phase_g: f32,
pub ambient: f32,
}Expand description
Resolved and clamped fog tunables, threaded into the backend at init.
None from FogSettings::resolve_optional means the world declared no
VolumetricFog: the renderer then skips the fog pass entirely.
Fields§
§color: [f32; 3]Linear RGB colour.
density: f32Fog density at the height reference.
height_falloff: f32How fast density falls off with height.
height_reference: f32World height at which density equals density.
max_distance: f32Furthest world distance the march travels.
phase_g: f32Henyey-Greenstein anisotropy in (-1, 1); 0 is isotropic.
ambient: f32Ambient radiance added to the in-scattered term.
Implementations§
Source§impl FogSettings
impl FogSettings
Sourcepub fn resolve(
color: [f32; 3],
density: f32,
height_falloff: f32,
height_reference: f32,
max_distance: f32,
phase_g: f32,
ambient: f32,
) -> Self
pub fn resolve( color: [f32; 3], density: f32, height_falloff: f32, height_reference: f32, max_distance: f32, phase_g: f32, ambient: f32, ) -> Self
Clamp the authored fields into a safe range. Mirrors VolumetricFog::from_args;
those clamps are the asset-side floor; this is the gfx-side ceiling.
Sourcepub fn params(
&self,
inv_vp: [[f32; 4]; 4],
cam_pos: [f32; 3],
sun_dir: [f32; 3],
sun_color: [f32; 3],
viewport: [f32; 2],
) -> FogParams
pub fn params( &self, inv_vp: [[f32; 4]; 4], cam_pos: [f32; 3], sun_dir: [f32; 3], sun_color: [f32; 3], viewport: [f32; 2], ) -> FogParams
Build the per-frame GPU uniform from these settings and the active
camera. inv_vp is the inverse view-projection used to reconstruct
world positions from depth; cam_pos is the camera origin; sun_dir
and sun_color are the first directional light’s direction (toward
the light) and intensity * colour. viewport is the HDR resolve
target’s pixel dimensions.
Trait Implementations§
Source§impl Clone for FogSettings
impl Clone for FogSettings
Source§fn clone(&self) -> FogSettings
fn clone(&self) -> FogSettings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more