Massaging the FGTileMgr->update() interface towards using FGLocation.
This commit is contained in:
parent
fe4e83a10b
commit
bcf9fa3695
7 changed files with 25 additions and 33 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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!" );
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Reference in a new issue