|
|
|
|
@ -113,24 +113,22 @@ addCoordinateOverlay(RenderState* rs)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Entity* |
|
|
|
|
initEllipseEntity(RenderState* rs, |
|
|
|
|
const EllipseParameters& ep, |
|
|
|
|
Ellipse3D& e3d, |
|
|
|
|
u32 num_vertices) |
|
|
|
|
initEllipseEntity(RenderState* rs, GameOrbit* orbit, u32 num_vertices) |
|
|
|
|
{ |
|
|
|
|
// FIXME: it might be worth using stack memory here, and in
|
|
|
|
|
// initSatelliteEntity(), so we're not storing basically the same model
|
|
|
|
|
// over and over with just different vertices
|
|
|
|
|
// Could also use a temporary arena maybe?
|
|
|
|
|
e3d = ellipse3DInit(ep, num_vertices); |
|
|
|
|
orbit->e3d = |
|
|
|
|
ellipse3DInit(orbit->system.rotation, orbit->system.ep, num_vertices); |
|
|
|
|
Mesh* m = meshInit(rs->assets.arena, |
|
|
|
|
num_vertices, |
|
|
|
|
num_vertices, |
|
|
|
|
false, |
|
|
|
|
true); |
|
|
|
|
|
|
|
|
|
for (uint i = 0; i < e3d.vert_count; i++) { |
|
|
|
|
m->vertices[i] = e3d.vertices[i]; |
|
|
|
|
for (uint i = 0; i < orbit->e3d.vert_count; i++) { |
|
|
|
|
m->vertices[i] = orbit->e3d.vertices[i]; |
|
|
|
|
m->colors[i] = DEFAULT_ELLIPSE_COLOR; |
|
|
|
|
m->indices[i] = i; |
|
|
|
|
} |
|
|
|
|
@ -216,10 +214,8 @@ loadOrbit(GameState* gs,
|
|
|
|
|
GameOrbit* orbit = getFreeOrbit(gs); |
|
|
|
|
systemInit(orbit->system, body, elements); |
|
|
|
|
|
|
|
|
|
orbit->ellipse_entity = initEllipseEntity(rs, |
|
|
|
|
orbit->system.ep, |
|
|
|
|
orbit->e3d, |
|
|
|
|
DEFAULT_ORBIT_VERTICES); |
|
|
|
|
orbit->ellipse_entity = |
|
|
|
|
initEllipseEntity(rs, orbit, DEFAULT_ORBIT_VERTICES); |
|
|
|
|
setEntityPosition(orbit->ellipse_entity, vec3(0, 0, 0)); |
|
|
|
|
rotateEntity(orbit->ellipse_entity, vec3(1, 0, 0), (float) M_PI / 2); |
|
|
|
|
|
|
|
|
|
@ -258,9 +254,9 @@ loadScene(GameState* gs, RenderState* rs)
|
|
|
|
|
addManeuver(go_1, ImpulseType::PROGRADE, -2.f, 0.2); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
OrbitalElements oe_2 = orbitInit(r + 100, 0, 0, 0, 0, 0); |
|
|
|
|
OrbitalElements oe_2 = orbitInit(r + 100, 0, 0, 0, 0, DEG2RAD(-90)); |
|
|
|
|
GameOrbit* go_2 = loadOrbit(gs, rs, body, oe_2, rg, "sat_02"); |
|
|
|
|
addManeuver(go_2, ImpulseType::PROGRADE, M_PI / 2, 2.2); |
|
|
|
|
addManeuver(go_2, ImpulseType::PROGRADE, DEG2RAD(45), 2.2); |
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
double a_3 = r + 40000; |
|
|
|
|
@ -296,7 +292,7 @@ updateSatelliteModel(TwoBodySystem& sys, double time_step)
|
|
|
|
|
sat.gamma = orbitGetFlightPathAngle(sys.ep.e, sat.theta); |
|
|
|
|
sat.r = orbitGetRadialDistance(sys.ep.e, sys.ep.p, sat.theta); |
|
|
|
|
sat.v = orbitGetVelocity(sys.epsilon, sys.body.mu, sat.r); |
|
|
|
|
sat.position = glm::vec3(polarToRect(sat.theta, sat.r), 0); |
|
|
|
|
sat.position = sys.rotation * glm::vec3(polarToRect(sat.theta, sat.r), 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
|