Celestial body configration files


After procrastinating on this feature for a while, I finally implemented planet/star configs. Interestingly, the hardest part was not the reading itself (it was actually pretty easy, tomlc99 has a nice API!), but removing all the hardcoded stuff from the renderer. And I don't actually regret doing that, because I was able to actually make progress because of it! I've tried rewriting this in C++ or Rust countless times (like 5) and it all kind of slowed down because of me trying to come up with nice abstractions and trying to design the engine so that its nice to work with. Here, I just wrote code without a lot of thinking beforehand; while I have made some abstractions, they're very high-level and aren't slowing me down a whole lot. I'm not proof reading all that by the way, it's like 1am.

Anyway, here's the config file for Earth:

[planet]
name = "Earth"
radius = 6_371_000.0
parent = "Sol"
is_static = false
mass = 1.0
mu = 3.98600436e-4
average_color = 0xf9bf2c
gizmo_color = 0xf9bf2c

[rotation]
speed = -0.026178
axis = [0.0, 1.0, 0.0]

[orbit]
argument = 0.0
eccentricity = 0.0167086
inclination = 0.0
longitude = 0.0
semimajor = 149598.023
true_anomaly = 0.0

[atmosphere]
height = 100_000.0
rayleigh_coefs = [3.8, 13.5, 33.1]
rayleigh_falloff = 13.5
mie_coef = 20.1
mie_ext_coef = 1.1
mie_g_coef = -0.87
mie_falloff = 18.0
intensity = 20.0

[surface]
albedo_texture_path = "data/textures/earth_5k.jpg"
lights_texture_path = "data/textures/earth_lights_2k.jpg"
bump_texture_path = "data/textures/earth_bump_2k.jpg"
spec_texture_path = "data/textures/earth_spec_2k.jpg"