From b35ababbb7bf89bf0c7a4e3f2593cc5285745aba Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Mon, 27 Jun 2022 14:44:31 -0400 Subject: [PATCH] re-orient world coordinates to match simulation --- src/main.cpp | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c37141a..1c2a717 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -107,7 +107,7 @@ addCoordinateOverlay(RenderState* rs) scaleEntity(e, 5); // TODO: add a gameoverlay that can 'unproject' world coordinates to screen // coords - setEntityPosition(e, vec3(0, -75 / SCALING + 100, 0)); + setEntityPosition(e, vec3(0, 0, 75 / SCALING - 100)); return e; } @@ -119,8 +119,7 @@ initEllipseEntity(RenderState* rs, GameOrbit* orbit, u32 num_vertices) // initSatelliteEntity(), so we're not storing basically the same model // over and over with just different vertices // Could also use a temporary arena maybe? - orbit->e3d = - ellipse3DInit(orbit->system.rotation, orbit->system.ep, num_vertices); + orbit->e3d = ellipse3DInit(orbit->system.rotation, orbit->system.ep, num_vertices); Mesh* m = meshInit(rs->assets.arena, num_vertices, num_vertices, @@ -221,7 +220,6 @@ loadOrbit(GameState* gs, orbit->satellite_entity = initSatelliteEntity(rs, sat_name); scaleEntity(orbit->satellite_entity, 1 / SCALING); - rotateEntity(orbit->satellite_entity, vec3(1, 0, 0), (float) M_PI / 2); setEntityPosition(orbit->satellite_entity, orbit->e3d.vertices[0]); @@ -231,7 +229,7 @@ loadOrbit(GameState* gs, bool loadScene(GameState* gs, RenderState* rs) { - initCamera(rs, vec3(0, -75 / SCALING, 0), vec3(0, 0, 0), vec3(0,0,1)); + initCamera(rs, vec3(0, 0, 75 / SCALING), vec3(0, 0, 0), vec3(0,1,0)); initLights(rs); gs->running = true; @@ -247,22 +245,9 @@ loadScene(GameState* gs, RenderState* rs) gs->coord_overlay = addCoordinateOverlay(rs); -#if 0 - double a = 26564.5; // semi-major axis in km - double e = 0.7411; // eccentricity - GameOrbit* go_1 = loadOrbit(gs, rs, body, orbitInit(a, e), rg, "sat_01"); - addManeuver(go_1, ImpulseType::PROGRADE, -2.f, 0.2); -#endif - - OrbitalElements oe_2 = orbitInit(r + 100, 0, 0, 0, 0, DEG2RAD(-90)); + OrbitalElements oe_2 = orbitInit(20180, 0.15, DEG2RAD(10), DEG2RAD(-90), 0, 0); GameOrbit* go_2 = loadOrbit(gs, rs, body, oe_2, rg, "sat_02"); - addManeuver(go_2, ImpulseType::PROGRADE, DEG2RAD(45), 2.2); - -#if 0 - double a_3 = r + 40000; - double e_3 = 0.5; - loadOrbit(gs, rs, body, orbitInit(a_3, e_3), rg, "sat_03"); -#endif + addManeuver(go_2, ImpulseType::PROGRADE, DEG2RAD(45), 0.5); return true; }