|
|
|
@ -104,10 +104,12 @@ addCoordinateOverlay(RenderState* rs) |
|
|
|
rg->shader->attrib_mappings, |
|
|
|
rg->shader->attrib_mappings, |
|
|
|
"coordinate overlay", |
|
|
|
"coordinate overlay", |
|
|
|
GL_LINES); |
|
|
|
GL_LINES); |
|
|
|
scaleEntity(e, 5); |
|
|
|
|
|
|
|
// TODO: add a gameoverlay that can 'unproject' world coordinates to screen
|
|
|
|
// TODO: add a gameoverlay that can 'unproject' world coordinates to screen
|
|
|
|
// coords
|
|
|
|
// coords
|
|
|
|
setEntityPosition(e, vec3(0, 0, 75 / SCALING - 100)); |
|
|
|
// NOTE: place overlay at origin, and scale so it's big enough to see
|
|
|
|
|
|
|
|
setEntityPosition(e, vec3(0, 0, 0)); |
|
|
|
|
|
|
|
scaleEntity(e, 20 / SCALING); |
|
|
|
|
|
|
|
|
|
|
|
return e; |
|
|
|
return e; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -229,7 +231,7 @@ loadOrbit(GameState* gs, |
|
|
|
bool |
|
|
|
bool |
|
|
|
loadScene(GameState* gs, RenderState* rs) |
|
|
|
loadScene(GameState* gs, RenderState* rs) |
|
|
|
{ |
|
|
|
{ |
|
|
|
initCamera(rs, vec3(0, 0, 75 / SCALING), vec3(0, 0, 0), vec3(0,1,0)); |
|
|
|
initCamera(rs, vec3(-20 / SCALING, -20 / SCALING, 20 / SCALING), vec3(0, 0, 0), vec3(0,0,1)); |
|
|
|
initLights(rs); |
|
|
|
initLights(rs); |
|
|
|
gs->running = true; |
|
|
|
gs->running = true; |
|
|
|
|
|
|
|
|
|
|
|
@ -245,9 +247,9 @@ loadScene(GameState* gs, RenderState* rs) |
|
|
|
|
|
|
|
|
|
|
|
gs->coord_overlay = addCoordinateOverlay(rs); |
|
|
|
gs->coord_overlay = addCoordinateOverlay(rs); |
|
|
|
|
|
|
|
|
|
|
|
OrbitalElements oe_2 = orbitInit(20180, 0.15, DEG2RAD(10), DEG2RAD(-90), 0, 0); |
|
|
|
OrbitalElements el = orbitInit(8000, 0, 0, 0, 0, 0); |
|
|
|
GameOrbit* go_2 = loadOrbit(gs, rs, body, oe_2, rg, "sat_02"); |
|
|
|
GameOrbit* go_1 = loadOrbit(gs, rs, body, el, rg, "sat_01"); |
|
|
|
addManeuver(go_2, ImpulseType::PROGRADE, DEG2RAD(45), 0.5); |
|
|
|
addManeuver(go_1, ImpulseType::PROGRADE, DEG2RAD(-90), 0.4); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -280,15 +282,6 @@ updateSatelliteModel(TwoBodySystem& sys, double time_step) |
|
|
|
sat.position = sys.rotation * glm::vec3(polarToRect(sat.theta, sat.r), 0); |
|
|
|
sat.position = sys.rotation * glm::vec3(polarToRect(sat.theta, sat.r), 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
|
|
|
updateSatelliteEntity(Entity* e, const Satellite& sat) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const static mat4 xform = |
|
|
|
|
|
|
|
glm::rotate(mat4(1.0), (float) M_PI_2, vec3(1, 0, 0)); |
|
|
|
|
|
|
|
const vec3& v = sat.position; |
|
|
|
|
|
|
|
setEntityPosition(e, xform * vec4(v.x, v.y, v.z, 1)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
updateOrbit(GameOrbit* orbit, bool running, double time_step) |
|
|
|
updateOrbit(GameOrbit* orbit, bool running, double time_step) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -297,7 +290,7 @@ updateOrbit(GameOrbit* orbit, bool running, double time_step) |
|
|
|
if (running && orbit->in_use) { |
|
|
|
if (running && orbit->in_use) { |
|
|
|
double previous_true_anom = orbit->system.sat.theta; |
|
|
|
double previous_true_anom = orbit->system.sat.theta; |
|
|
|
updateSatelliteModel(orbit->system, time_step); |
|
|
|
updateSatelliteModel(orbit->system, time_step); |
|
|
|
updateSatelliteEntity(orbit->satellite_entity, orbit->system.sat); |
|
|
|
setEntityPosition(orbit->satellite_entity, orbit->system.sat.position); |
|
|
|
|
|
|
|
|
|
|
|
if (testManeuverStep(orbit->maneuver, |
|
|
|
if (testManeuverStep(orbit->maneuver, |
|
|
|
previous_true_anom, |
|
|
|
previous_true_anom, |
|
|
|
|