fgLIGHT *l = &cur_light_params;
FGTime *t = FGTime::cur_time_params;
- FGView *v = ¤t_view;
FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems");
FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
<< (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" );
// We need to calculate a few more values here that would normally
- // be calculated by the FDM so that the v->UpdateViewMath()
+ // be calculated by the FDM so that the current_view.UpdateViewMath()
// routine doesn't get hosed.
double sea_level_radius_meters;
t->update(*cur_fdm_state);
// Initialize view parameters
- FG_LOG( FG_GENERAL, FG_DEBUG, "Before v->init()");
- v->Init();
- FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
- v->UpdateViewMath(*cur_fdm_state);
- FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << v->get_abs_view_pos());
- // v->UpdateWorldToEye(f);
+ FG_LOG( FG_GENERAL, FG_DEBUG, "Before current_view.init()");
+ current_view.Init();
+ pilot_view.Init();
+ FG_LOG( FG_GENERAL, FG_DEBUG, "After current_view.init()");
+ current_view.UpdateViewMath(*cur_fdm_state);
+ pilot_view.UpdateViewMath(*cur_fdm_state);
+ FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << current_view.get_abs_view_pos());
+ // current_view.UpdateWorldToEye(f);
// Build the solar system
//fgSolarSystemInit(*t);
void fgReInitSubsystems( void )
{
- FGView *v = ¤t_view;
FGTime *t = FGTime::cur_time_params;
int toggle_pause = t->getPause();
cur_fdm_state->set_CG_Position( 0.0, 0.0, 0.0 );
// Initialize view parameters
- // FG_LOG( FG_GENERAL, FG_DEBUG, "Before v->init()");
- // v->Init();
- v->set_view_offset( 0.0 );
- v->set_goal_view_offset( 0.0 );
-
- FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
- v->UpdateViewMath(*cur_fdm_state);
- FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << v->get_abs_view_pos());
- // v->UpdateWorldToEye(f);
+ current_view.set_view_offset( 0.0 );
+ current_view.set_goal_view_offset( 0.0 );
+ pilot_view.set_view_offset( 0.0 );
+ pilot_view.set_goal_view_offset( 0.0 );
+
+ FG_LOG( FG_GENERAL, FG_DEBUG, "After current_view.init()");
+ current_view.UpdateViewMath(*cur_fdm_state);
+ pilot_view.UpdateViewMath(*cur_fdm_state);
+ FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << current_view.get_abs_view_pos());
// fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
// 1.0 / current_options.get_model_hz() );
ssgSelector *penguin_sel = NULL;
ssgTransform *penguin_pos = NULL;
+// current fdm/position used for view
+FGInterface cur_view_fdm;
+
// hack
sgMat4 copy_of_ssgOpenGLAxisSwapMatrix =
{
// end of hack
// update view volume parameters
- current_view.UpdateViewParams(*cur_fdm_state);
+ // cout << "before pilot_view update" << endl;
+ pilot_view.UpdateViewParams(*cur_fdm_state);
+ // cout << "after pilot_view update" << endl;
+ current_view.UpdateViewParams(cur_view_fdm);
// set the sun position
xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
ssgSetNearFar( 0.5f, 100000.0f );
}
- // sgMat4 sgVIEW;
- // while ( current_view.follow.size() > 25 ) {
- // current_view.follow.pop_front();
- // }
-
if ( current_options.get_view_mode() ==
fgOPTIONS::FG_VIEW_FIRST_PERSON )
{
- // select current view matrix
- // sgCopyMat4( sgVIEW, current_view.sgVIEW );
-
// disable TuX
penguin_sel->select(0);
} else if ( current_options.get_view_mode() ==
sgMat4 sgTRANS;
sgMakeTransMat4( sgTRANS,
- current_view.view_pos.x(),
- current_view.view_pos.y(),
- current_view.view_pos.z() );
+ pilot_view.view_pos.x(),
+ pilot_view.view_pos.y(),
+ pilot_view.view_pos.z() );
sgVec3 ownship_up;
sgSetVec3( ownship_up, 0.0, 0.0, 1.0);
sgMat4 sgTMP;
sgMat4 sgTUX;
- sgMultMat4( sgTMP, sgROT, current_view.VIEW_ROT );
+ sgMultMat4( sgTMP, sgROT, pilot_view.VIEW_ROT );
sgMultMat4( sgTUX, sgTMP, sgTRANS );
sgCoord tuxpos;
multi_loop = 1;
}
- // fdm_state = *cur_fdm_state;
-
if ( !t->getPause() ) {
// run Autopilot system
fgAPRun();
cur_fdm_state->update( 0 );
}
- /*
- fdm_list.push_back( fdm_state );
- while ( fdm_list.size() > 25 ) {
+ fdm_list.push_back( *cur_fdm_state );
+ while ( fdm_list.size() > 15 ) {
fdm_list.pop_front();
}
if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FIRST_PERSON ) {
- *cur_fdm_state = fdm_state;
+ cur_view_fdm = *cur_fdm_state;
+ // do nothing
} else if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW ) {
- *cur_fdm_state = fdm_list.front();
+ cur_view_fdm = fdm_list.front();
}
- */
// update the view angle
for ( i = 0; i < multi_loop; i++ ) {
// the main loop, so this will now work without seg faulting
// the system.
solarSystemRebuild();
- current_view.UpdateViewParams(*cur_fdm_state);
+ current_view.UpdateViewParams(cur_view_fdm);
if ( current_options.get_panel_status() ) {
FGPanel::OurPanel->ReInit(0, 0, 1024, 768);
}
//
// Written by Curtis Olson, started August 1997.
//
-// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
+// Copyright (C) 1997 Curtis L. Olson - curt@flightgear.org
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
//
// Written by Curtis Olson, started August 1997.
//
-// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
+// Copyright (C) 1997 Curtis L. Olson - curt@flightgear.org
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as