]> git.mxchange.org Git - flightgear.git/commitdiff
Fixed up external view mode so it works once again.
authorcurt <curt>
Thu, 14 Oct 1999 17:32:34 +0000 (17:32 +0000)
committercurt <curt>
Thu, 14 Oct 1999 17:32:34 +0000 (17:32 +0000)
src/Main/fg_init.cxx
src/Main/main.cxx
src/Main/views.cxx
src/Main/views.hxx

index c55841088cf34cb241aee0c445b6af2e9d65aea8..c435786c73d22a623d010db3a325fca69da5e580 100644 (file)
@@ -224,7 +224,6 @@ bool fgInitSubsystems( void ) {
 
     fgLIGHT *l = &cur_light_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, "========== ==========");
@@ -314,7 +313,7 @@ bool fgInitSubsystems( void ) {
            << (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;
@@ -372,12 +371,14 @@ bool fgInitSubsystems( void ) {
     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);
@@ -503,7 +504,6 @@ bool fgInitSubsystems( void ) {
 
 void fgReInitSubsystems( void )
 {
-    FGView *v = &current_view;
     FGTime *t = FGTime::cur_time_params;
     
     int toggle_pause = t->getPause();
@@ -572,15 +572,15 @@ void fgReInitSubsystems( void )
     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() );
index 3705cb246865e8cd32af385cf7e125f909c93542..cc13c554e8e4111a0db886e72fc5300aa787969b 100644 (file)
@@ -141,6 +141,9 @@ ssgBranch *terrain = NULL;
 ssgSelector *penguin_sel = NULL;
 ssgTransform *penguin_pos = NULL;
 
+// current fdm/position used for view
+FGInterface cur_view_fdm;
+
 // hack
 sgMat4 copy_of_ssgOpenGLAxisSwapMatrix =
 {
@@ -251,7 +254,10 @@ static void fgRenderFrame( void ) {
        // 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 );
@@ -377,17 +383,9 @@ static void fgRenderFrame( void ) {
            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() == 
@@ -402,9 +400,9 @@ static void fgRenderFrame( void ) {
 
            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);
@@ -414,7 +412,7 @@ static void fgRenderFrame( void ) {
 
            sgMat4 sgTMP;
            sgMat4 sgTUX;
-           sgMultMat4( sgTMP, sgROT, current_view.VIEW_ROT );
+           sgMultMat4( sgTMP, sgROT, pilot_view.VIEW_ROT );
            sgMultMat4( sgTUX, sgTMP, sgTRANS );
        
            sgCoord tuxpos;
@@ -472,8 +470,6 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
        multi_loop = 1;
     }
 
-    // fdm_state = *cur_fdm_state;
-
     if ( !t->getPause() ) {
        // run Autopilot system
        fgAPRun();
@@ -490,18 +486,17 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
        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++ ) {
@@ -957,7 +952,7 @@ void fgReshape( int width, int height ) {
        // 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);
        }
index 275bc3cc9e5700bdc0469a5e173fab9c74ae700b..9e1835a22a65383acb53a08cd9ce1ca1e42e6bf6 100644 (file)
@@ -3,7 +3,7 @@
 //
 // 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
index 9f499db403e1c63b5c2b2388b06a8f2080543522..916cbcf8ce3f84088cee717c6405685fa70f90ab 100644 (file)
@@ -2,7 +2,7 @@
 //
 // 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