Browse Source
- Add tomlc17 library as git submodule - Update Makefile to build tomlc17.c with C compiler - Replace config_loader.cpp with TOML-based implementation - Add helper functions for parsing TOML tables (position, color) - Convert all 5 config files from .txt to .toml format: * configs/solar_system.toml - full solar system with planets and moons * configs/example_binary_star.toml - binary star system * configs/test_simple.toml - various orbit types for testing * tests/configs/earth_circular.toml - Earth orbit test * tests/configs/mars_circular.toml - Mars orbit test - Update all test files to reference .toml extensions - Remove old .txt config files (maintain compatibility) - Support both INT64 and FP64 TOML values (tomlc17 type flexibility) - All automated tests pass with new TOML format Claudemain
13 changed files with 525 additions and 72 deletions
@ -1,3 +1,6 @@
|
||||
[submodule "ext/raylib"] |
||||
path = ext/raylib |
||||
url = https://github.com/raysan5/raylib.git |
||||
[submodule "ext/tomlc17"] |
||||
path = ext/tomlc17 |
||||
url = https://github.com/cktan/tomlc17 |
||||
|
||||
@ -0,0 +1,62 @@
|
||||
# Binary Star System with Planets |
||||
# A simple example of two stars orbiting each other with planets around them |
||||
|
||||
[bodies.stara] |
||||
name = "StarA" |
||||
mass = 1.5e30 |
||||
radius = 8.0e8 |
||||
position = { x = 3.0e11, y = 0, z = 0 } |
||||
parent_index = -1 |
||||
color = { r = 1.0, g = 1.0, b = 0.2 } |
||||
eccentricity = 0 |
||||
semi_major_axis = 0 |
||||
|
||||
[bodies.starb] |
||||
name = "StarB" |
||||
mass = 1.2e30 |
||||
radius = 7.0e8 |
||||
position = { x = -3.7e11, y = 0, z = 0 } |
||||
parent_index = -1 |
||||
color = { r = 0.3, g = 0.5, b = 1.0 } |
||||
eccentricity = 0 |
||||
semi_major_axis = 0 |
||||
|
||||
[bodies.planeta1] |
||||
name = "PlanetA1" |
||||
mass = 6.0e24 |
||||
radius = 7.0e6 |
||||
position = { x = 3.5e11, y = 0, z = 0 } |
||||
parent_index = 0 |
||||
color = { r = 0.8, g = 0.3, b = 0.2 } |
||||
eccentricity = 0 |
||||
semi_major_axis = 3.5e11 |
||||
|
||||
[bodies.planetb1] |
||||
name = "PlanetB1" |
||||
mass = 4.0e24 |
||||
radius = 6.0e6 |
||||
position = { x = -4.2e11, y = 0, z = 0 } |
||||
parent_index = 1 |
||||
color = { r = 0.2, g = 0.8, b = 0.6 } |
||||
eccentricity = 0 |
||||
semi_major_axis = 4.2e11 |
||||
|
||||
[bodies.moona1] |
||||
name = "MoonA1" |
||||
mass = 1.0e23 |
||||
radius = 2.0e6 |
||||
position = { x = 3.52e11, y = 0, z = 0 } |
||||
parent_index = 2 |
||||
color = { r = 0.7, g = 0.7, b = 0.7 } |
||||
eccentricity = 0 |
||||
semi_major_axis = 3.52e11 |
||||
|
||||
[bodies.planeta2] |
||||
name = "PlanetA2" |
||||
mass = 8.0e24 |
||||
radius = 8.0e6 |
||||
position = { x = 4.0e11, y = 0, z = 0 } |
||||
parent_index = 0 |
||||
color = { r = 0.5, g = 0.6, b = 0.3 } |
||||
eccentricity = 0 |
||||
semi_major_axis = 4.0e11 |
||||
@ -0,0 +1,150 @@
|
||||
# Solar System Configuration |
||||
|
||||
[[bodies]] |
||||
name = "Sun" |
||||
mass = 1.989e30 # kg |
||||
radius = 6.96e8 # m |
||||
position = { x = 0.0, y = 0.0, z = 0.0 } |
||||
parent_index = -1 |
||||
color = { r = 1.0, g = 1.0, b = 0.0 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 0.0 |
||||
|
||||
name = "Venus" |
||||
mass = 4.867e24 |
||||
radius = 6.0518e6 |
||||
position = { x = 1.082e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.9, g = 0.7, b = 0.3 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 1.082e11 |
||||
|
||||
[[bodies]] |
||||
name = "Venus" |
||||
mass = 4.867e24 |
||||
radius = 6.0518e6 |
||||
position = { x = 1.082e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.9, g = 0.7, b = 0.3 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 1.082e11 |
||||
|
||||
[[bodies]] |
||||
name = "Earth" |
||||
mass = 5.972e24 |
||||
radius = 6.371e6 |
||||
position = { x = 1.496e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.0, g = 0.5, b = 1.0 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 1.496e11 |
||||
|
||||
[[bodies]] |
||||
name = "Mars" |
||||
mass = 6.39e23 |
||||
radius = 3.3895e6 |
||||
position = { x = 2.279e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.8, g = 0.3, b = 0.1 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 2.279e11 |
||||
|
||||
[[bodies]] |
||||
name = "Jupiter" |
||||
mass = 1.898e27 |
||||
radius = 6.9911e7 |
||||
position = { x = 7.785e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.9, g = 0.7, b = 0.5 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 7.785e11 |
||||
|
||||
[[bodies]] |
||||
name = "Saturn" |
||||
mass = 5.683e26 |
||||
radius = 5.8232e7 |
||||
position = { x = 1.434e12, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.9, g = 0.8, b = 0.6 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 1.434e12 |
||||
|
||||
[[bodies]] |
||||
name = "Uranus" |
||||
mass = 8.681e25 |
||||
radius = 2.5362e7 |
||||
position = { x = 2.871e12, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.5, g = 0.8, b = 0.9 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 2.871e12 |
||||
|
||||
[[bodies]] |
||||
name = "Neptune" |
||||
mass = 1.024e26 |
||||
radius = 2.4622e7 |
||||
position = { x = 4.495e12, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.2, g = 0.4, b = 0.9 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 4.495e12 |
||||
|
||||
[[bodies]] |
||||
name = "Moon" |
||||
mass = 7.342e22 |
||||
radius = 1.737e6 |
||||
position = { x = 1.500e11, y = 0.0, z = 0.0 } |
||||
parent_index = 3 |
||||
color = { r = 0.7, g = 0.7, b = 0.7 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 1.500e11 |
||||
|
||||
[[bodies]] |
||||
name = "Io" |
||||
mass = 8.93e22 |
||||
radius = 1.822e6 |
||||
position = { x = 8.207e11, y = 0.0, z = 0.0 } |
||||
parent_index = 5 |
||||
color = { r = 0.9, g = 0.9, b = 0.3 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 8.207e11 |
||||
|
||||
[[bodies]] |
||||
name = "Europa" |
||||
mass = 4.80e22 |
||||
radius = 1.561e6 |
||||
position = { x = 8.456e11, y = 0.0, z = 0.0 } |
||||
parent_index = 5 |
||||
color = { r = 0.8, g = 0.8, b = 0.7 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 8.456e11 |
||||
|
||||
[[bodies]] |
||||
name = "Ganymede" |
||||
mass = 1.48e23 |
||||
radius = 2.634e6 |
||||
position = { x = 8.853e11, y = 0.0, z = 0.0 } |
||||
parent_index = 5 |
||||
color = { r = 0.6, g = 0.6, b = 0.5 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 8.853e11 |
||||
|
||||
[[bodies]] |
||||
name = "Callisto" |
||||
mass = 1.08e23 |
||||
radius = 2.410e6 |
||||
position = { x = 9.670e11, y = 0.0, z = 0.0 } |
||||
parent_index = 5 |
||||
color = { r = 0.5, g = 0.5, b = 0.4 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 9.670e11 |
||||
|
||||
[[bodies]] |
||||
name = "Titan" |
||||
mass = 1.345e23 |
||||
radius = 2.575e6 |
||||
position = { x = 1.556e12, y = 0.0, z = 0.0 } |
||||
parent_index = 6 |
||||
color = { r = 0.9, g = 0.6, b = 0.3 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 1.556e12 |
||||
@ -0,0 +1,83 @@
|
||||
# Simple Test Configuration |
||||
# Planets in circular and eccentric orbits |
||||
# |
||||
# Orbital periods (for verification): |
||||
# Earth: ~365 days |
||||
# Mars: ~687 days |
||||
# Comet: ~1444 days |
||||
# |
||||
# At t=0: |
||||
# Earth starts at (1.0 AU, 0, 0) = (1.496e11 m, 0, 0) |
||||
# Mars starts at (1.5 AU, 0, 0) = (2.244e11 m, 0, 0) |
||||
# Comet starts at perihelion (0.75 AU, 0, 0) = (1.122e11 m, 0, 0) |
||||
# All orbit counter-clockwise when viewed from +Z |
||||
|
||||
[[bodies]] |
||||
name = "Sun" |
||||
mass = 1.989e30 |
||||
radius = 6.96e8 |
||||
position = { x = 0.0, y = 0.0, z = 0.0 } |
||||
parent_index = -1 |
||||
color = { r = 1.0, g = 1.0, b = 0.0 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 0.0 |
||||
|
||||
[[bodies]] |
||||
name = "Earth" |
||||
mass = 5.972e24 |
||||
radius = 6.371e6 |
||||
position = { x = 1.496e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.0, g = 0.5, b = 1.0 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 1.496e11 |
||||
|
||||
[[bodies]] |
||||
name = "Mars" |
||||
mass = 6.39e23 |
||||
radius = 3.3895e6 |
||||
position = { x = 2.244e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.8, g = 0.3, b = 0.1 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 2.244e11 |
||||
|
||||
[[bodies]] |
||||
name = "Comet" |
||||
mass = 1e14 |
||||
radius = 5e3 |
||||
position = { x = 1.122e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.5, g = 0.8, b = 1.0 } |
||||
eccentricity = 0.7 |
||||
semi_major_axis = 3.74e11 |
||||
|
||||
[[bodies]] |
||||
name = "Parabolic" |
||||
mass = 1e13 |
||||
radius = 3e3 |
||||
position = { x = 7.48e10, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 1.0, g = 1.0, b = 0.5 } |
||||
eccentricity = 1.0 |
||||
semi_major_axis = 7.48e10 |
||||
|
||||
[[bodies]] |
||||
name = "Inclined" |
||||
mass = 1e12 |
||||
radius = 2e3 |
||||
position = { x = 1.795e11, y = 0.0, z = 3.114e10 } |
||||
parent_index = 0 |
||||
color = { r = 0.8, g = 0.8, b = 0.0 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 1.795e11 |
||||
|
||||
[[bodies]] |
||||
name = "Hyperbolic" |
||||
mass = 1e13 |
||||
radius = 3e3 |
||||
position = { x = 7.48e10, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.3, g = 1.0, b = 0.3 } |
||||
eccentricity = 1.5 |
||||
semi_major_axis = -1.496e11 |
||||
@ -0,0 +1,23 @@
|
||||
# Test Configuration: Sun + Earth (circular orbit) |
||||
# Earth at 1 AU with circular orbit |
||||
# Expected orbital period: ~365 days |
||||
|
||||
[[bodies]] |
||||
name = "Sun" |
||||
mass = 1.989e30 |
||||
radius = 6.96e8 |
||||
position = { x = 0.0, y = 0.0, z = 0.0 } |
||||
parent_index = -1 |
||||
color = { r = 1.0, g = 1.0, b = 0.0 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 0.0 |
||||
|
||||
[[bodies]] |
||||
name = "Earth" |
||||
mass = 5.972e24 |
||||
radius = 6.371e6 |
||||
position = { x = 1.496e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.0, g = 0.5, b = 1.0 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 1.496e11 |
||||
@ -0,0 +1,23 @@
|
||||
# Test Configuration: Sun + Mars (circular orbit) |
||||
# Mars at 1.5 AU with circular orbit |
||||
# Expected orbital period: ~687 days |
||||
|
||||
[[bodies]] |
||||
name = "Sun" |
||||
mass = 1.989e30 |
||||
radius = 6.96e8 |
||||
position = { x = 0.0, y = 0.0, z = 0.0 } |
||||
parent_index = -1 |
||||
color = { r = 1.0, g = 1.0, b = 0.0 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 0.0 |
||||
|
||||
[[bodies]] |
||||
name = "Mars" |
||||
mass = 6.39e23 |
||||
radius = 3.3895e6 |
||||
position = { x = 2.244e11, y = 0.0, z = 0.0 } |
||||
parent_index = 0 |
||||
color = { r = 0.8, g = 0.3, b = 0.1 } |
||||
eccentricity = 0.0 |
||||
semi_major_axis = 2.244e11 |
||||
Loading…
Reference in new issue