euv-core 0.51.0

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Computes the physical dielectric base Fresnel reflectance `F0 = ((ior - 1) / (ior + 1))^2`.
///
/// # Arguments
///
/// - `f32` - Dielectric index of refraction (`>= 1.0`).
///
/// # Returns
///
/// - `f32` - Scalar dielectric `F0` reflectance.
#[cfg_attr(not(target_arch = "wasm32"), inline)]
#[must_use]
pub fn dielectric_f0_from_ior(ior: f32) -> f32 {
    let clamped: f32 = ior.max(1.0);
    let ratio: f32 = (clamped - 1.0) / (clamped + 1.0);
    ratio * ratio
}