moons 0.0.3

Moon celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use moons::terrain::lod::{LodConfig, lod_level};
use moons::terrain::mesh::SphericalPatch;
use moons::terrain::texturing::{TerrainMaterial, material_from_albedo};

fn ensure_earth_context() {
    let earth_context = moons::interactions::earths::ensure_earths_binary_or_simulate();
    assert!(earth_context.orbital_angle_deg >= 0.0);
}

#[test]
fn closer_camera_uses_higher_lod() {
    ensure_earth_context();
    let config = LodConfig::default();
    assert!(lod_level(config, 50_000.0) >= lod_level(config, 500_000.0));
}

#[test]
fn patch_triangle_count_scales_with_resolution() {
    ensure_earth_context();
    let low = SphericalPatch::new(8);
    let high = SphericalPatch::new(32);
    assert!(high.triangle_count() > low.triangle_count());
}

#[test]
fn albedo_maps_to_expected_materials() {
    ensure_earth_context();
    assert_eq!(
        material_from_albedo(0.08, false),
        TerrainMaterial::MareBasalt
    );
    assert_eq!(material_from_albedo(0.25, true), TerrainMaterial::PolarIce);
}