Remove view/tile/scenery members from globals
- also fix sound manager creation
This commit is contained in:
parent
6b9a28a568
commit
1544641405
8 changed files with 30 additions and 49 deletions
|
@ -691,7 +691,7 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
// to be updated in every loop.
|
||||
// Sound manager is updated last so it can use the CPU while the GPU
|
||||
// is processing the scenery (doubled the frame-rate for me) -EMH-
|
||||
globals->add_subsystem("sound", new FGSoundManager, SGSubsystemMgr::SOUND);
|
||||
globals->add_new_subsystem<FGSoundManager>(SGSubsystemMgr::SOUND);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize the event manager subsystem.
|
||||
|
@ -716,7 +716,7 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Add the FlightGear property utilities.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
globals->add_subsystem("airport-dynamics", new flightgear::AirportDynamicsManager);
|
||||
globals->add_new_subsystem<flightgear::AirportDynamicsManager>();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Add the performance monitoring system.
|
||||
|
@ -897,10 +897,7 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
globals->add_subsystem("aircraft-model", new FGAircraftModel, SGSubsystemMgr::DISPLAY);
|
||||
globals->add_subsystem("model-manager", new FGModelMgr, SGSubsystemMgr::DISPLAY);
|
||||
|
||||
globals->add_subsystem("view-manager", new FGViewMgr, SGSubsystemMgr::DISPLAY);
|
||||
|
||||
globals->add_subsystem("tile-manager", globals->get_tile_mgr(),
|
||||
SGSubsystemMgr::DISPLAY);
|
||||
globals->add_new_subsystem<FGViewMgr>(SGSubsystemMgr::DISPLAY);
|
||||
}
|
||||
|
||||
void fgPostInitSubsystems()
|
||||
|
@ -1050,8 +1047,9 @@ void fgStartNewReset()
|
|||
|
||||
// order is important here since tile-manager shutdown needs to
|
||||
// access the scenery object
|
||||
globals->set_tile_mgr(NULL);
|
||||
globals->set_scenery(NULL);
|
||||
subsystemManger->remove(FGTileMgr::subsystemName());
|
||||
subsystemManger->remove(FGScenery::subsystemName());
|
||||
|
||||
FGScenery::getPagerSingleton()->clearRequests();
|
||||
flightgear::CameraGroup::setDefault(NULL);
|
||||
|
||||
|
|
|
@ -158,7 +158,6 @@ FGGlobals::FGGlobals() :
|
|||
fg_home( "" ),
|
||||
time_params( NULL ),
|
||||
ephem( NULL ),
|
||||
viewmgr( NULL ),
|
||||
commands( SGCommandMgr::instance() ),
|
||||
channel_options_list( NULL ),
|
||||
initial_waypoints( NULL ),
|
||||
|
@ -217,9 +216,9 @@ FGGlobals::~FGGlobals()
|
|||
subsystem_mgr->unbind();
|
||||
|
||||
subsystem_mgr->remove("aircraft-model");
|
||||
subsystem_mgr->remove("tile-manager");
|
||||
subsystem_mgr->remove("model-manager");
|
||||
_tile_mgr.clear();
|
||||
|
||||
subsystem_mgr->remove(FGTileMgr::subsystemName());
|
||||
|
||||
osg::ref_ptr<osgViewer::Viewer> vw(renderer->getViewer());
|
||||
if (vw) {
|
||||
|
@ -238,10 +237,10 @@ FGGlobals::~FGGlobals()
|
|||
}
|
||||
|
||||
osgDB::Registry::instance()->clearObjectCache();
|
||||
subsystem_mgr->remove(FGScenery::subsystemName());
|
||||
|
||||
// renderer touches subsystems during its destruction
|
||||
set_renderer(NULL);
|
||||
_scenery.clear();
|
||||
_chatter_queue.clear();
|
||||
|
||||
delete subsystem_mgr;
|
||||
|
@ -694,12 +693,6 @@ FGGlobals::saveUserSettings()
|
|||
}
|
||||
}
|
||||
|
||||
FGViewer *
|
||||
FGGlobals::get_current_view () const
|
||||
{
|
||||
return viewmgr->get_current_view();
|
||||
}
|
||||
|
||||
long int FGGlobals::get_warp() const
|
||||
{
|
||||
return fgGetInt("/sim/time/warp");
|
||||
|
@ -722,22 +715,23 @@ void FGGlobals::set_warp_delta( long int d )
|
|||
|
||||
FGScenery* FGGlobals::get_scenery () const
|
||||
{
|
||||
return _scenery.get();
|
||||
}
|
||||
|
||||
void FGGlobals::set_scenery ( FGScenery *s )
|
||||
{
|
||||
_scenery = s;
|
||||
return get_subsystem<FGScenery>();
|
||||
}
|
||||
|
||||
FGTileMgr* FGGlobals::get_tile_mgr () const
|
||||
{
|
||||
return _tile_mgr.get();
|
||||
return get_subsystem<FGTileMgr>();
|
||||
}
|
||||
|
||||
void FGGlobals::set_tile_mgr ( FGTileMgr *t )
|
||||
FGViewMgr *FGGlobals::get_viewmgr() const
|
||||
{
|
||||
_tile_mgr = t;
|
||||
return get_subsystem<FGViewMgr>();
|
||||
}
|
||||
|
||||
FGViewer* FGGlobals::get_current_view () const
|
||||
{
|
||||
FGViewMgr* vm = get_viewmgr();
|
||||
return vm ? vm->get_current_view() : 0;
|
||||
}
|
||||
|
||||
void FGGlobals::set_matlib( SGMaterialLib *m )
|
||||
|
|
|
@ -120,9 +120,6 @@ private:
|
|||
// Material properties library
|
||||
SGSharedPtr<SGMaterialLib> matlib;
|
||||
|
||||
// viewer manager
|
||||
FGViewMgr *viewmgr;
|
||||
|
||||
SGCommandMgr *commands;
|
||||
|
||||
// list of serial port-like configurations
|
||||
|
@ -132,12 +129,6 @@ private:
|
|||
// and or flight-plan file during initialization
|
||||
string_list *initial_waypoints;
|
||||
|
||||
// FlightGear scenery manager
|
||||
SGSharedPtr<FGScenery> _scenery;
|
||||
|
||||
// Tile manager
|
||||
SGSharedPtr<FGTileMgr> _tile_mgr;
|
||||
|
||||
FGFontCache *fontcache;
|
||||
|
||||
// Navigational Aids
|
||||
|
@ -304,10 +295,6 @@ public:
|
|||
inline SGMaterialLib *get_matlib() const { return matlib; }
|
||||
void set_matlib( SGMaterialLib *m );
|
||||
|
||||
inline FGViewMgr *get_viewmgr() const { return viewmgr; }
|
||||
inline void set_viewmgr( FGViewMgr *vm ) { viewmgr = vm; }
|
||||
FGViewer *get_current_view() const;
|
||||
|
||||
inline SGPropertyNode *get_props () { return props; }
|
||||
|
||||
/**
|
||||
|
@ -345,13 +332,14 @@ public:
|
|||
initial_waypoints = list;
|
||||
}
|
||||
|
||||
FGViewMgr *get_viewmgr() const;
|
||||
FGViewer *get_current_view() const;
|
||||
|
||||
FGControls *get_controls() const;
|
||||
|
||||
FGScenery * get_scenery () const;
|
||||
void set_scenery ( FGScenery *s );
|
||||
|
||||
FGTileMgr * get_tile_mgr () const;
|
||||
void set_tile_mgr ( FGTileMgr *t );
|
||||
|
||||
inline FGFontCache *get_fontcache() const { return fontcache; }
|
||||
|
||||
|
|
|
@ -260,10 +260,10 @@ static void fgIdleFunction ( void ) {
|
|||
// Initialize the TG scenery subsystem.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
globals->set_scenery( new FGScenery );
|
||||
globals->add_new_subsystem<FGScenery>(SGSubsystemMgr::DISPLAY);
|
||||
globals->get_scenery()->init();
|
||||
globals->get_scenery()->bind();
|
||||
globals->set_tile_mgr( new FGTileMgr );
|
||||
globals->add_new_subsystem<FGTileMgr>(SGSubsystemMgr::DISPLAY);
|
||||
|
||||
fgSplashProgress("creating-subsystems");
|
||||
} else if (( idle_state == 7 ) || (idle_state == 2007)) {
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
~FGSoundManager() {}
|
||||
|
||||
void update(double dt) {}
|
||||
|
||||
static const char* subsystemName() { return "sound"; }
|
||||
};
|
||||
|
||||
#endif // ENABLE_AUDIO_SUPPORT
|
||||
|
|
|
@ -199,9 +199,9 @@ fgviewerMain(int argc, char** argv)
|
|||
throw sg_io_exception("Error loading materials file", mpath);
|
||||
}
|
||||
|
||||
globals->set_scenery( new FGScenery );
|
||||
globals->get_scenery()->init();
|
||||
globals->get_scenery()->bind();
|
||||
FGScenery* scenery = globals->add_new_subsystem<FGScenery>();
|
||||
scenery->init();
|
||||
scenery->bind();
|
||||
|
||||
// The file path list must be set in the registry.
|
||||
osgDB::Registry::instance()->getDataFilePathList() = filePathList;
|
||||
|
|
|
@ -45,13 +45,11 @@ FGViewMgr::FGViewMgr( void ) :
|
|||
current_view_orientation(SGQuatd::zeros()),
|
||||
current_view_or_offset(SGQuatd::zeros())
|
||||
{
|
||||
globals->set_viewmgr(this);
|
||||
}
|
||||
|
||||
// Destructor
|
||||
FGViewMgr::~FGViewMgr( void )
|
||||
{
|
||||
globals->set_viewmgr(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
|
||||
void add_view( FGViewer * v );
|
||||
|
||||
static const char* subsystemName() { return "view-mgr"; }
|
||||
private:
|
||||
void do_bind();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue