Skip to main content

apply_falloff

Function apply_falloff 

Source
pub fn apply_falloff(distance: f64, falloff: f64) -> f64
Expand description

Applies the inverse-square falloff formula 1.0 / (1.0 + falloff * d²), clamped to a non-negative result.

§Arguments

  • f64 - The distance from the light source. Negative values are treated as zero.
  • f64 - The falloff coefficient (0.0 disables falloff).

§Returns

  • f64 - A non-negative scalar in the range 0.0..=1.0.