code wiki / (root) / nx_atmosphere.nx

nx_atmosphere.nx

buildroot/runtime/nx_atmosphere.nx

10649 B255 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_atmosphere.nx -- atmospheric scattering math primitives. Per honest audit 2026-05-16: visual quality of a world depends on atmospheric depth, fog distribution, and sky color. This primitive ships substrate-native math for: - Per-body atmospheric coefficients (Rayleigh + Mie scaling) - Beer-Lambert extinction along a viewing distance - Sky color as a function of zenith + sun angles (Preetham-style) - Fog density as a function of altitude Used by the rasterizer (queued) and by atmospheric quality graders. genealogy_id: rayleigh_1871 + mie_1908 + preetham_1999_practical_sky + hosek_wilkie_2012_analytic_skylight lineage_id: nx_atmosphere_scattering_q14_v1

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_atmosphere.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_atmosphere_rayleigh_q14 nx_atmosphere_mie_q14 _atm_exp_neg_q14 nx_atmosphere_extinction_q nx_atmosphere_rayleigh_q14 ↻ nx_atmosphere_mie_q14 ↻ _atm_exp_neg_q14 ↻ nx_atmosphere_fog_density_ nx_atmosphere_mie_q14 ↻ _atm_exp_neg_q14 ↻ sys_mmap nx_atmosphere_sky_color_q1

structs

none

consts

25const NX_MAGIC_6029: i64 = 6029
26const NX_MAGIC_2212: i64 = 2212
27const NX_MAGIC_5800: i64 = 5800
28const NX_MAGIC_6200: i64 = 6200
30const NX_ATM_Q: nx_int = 16384
45const NX_BODY_SUN_LOCAL: nx_int = 0 // local alias for SUN
46const NX_BODY_MERCURY_LOCAL: nx_int = 1
47const NX_BODY_VENUS_LOCAL: nx_int = 2
48const NX_BODY_EARTH_LOCAL: nx_int = 3
49const NX_BODY_MARS_LOCAL: nx_int = 4
50const NX_BODY_TITAN_LOCAL: nx_int = 16

functions

52func nx_atmosphere_rayleigh_q14(body_id: nx_int) -> nx_int
61func nx_atmosphere_mie_q14(body_id: nx_int) -> nx_int
74func _atm_exp_neg_q14(x_q14: nx_int) -> nx_int
100func nx_atmosphere_extinction_q14(
119func nx_atmosphere_fog_density_q14(
138func nx_atmosphere_sky_color_q14(
called by 1: main
197func main() -> i64