float scene_farplane = 120000.0f;
static double delta_time_sec = 0.0;
-static double replay_dt_sec = 0.0;
#ifdef FG_WEATHERCM
thesky->set_visibility(visibility_meters);
thesky->modify_vis( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER,
- ( global_multi_loop * fgGetInt("/sim/speed-up") )
+ ( global_multi_loop * fgGetInt("/sim/speed-up") )
/ (double)fgGetInt("/sim/model-hz") );
// Set correct opengl fog density
" sun_angle = " << cur_light_params.sun_angle
<< " moon_angle = " << cur_light_params.moon_angle );
*/
- thesky->repaint( cur_light_params.sky_color,
- cur_light_params.adj_fog_color,
- cur_light_params.cloud_color,
- cur_light_params.sun_angle,
- cur_light_params.moon_angle,
- globals->get_ephem()->getNumPlanets(),
- globals->get_ephem()->getPlanets(),
- globals->get_ephem()->getNumStars(),
- globals->get_ephem()->getStars() );
+
+ static SGSkyColor scolor;
+
+ scolor.sky_color = cur_light_params.sky_color;
+ scolor.fog_color = cur_light_params.adj_fog_color;
+ scolor.cloud_color = cur_light_params.cloud_color;
+ scolor.sun_angle = cur_light_params.sun_angle;
+ scolor.moon_angle = cur_light_params.moon_angle;
+ scolor.nplanets = globals->get_ephem()->getNumPlanets();
+ scolor.nstars = globals->get_ephem()->getNumStars();
+ scolor.planet_data = globals->get_ephem()->getPlanets();
+ scolor.star_data = globals->get_ephem()->getStars();
+
+ thesky->repaint( scolor );
/*
SG_LOG( SG_GENERAL, SG_BULK,
} else {
sun_horiz_eff = moon_horiz_eff = 1.0;
}
- thesky->reposition( current__view->get_view_pos(),
- current__view->get_zero_elev(),
- current__view->get_world_up(),
- current__view->getLongitude_deg()
- * SGD_DEGREES_TO_RADIANS,
- current__view->getLatitude_deg()
- * SGD_DEGREES_TO_RADIANS,
- current__view->getAltitudeASL_ft()
- * SG_FEET_TO_METER,
- cur_light_params.sun_rotation,
- globals->get_time_params()->getGst(),
- globals->get_ephem()->getSunRightAscension(),
- globals->get_ephem()->getSunDeclination(),
- 50000.0 * sun_horiz_eff,
- globals->get_ephem()->getMoonRightAscension(),
- globals->get_ephem()->getMoonDeclination(),
- 40000.0 * moon_horiz_eff );
+
+ static SGSkyState sstate;
+
+ sstate.view_pos = current__view->get_view_pos();
+ sstate.zero_elev = current__view->get_zero_elev();
+ sstate.view_up = current__view->get_world_up();
+ sstate.lon = current__view->getLongitude_deg()
+ * SGD_DEGREES_TO_RADIANS;
+ sstate.lat = current__view->getLatitude_deg()
+ * SGD_DEGREES_TO_RADIANS;
+ sstate.alt = current__view->getAltitudeASL_ft()
+ * SG_FEET_TO_METER;
+ sstate.spin = cur_light_params.sun_rotation;
+ sstate.gst = globals->get_time_params()->getGst();
+ sstate.sun_ra = globals->get_ephem()->getSunRightAscension();
+ sstate.sun_dec = globals->get_ephem()->getSunDeclination();
+ sstate.sun_dist = 50000.0 * sun_horiz_eff;
+ sstate.moon_ra = globals->get_ephem()->getMoonRightAscension();
+ sstate.moon_dec = globals->get_ephem()->getMoonDeclination();
+ sstate.moon_dist = 40000.0 * moon_horiz_eff;
+
+ thesky->reposition( sstate );
}
glEnable( GL_DEPTH_TEST );
void fgUpdateTimeDepCalcs() {
static bool inited = false;
- static const SGPropertyNode *replay
- = fgGetNode( "/sim/replay/master", true );
+ static const SGPropertyNode *replay_master
+ = fgGetNode( "/sim/freeze/replay", true );
static SGPropertyNode *replay_time
= fgGetNode( "/sim/replay/time", true );
static const SGPropertyNode *replay_end_time
inited = true;
}
- if ( ! replay->getBoolValue() ) {
- globals->get_autopilot()->update(delta_time_sec);
- cur_fdm_state->update(delta_time_sec);
+ if ( ! replay_master->getBoolValue() ) {
+ globals->get_autopilot()->update( delta_time_sec );
+ cur_fdm_state->update( delta_time_sec );
} else {
FGReplay *r = (FGReplay *)(globals->get_subsystem( "replay" ));
r->replay( replay_time->getDoubleValue() );
replay_time->setDoubleValue( replay_time->getDoubleValue()
- + replay_dt_sec );
+ + ( delta_time_sec
+ * fgGetInt("/sim/speed-up") ) );
}
} else {
// do nothing, fdm isn't inited yet
= fgGetNode("/sim/freeze/clock", true);
static const SGPropertyNode *cur_time_override
= fgGetNode("/sim/time/cur-time-override", true);
- static const SGPropertyNode *replay
- = fgGetNode("/sim/replay/master", true);
+ static const SGPropertyNode *replay_master
+ = fgGetNode("/sim/freeze/replay", true);
// Update the elapsed time.
static bool first_time = true;
}
delta_time_sec = double(current_time_stamp - last_time_stamp) / 1000000.0;
- if ( replay->getBoolValue() ) {
- replay_dt_sec = delta_time_sec;
- }
if ( clock_freeze->getBoolValue() ) {
delta_time_sec = 0;
}
cur_fdm_state->get_Runway_altitude() * SG_FEET_TO_METER,
cur_fdm_state->get_Altitude() * SG_FEET_TO_METER); */
-// Curt is this code used? I don't see any problems when I comment it out.
+#if 0
+// This code is used by LaRCsim/UIUC to position the aircraft at a proper
+// place. This code should eventually go into the LaRCsim directory.
+// Commented out at Jul 27 2003 because tests show it is not needed.
+// Can probbaly be safely removed after Spet. 2003 - EMH
+
if ( acmodel_location != 0 ) {
if ( acmodel_location->get_cur_elev_m() > -9990 && cur_fdm_state->get_inited() ) {
if ( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER <
- (acmodel_location->get_cur_elev_m() + alt_adjust_m - 3.0) ) {
+ (acmodel_location->get_cur_elev_m() + alt_adjust_m - 130.0) ) {
// now set aircraft altitude above ground
printf("(*) Current Altitude = %.2f < %.2f forcing to %.2f\n",
cur_fdm_state->get_Altitude() * SG_FEET_TO_METER,
- acmodel_location->get_cur_elev_m() + alt_adjust_m - 3.0,
+ acmodel_location->get_cur_elev_m() + alt_adjust_m - 130.0,
acmodel_location->get_cur_elev_m() + alt_adjust_m );
cur_fdm_state->set_Altitude( (acmodel_location->get_cur_elev_m()
+ alt_adjust_m) * SG_METER_TO_FEET );
}
}
// End of code in question. (see Curt is this code used? above)
+#endif
/* printf("Adjustment - ground = %.2f runway = %.2f alt = %.2f\n",
scenery.get_cur_elev(),
// Initialize the various GLUT Event Handlers.
if( !fgGlutInitEvents() ) {
- SG_LOG( SG_GENERAL, SG_ALERT,
+ SG_LOG( SG_GENERAL, SG_ALERT,
"GLUT event handler initialization failed ..." );
exit(-1);
}
////////////////////////////////////////////////////////////////////
// Initialize the view manager subsystem.
////////////////////////////////////////////////////////////////////
-
FGViewMgr *viewmgr = new FGViewMgr;
globals->set_viewmgr( viewmgr );
viewmgr->init();