#include <FDM/UIUCModel/uiuc_aircraftdir.h>
#include <GUI/gui.h>
+#include <GUI/sgVec3Slider.hxx>
#include <Joystick/joystick.hxx>
#ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h>
// our initializations out of the glutIdleLoop() so that we can get a
// splash screen up and running right away.
static int idle_state = 0;
-static int global_multi_loop;
+static long global_multi_loop;
// attempt to avoid a large bounce at startup
static bool initial_freeze = true;
cur_fdm_state->get_Psi() * RAD_TO_DEG,
wup );
sgVec3 npo; // new pilot offset after rotation
- sgXformVec3( po, po, pilot_view->get_UP() );
+ sgVec3 *pPO = PilotOffsetGet();
+ sgXformVec3( po, *pPO, pilot_view->get_UP() );
sgXformVec3( npo, po, CXFM );
chase_view->set_geod_view_pos( cur_fdm_state->get_Longitude(),
#endif
thesky->modify_vis( cur_fdm_state->get_Altitude() * FEET_TO_METER,
-
( global_multi_loop *
fgGetInt("/sim/speed-up") ) /
(double)fgGetInt("/sim/model-hz") );
// position tile nodes and update range selectors
global_tile_mgr.prep_ssg_nodes();
- // draw the sky backdrop
- thesky->preDraw();
+ if ( fgGetBool("/sim/rendering/skyblend") ) {
+ // draw the sky backdrop
+ thesky->preDraw();
+ }
// draw the ssg scene
glEnable( GL_DEPTH_TEST );
ssgCullAndDraw( lighting );
- // draw the sky cloud layers
- thesky->postDraw( cur_fdm_state->get_Altitude() * FEET_TO_METER );
+ if ( fgGetBool("/sim/rendering/skyblend") ) {
+ // draw the sky cloud layers
+ thesky->postDraw( cur_fdm_state->get_Altitude() * FEET_TO_METER );
+ }
// display HUD && Panel
glDisable( GL_FOG );
// Update internal time dependent calculations (i.e. flight model)
void fgUpdateTimeDepCalcs() {
+ static bool inited = false;
+
fgLIGHT *l = &cur_light_params;
int i;
- int multi_loop = 1;
+ long multi_loop = 1;
if ( !globals->get_freeze() && !initial_freeze ) {
// conceptually, this could be done for each fdm instance ...
+
+ if ( !inited ) {
+ cur_fdm_state->stamp();
+ inited = true;
+ }
+
SGTimeStamp current;
current.stamp();
long elapsed = current - cur_fdm_state->get_time_stamp();
elapsed += cur_fdm_state->get_remainder();
// cout << "elapsed = " << elapsed << endl;
// cout << "dt = " << cur_fdm_state->get_delta_t() << endl;
- multi_loop = (int)(((double)elapsed * 0.000001) /
+ multi_loop = (long)(((double)elapsed * 0.000001) /
cur_fdm_state->get_delta_t() );
cur_fdm_state->set_multi_loop( multi_loop );
long remainder = elapsed - ( (multi_loop*1000000) *
cur_fdm_state->get_delta_t() );
cur_fdm_state->set_remainder( remainder );
+ // cout << "remainder = " << remainder << endl;
+
+ // chop max interations to something reasonable if the sim was
+ // delayed for an excesive amount of time
+ if ( multi_loop > 2.0 / cur_fdm_state->get_delta_t() ) {
+ multi_loop = (int)(2.0 / cur_fdm_state->get_delta_t());
+ cur_fdm_state->set_remainder( 0 );
+ }
// cout << "multi_loop = " << multi_loop << endl;
- for ( i = 0; i < multi_loop; ++i ) {
+ for ( i = 0; i < multi_loop * fgGetInt("/sim/speed-up"); ++i ) {
// run Autopilot system
current_autopilot->run();
- // update autopiot
- cur_fdm_state->update( 1 * fgGetInt("/sim/speed-up") );
+ // update autopilot
+ cur_fdm_state->update( 1 );
}
FGSteam::update( multi_loop * fgGetInt("/sim/speed-up") );
} else {
// Calculate model iterations needed for next frame
elapsed += remainder;
- global_multi_loop = (int)(((double)elapsed * 0.000001) *
+ global_multi_loop = (long)(((double)elapsed * 0.000001) *
fgGetInt("/sim/model-hz"));
remainder = elapsed - ( (global_multi_loop*1000000) /
fgGetInt("/sim/model-hz") );
"Model iterations needed = " << global_multi_loop
<< ", new remainder = " << remainder );
+ // chop max interations to something reasonable if the sim was
+ // delayed for an excesive amount of time
+ if ( global_multi_loop > 2.0 * fgGetInt("/sim/model-hz") ) {
+ global_multi_loop = (int)(2.0 * fgGetInt("/sim/model-hz") );
+ remainder = 0;
+ }
+
// flight model
if ( global_multi_loop > 0 ) {
fgUpdateTimeDepCalcs();
double mp_factor;
if ( cur_fdm_state->get_engine(0) != NULL ) {
mp_factor =
- cur_fdm_state->get_engine(0)->get_Manifold_Pressure() / 28;
+ cur_fdm_state->get_engine(0)->get_Manifold_Pressure() / 100;
} else {
- mp_factor = 1.0;
+ mp_factor = 0.3;
}
- // cout << "mp = "
- // << cur_fdm_state->get_engine(0)->get_Manifold_Pressure()
- // << endl;
+ /* cout << "mp = "
+ << cur_fdm_state->get_engine(0)->get_Manifold_Pressure()
+ << endl; */
- double volume = mp_factor;
+ double volume = 0.3 + mp_factor;
if ( volume < 0.3 ) { volume = 0.3; }
- if ( volume > 2.0 ) { volume = 2.0; }
+ if ( volume > 1.0 ) { volume = 1.0; }
// cout << "volume = " << volume << endl;
pitch_envelope.setStep ( 0, 0.01, pitch );
FGViewerLookAt *chase = new FGViewerLookAt;
globals->get_viewmgr()->add_view( chase );
+ string_list *col = new string_list;
+ globals->set_channel_options_list( col );
+
// set current view to 0 (first) which is our main pilot view
globals->set_current_view( globals->get_viewmgr()->get_view( 0 ) );