1
0
Fork 0

Fixed up external view mode so it works once again.

This commit is contained in:
curt 1999-10-14 17:32:34 +00:00
parent 884dae9c57
commit 7a5fbf1ba3
4 changed files with 36 additions and 41 deletions

View file

@ -224,7 +224,6 @@ bool fgInitSubsystems( void ) {
fgLIGHT *l = &cur_light_params; fgLIGHT *l = &cur_light_params;
FGTime *t = FGTime::cur_time_params; FGTime *t = FGTime::cur_time_params;
FGView *v = &current_view;
FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems"); FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems");
FG_LOG( FG_GENERAL, FG_INFO, "========== =========="); FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
@ -314,7 +313,7 @@ bool fgInitSubsystems( void ) {
<< (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" ); << (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" );
// We need to calculate a few more values here that would normally // 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. // routine doesn't get hosed.
double sea_level_radius_meters; double sea_level_radius_meters;
@ -372,12 +371,14 @@ bool fgInitSubsystems( void ) {
t->update(*cur_fdm_state); t->update(*cur_fdm_state);
// Initialize view parameters // Initialize view parameters
FG_LOG( FG_GENERAL, FG_DEBUG, "Before v->init()"); FG_LOG( FG_GENERAL, FG_DEBUG, "Before current_view.init()");
v->Init(); current_view.Init();
FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()"); pilot_view.Init();
v->UpdateViewMath(*cur_fdm_state); FG_LOG( FG_GENERAL, FG_DEBUG, "After current_view.init()");
FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << v->get_abs_view_pos()); current_view.UpdateViewMath(*cur_fdm_state);
// v->UpdateWorldToEye(f); 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 // Build the solar system
//fgSolarSystemInit(*t); //fgSolarSystemInit(*t);
@ -503,7 +504,6 @@ bool fgInitSubsystems( void ) {
void fgReInitSubsystems( void ) void fgReInitSubsystems( void )
{ {
FGView *v = &current_view;
FGTime *t = FGTime::cur_time_params; FGTime *t = FGTime::cur_time_params;
int toggle_pause = t->getPause(); int toggle_pause = t->getPause();
@ -572,15 +572,15 @@ void fgReInitSubsystems( void )
cur_fdm_state->set_CG_Position( 0.0, 0.0, 0.0 ); cur_fdm_state->set_CG_Position( 0.0, 0.0, 0.0 );
// Initialize view parameters // Initialize view parameters
// FG_LOG( FG_GENERAL, FG_DEBUG, "Before v->init()"); current_view.set_view_offset( 0.0 );
// v->Init(); current_view.set_goal_view_offset( 0.0 );
v->set_view_offset( 0.0 ); pilot_view.set_view_offset( 0.0 );
v->set_goal_view_offset( 0.0 ); pilot_view.set_goal_view_offset( 0.0 );
FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()"); FG_LOG( FG_GENERAL, FG_DEBUG, "After current_view.init()");
v->UpdateViewMath(*cur_fdm_state); current_view.UpdateViewMath(*cur_fdm_state);
FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << v->get_abs_view_pos()); pilot_view.UpdateViewMath(*cur_fdm_state);
// v->UpdateWorldToEye(f); FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << current_view.get_abs_view_pos());
// fgFDMInit( current_options.get_flight_model(), cur_fdm_state, // fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
// 1.0 / current_options.get_model_hz() ); // 1.0 / current_options.get_model_hz() );

View file

@ -141,6 +141,9 @@ ssgBranch *terrain = NULL;
ssgSelector *penguin_sel = NULL; ssgSelector *penguin_sel = NULL;
ssgTransform *penguin_pos = NULL; ssgTransform *penguin_pos = NULL;
// current fdm/position used for view
FGInterface cur_view_fdm;
// hack // hack
sgMat4 copy_of_ssgOpenGLAxisSwapMatrix = sgMat4 copy_of_ssgOpenGLAxisSwapMatrix =
{ {
@ -251,7 +254,10 @@ static void fgRenderFrame( void ) {
// end of hack // end of hack
// update view volume parameters // 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 // set the sun position
xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec ); xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
@ -377,17 +383,9 @@ static void fgRenderFrame( void ) {
ssgSetNearFar( 0.5f, 100000.0f ); ssgSetNearFar( 0.5f, 100000.0f );
} }
// sgMat4 sgVIEW;
// while ( current_view.follow.size() > 25 ) {
// current_view.follow.pop_front();
// }
if ( current_options.get_view_mode() == if ( current_options.get_view_mode() ==
fgOPTIONS::FG_VIEW_FIRST_PERSON ) fgOPTIONS::FG_VIEW_FIRST_PERSON )
{ {
// select current view matrix
// sgCopyMat4( sgVIEW, current_view.sgVIEW );
// disable TuX // disable TuX
penguin_sel->select(0); penguin_sel->select(0);
} else if ( current_options.get_view_mode() == } else if ( current_options.get_view_mode() ==
@ -402,9 +400,9 @@ static void fgRenderFrame( void ) {
sgMat4 sgTRANS; sgMat4 sgTRANS;
sgMakeTransMat4( sgTRANS, sgMakeTransMat4( sgTRANS,
current_view.view_pos.x(), pilot_view.view_pos.x(),
current_view.view_pos.y(), pilot_view.view_pos.y(),
current_view.view_pos.z() ); pilot_view.view_pos.z() );
sgVec3 ownship_up; sgVec3 ownship_up;
sgSetVec3( ownship_up, 0.0, 0.0, 1.0); sgSetVec3( ownship_up, 0.0, 0.0, 1.0);
@ -414,7 +412,7 @@ static void fgRenderFrame( void ) {
sgMat4 sgTMP; sgMat4 sgTMP;
sgMat4 sgTUX; sgMat4 sgTUX;
sgMultMat4( sgTMP, sgROT, current_view.VIEW_ROT ); sgMultMat4( sgTMP, sgROT, pilot_view.VIEW_ROT );
sgMultMat4( sgTUX, sgTMP, sgTRANS ); sgMultMat4( sgTUX, sgTMP, sgTRANS );
sgCoord tuxpos; sgCoord tuxpos;
@ -472,8 +470,6 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
multi_loop = 1; multi_loop = 1;
} }
// fdm_state = *cur_fdm_state;
if ( !t->getPause() ) { if ( !t->getPause() ) {
// run Autopilot system // run Autopilot system
fgAPRun(); fgAPRun();
@ -490,18 +486,17 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
cur_fdm_state->update( 0 ); cur_fdm_state->update( 0 );
} }
/* fdm_list.push_back( *cur_fdm_state );
fdm_list.push_back( fdm_state ); while ( fdm_list.size() > 15 ) {
while ( fdm_list.size() > 25 ) {
fdm_list.pop_front(); fdm_list.pop_front();
} }
if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FIRST_PERSON ) { 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 ) { } 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 // update the view angle
for ( i = 0; i < multi_loop; i++ ) { for ( i = 0; i < multi_loop; i++ ) {
@ -957,7 +952,7 @@ void fgReshape( int width, int height ) {
// the main loop, so this will now work without seg faulting // the main loop, so this will now work without seg faulting
// the system. // the system.
solarSystemRebuild(); solarSystemRebuild();
current_view.UpdateViewParams(*cur_fdm_state); current_view.UpdateViewParams(cur_view_fdm);
if ( current_options.get_panel_status() ) { if ( current_options.get_panel_status() ) {
FGPanel::OurPanel->ReInit(0, 0, 1024, 768); FGPanel::OurPanel->ReInit(0, 0, 1024, 768);
} }

View file

@ -3,7 +3,7 @@
// //
// Written by Curtis Olson, started August 1997. // 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 // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU General Public License as

View file

@ -2,7 +2,7 @@
// //
// Written by Curtis Olson, started August 1997. // 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 // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU General Public License as