From: curt Date: Sat, 30 Nov 2002 03:05:34 +0000 (+0000) Subject: Massaging the FGTileMgr->update() interface towards using FGLocation. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bcf9fa3695435fb5b27dcd06086799ce62c7803e;p=flightgear.git Massaging the FGTileMgr->update() interface towards using FGLocation. --- diff --git a/src/GUI/gui_local.cxx b/src/GUI/gui_local.cxx index 3d9152bc9..d4d6cab2b 100644 --- a/src/GUI/gui_local.cxx +++ b/src/GUI/gui_local.cxx @@ -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(); diff --git a/src/GUI/preset_dlg.cxx b/src/GUI/preset_dlg.cxx index 811072692..32a6ed61c 100644 --- a/src/GUI/preset_dlg.cxx +++ b/src/GUI/preset_dlg.cxx @@ -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 ) { diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 5f79c96f5..f408f06d6 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -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!" ); diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index d7b3a6da8..00208a862 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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); diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 37508c624..478baf576 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -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(), diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index 02bc675d8..1babc5174 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -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; diff --git a/src/Scenery/tilemgr.hxx b/src/Scenery/tilemgr.hxx index 62eea0490..160dc583d 100644 --- a/src/Scenery/tilemgr.hxx +++ b/src/Scenery/tilemgr.hxx @@ -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 );