]> git.mxchange.org Git - flightgear.git/commitdiff
Massaging the FGTileMgr->update() interface towards using FGLocation.
authorcurt <curt>
Sat, 30 Nov 2002 03:05:34 +0000 (03:05 +0000)
committercurt <curt>
Sat, 30 Nov 2002 03:05:34 +0000 (03:05 +0000)
src/GUI/gui_local.cxx
src/GUI/preset_dlg.cxx
src/Main/fg_commands.cxx
src/Main/fg_init.cxx
src/Main/main.cxx
src/Scenery/tilemgr.cxx
src/Scenery/tilemgr.hxx

index 3d9152bc939e500dfba7eb5e9b681b386d163457..d4d6cab2be33f8134eb8d47a77d5edd9a816afe6 100644 (file)
@@ -83,9 +83,7 @@ void reInit(puObject *cb)
 
     fgReInitSubsystems();
 
-    global_tile_mgr.update( fgGetDouble("/position/longitude-deg"),
-                            fgGetDouble("/position/latitude-deg"),
-                            fgGetDouble("/environment/visibility-m") );
+    global_tile_mgr.update( fgGetDouble("/environment/visibility-m") );
     
     cur_light_params.Update();
 
index 8110726928a69d5c7a438e0c300968c17e68142e..32a6ed61c94ede0c0c52746d8470fa93b1411edc 100644 (file)
@@ -279,11 +279,8 @@ void fgPresetCommit(puObject *)
     cout << "before tile_mgr init " << longitude->getDoubleValue() << " "
          << latitude->getDoubleValue() << endl;
 
-    double visibility_meters =
-        fgGetDouble("/environment/visibility-m");
-    global_tile_mgr.update( longitude->getDoubleValue(),
-                            latitude->getDoubleValue(),
-                            visibility_meters );
+    double visibility_meters = fgGetDouble("/environment/visibility-m");
+    global_tile_mgr.update( visibility_meters );
     // BusyCursor(1);
 
     if ( !freeze ) {
index 5f79c96f5dd1cfa8dc331de5fc404f0e1c401677..f408f06d6eec08f7f029b850fd65dd1ee8692543 100644 (file)
@@ -289,9 +289,7 @@ do_tile_cache_reload (const SGPropertyNode * arg)
     if ( global_tile_mgr.init() ) {
        // Load the local scenery data
         double visibility_meters = fgGetDouble("/environment/visibility-m");
-       global_tile_mgr.update(fgGetDouble("/position/longitude-deg"),
-                              fgGetDouble("/position/latitude-deg"),
-                              visibility_meters);
+       global_tile_mgr.update( visibility_meters );
     } else {
        SG_LOG( SG_GENERAL, SG_ALERT, 
                "Error in Tile Manager initialization!" );
index d7b3a6da82366870594983802b0c8b7a9b22d9e6..00208a8627aefd80aec90d268248393fb08c525f 100644 (file)
@@ -1242,9 +1242,7 @@ bool fgInitSubsystems() {
         // Load the local scenery data
         double visibility_meters = fgGetDouble("/environment/visibility-m");
                 
-        global_tile_mgr.update( longitude->getDoubleValue(),
-                                latitude->getDoubleValue(),
-                                visibility_meters );
+        global_tile_mgr.update( visibility_meters );
     } else {
         SG_LOG( SG_GENERAL, SG_ALERT, "Error in Tile Manager initialization!" );
         exit(-1);
index 37508c6243eb3a848a99985ca7e5967e580cf1ff..478baf576e6fe0448ee57f845645d8247905b3c0 100644 (file)
@@ -1209,14 +1209,12 @@ static void fgMainLoop( void ) {
     if( acmodel_location != current_view->getFGLocation() ) {
       if( acmodel_location != 0 ) {
         global_tile_mgr.prep_ssg_nodes( acmodel_location, visibility_meters );
-        global_tile_mgr.update( acmodel_location->getLongitude_deg(),
-                           acmodel_location->getLatitude_deg(),
-                            visibility_meters,
-                            acmodel_location->get_absolute_view_pos(),
-                            acmodel_location->get_current_bucket(),
-                            acmodel_location->get_previous_bucket(),
-                            acmodel_location->get_tile_center()
-                            );
+        global_tile_mgr.update( acmodel_location, visibility_meters,
+                                acmodel_location->get_absolute_view_pos(),
+                                acmodel_location->get_current_bucket(),
+                                acmodel_location->get_previous_bucket(),
+                                acmodel_location->get_tile_center()
+                                );
         // save results of update in FGLocation for fdm...
         if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
           acmodel_location->set_cur_elev_m( globals->get_scenery()->get_cur_elev() );
@@ -1233,9 +1231,8 @@ static void fgMainLoop( void ) {
     // IMPORTANT!!! the tilemgr update for view location _must_ be done last 
     // after the FDM's until all of Flight Gear code references the viewer's location
     // for elevation instead of the "scenery's" current elevation.
-    global_tile_mgr.update( current_view->getLongitude_deg(),
-                           current_view->getLatitude_deg(),
-                            visibility_meters,
+    FGLocation *view_location = globals->get_current_view()->getFGLocation();
+    global_tile_mgr.update( view_location, visibility_meters,
                             current_view->get_absolute_view_pos(),
                             current_view->getFGLocation()->get_current_bucket(),
                             current_view->getFGLocation()->get_previous_bucket(),
index 02bc675d8989cc1e5349d8c23f7b2da50029a79d..1babc517446dd059ed20e5e8805f2338c70aa2e4 100644 (file)
@@ -270,10 +270,12 @@ void FGTileMgr::initialize_queue()
 // given the current lon/lat (in degrees), fill in the array of local
 // chunks.  If the chunk isn't already in the cache, then read it from
 // disk.
-int FGTileMgr::update( double lon, double lat, double visibility_meters ) {
+int FGTileMgr::update( double visibility_meters ) {
+    FGLocation *location = globals->get_current_view()->getFGLocation();
     sgdVec3 abs_pos_vector;
-    sgdCopyVec3(abs_pos_vector , globals->get_current_view()->get_absolute_view_pos());
-    return update( lon, lat, visibility_meters, abs_pos_vector,
+    sgdCopyVec3( abs_pos_vector,
+                 globals->get_current_view()->get_absolute_view_pos() );
+    return update( location, visibility_meters, abs_pos_vector,
                    current_bucket, previous_bucket,
                    globals->get_scenery()->get_center() );
 }
@@ -367,14 +369,14 @@ void FGTileMgr::update_queues()
 }
 
 
-int FGTileMgr::update( double lon, double lat, double visibility_meters,
+int FGTileMgr::update( FGLocation *location, double visibility_meters,
                        sgdVec3 abs_pos_vector, SGBucket p_current,
                        SGBucket p_previous, Point3D center ) {
     // SG_LOG( SG_TERRAIN, SG_DEBUG, "FGTileMgr::update() for "
     //         << lon << " " << lat );
 
-    longitude = lon;
-    latitude = lat;
+    longitude = location->getLongitude_deg();
+    latitude = location->getLatitude_deg();
     current_bucket = p_current;
     previous_bucket = p_previous;
 
index 62eea0490743b031bfd1d195fdcfcd4555287e09..160dc583d47fa3915a6b5599157b98ae3d0f1a3f 100644 (file)
@@ -163,8 +163,10 @@ public:
     // given the current lon/lat (in degrees), fill in the array of
     // local chunks.  If the chunk isn't already in the cache, then
     // read it from disk.
-    int update( double lon, double lat, double visibility_meters );
-    int update( double lon, double lat, double visibility_meters, sgdVec3 abs_pos_vector, SGBucket p_current, SGBucket p_previous, Point3D center );
+    int update( double visibility_meters );
+    int update( FGLocation *location, double visibility_meters,
+                sgdVec3 abs_pos_vector, SGBucket p_current,
+                SGBucket p_previous, Point3D center );
     void setCurrentTile( double longitude, double latitude );
     int updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center );