|
|
|
|
@ -11,24 +11,6 @@ static bool load_spacecraft_from_toml(SimulationState* sim, toml_result_t result
|
|
|
|
|
static bool parse_toml_maneuver(toml_datum_t maneuver_table, Maneuver* maneuver, SimulationState* sim); |
|
|
|
|
static bool load_maneuvers_from_toml(SimulationState* sim, toml_result_t result); |
|
|
|
|
|
|
|
|
|
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"); |
|
|
|
|
|
|
|
|
|
// Accept both INT64 and FP64 for coordinates (TOML may parse integers as floats)
|
|
|
|
|
if ((x.type != TOML_FP64 && x.type != TOML_INT64) || |
|
|
|
|
(y.type != TOML_FP64 && y.type != TOML_INT64) || |
|
|
|
|
(z.type != TOML_FP64 && z.type != TOML_INT64)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pos->x = x.type == TOML_FP64 ? x.u.fp64 : (double)x.u.int64; |
|
|
|
|
pos->y = y.type == TOML_FP64 ? y.u.fp64 : (double)y.u.int64; |
|
|
|
|
pos->z = z.type == TOML_FP64 ? z.u.fp64 : (double)z.u.int64; |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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"); |
|
|
|
|
|