|
|
|
|
@ -3,8 +3,7 @@
|
|
|
|
|
#include <cmath> |
|
|
|
|
#include <cstring> |
|
|
|
|
|
|
|
|
|
// Helper function: extract Vec3 from TOML table
|
|
|
|
|
bool extract_vec3_from_table(toml_datum_t table, Vec3* pos) { |
|
|
|
|
static bool extract_vec3_from_table(toml_datum_t table, Vec3* pos) { |
|
|
|
|
toml_datum_t x = toml_get(table, "x"); |
|
|
|
|
toml_datum_t y = toml_get(table, "y"); |
|
|
|
|
toml_datum_t z = toml_get(table, "z"); |
|
|
|
|
@ -22,8 +21,7 @@ bool extract_vec3_from_table(toml_datum_t table, Vec3* pos) {
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Helper function: extract color RGB from TOML table
|
|
|
|
|
bool extract_color_from_table(toml_datum_t table, float* color) { |
|
|
|
|
static bool extract_color_from_table(toml_datum_t table, float* color) { |
|
|
|
|
toml_datum_t r = toml_get(table, "r"); |
|
|
|
|
toml_datum_t g = toml_get(table, "g"); |
|
|
|
|
toml_datum_t b = toml_get(table, "b"); |
|
|
|
|
@ -41,8 +39,7 @@ bool extract_color_from_table(toml_datum_t table, float* color) {
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Parse individual body from TOML table
|
|
|
|
|
bool parse_toml_body(toml_datum_t body_table, CelestialBody* body) { |
|
|
|
|
static bool parse_toml_body(toml_datum_t body_table, CelestialBody* body) { |
|
|
|
|
// Extract string fields
|
|
|
|
|
toml_datum_t name = toml_get(body_table, "name"); |
|
|
|
|
if (name.type != TOML_STRING) { |
|
|
|
|
@ -91,7 +88,6 @@ bool parse_toml_body(toml_datum_t body_table, CelestialBody* body) {
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Load system configuration from TOML file
|
|
|
|
|
bool load_system_config(SimulationState* sim, const char* filepath) { |
|
|
|
|
toml_result_t result = toml_parse_file_ex(filepath); |
|
|
|
|
if (!result.ok) { |
|
|
|
|
|