earths 0.0.3

High-fidelity Earth simulation engine — orbit, atmosphere, geology, hydrology, biosphere, terrain, lighting, rendering, satellites, and temporal systems with full scientific coupling
Documentation
use sciforge::hub::prelude::constants::elements::{atomic_mass, electronegativity};
#[derive(Debug, Clone)]
pub struct PbrMaterial {
    pub albedo: [f32; 4],
    pub roughness: f32,
    pub metallic: f32,
    pub normalstrength: f32,
    pub emissive: [f32; 3],
}
fn metallicfromiron(fewtfrac: f64) -> f32 {
    let mfe = atomic_mass(26);
    let mo = atomic_mass(8);
    let fefractioninfeo = mfe / (mfe + mo);
    let purefe = fewtfrac * fefractioninfeo;
    let en = electronegativity(26).unwrap_or(1.83);
    let metallicscale = (1.0 - en / 4.0).max(0.0);
    (purefe * metallicscale).clamp(0.0, 1.0) as f32
}
impl PbrMaterial {
    pub fn ocean() -> Self {
        Self {
            albedo: [0.01, 0.03, 0.08, 1.0],
            roughness: 0.05,
            metallic: 0.02,
            normalstrength: 1.0,
            emissive: [0.0; 3],
        }
    }
    pub fn grassland() -> Self {
        Self {
            albedo: [0.12, 0.36, 0.08, 1.0],
            roughness: 0.85,
            metallic: 0.0,
            normalstrength: 0.8,
            emissive: [0.0; 3],
        }
    }
    pub fn desert() -> Self {
        Self {
            albedo: [0.76, 0.60, 0.36, 1.0],
            roughness: 0.95,
            metallic: metallicfromiron(0.02),
            normalstrength: 0.6,
            emissive: [0.0; 3],
        }
    }
    pub fn snow() -> Self {
        Self {
            albedo: [0.95, 0.95, 0.97, 1.0],
            roughness: 0.3,
            metallic: 0.0,
            normalstrength: 0.3,
            emissive: [0.0; 3],
        }
    }
    pub fn rock() -> Self {
        Self {
            albedo: [0.35, 0.30, 0.25, 1.0],
            roughness: 0.9,
            metallic: metallicfromiron(0.02),
            normalstrength: 1.0,
            emissive: [0.0; 3],
        }
    }
    pub fn volcanic() -> Self {
        Self {
            albedo: [0.15, 0.08, 0.05, 1.0],
            roughness: 0.7,
            metallic: metallicfromiron(0.10),
            normalstrength: 1.0,
            emissive: [0.8, 0.2, 0.0],
        }
    }
    pub fn forest() -> Self {
        Self {
            albedo: [0.05, 0.20, 0.02, 1.0],
            roughness: 0.9,
            metallic: 0.0,
            normalstrength: 0.9,
            emissive: [0.0; 3],
        }
    }
    pub fn ice() -> Self {
        Self {
            albedo: [0.70, 0.85, 0.92, 0.85],
            roughness: 0.1,
            metallic: 0.04,
            normalstrength: 0.5,
            emissive: [0.0; 3],
        }
    }
}