aip.init( 0 );
_model = 0;
// pass it on to the pager, to be be deleted in the pager thread
- pSceneryManager->getPagerSingleton()->queueDeleteRequest(temp);
+ pSceneryManager->getPager()->queueDeleteRequest(temp);
}
else
{
FGScenery::FGScenery()
{
SG_LOG( SG_TERRAIN, SG_INFO, "Initializing scenery subsystem" );
+ // keep reference to pager singleton, so it cannot be destroyed while FGScenery lives
+ _pager = FGScenery::getPagerSingleton();
}
FGScenery::~FGScenery() {
SGVec3f p = SGVec3f::fromGeod(SGGeod::fromGeodM(position, elev));
osg::FrameStamp* framestamp
= globals->get_renderer()->getViewer()->getFrameStamp();
- simgear::CheckSceneryVisitor csnv(getPagerSingleton(), toOsg(p), range_m, framestamp);
+ simgear::CheckSceneryVisitor csnv(_pager, toOsg(p), range_m, framestamp);
// currently the PagedLODs will not be loaded by the DatabasePager
// while the splashscreen is there, so CheckSceneryVisitor force-loads
// missing objects in the main thread
osg::ref_ptr<osg::Group> terrain_branch;
osg::ref_ptr<osg::Group> models_branch;
osg::ref_ptr<osg::Group> aircraft_branch;
+ osg::ref_ptr<flightgear::SceneryPager> _pager;
public:
const SGMaterial** material,
const osg::Node* butNotFrom = 0);
- /// Compute the elevation of the scenery beow the cartesian point pos.
+ /// Compute the elevation of the scenery below the cartesian point pos.
/// you the returned scenery altitude is not higher than the position
- /// pos plus an ofset given with max_altoff.
+ /// pos plus an offset given with max_altoff.
/// If the exact flag is set to true, the scenery center is moved to
/// gain a higher accuracy of that query. The center is restored past
/// that to the original value.
/// Compute the nearest intersection point of the line starting from
/// start going in direction dir with the terrain.
/// The input and output values should be in cartesian coordinates in the
- /// usual earth centered wgs84 coordiante system. Units are meters.
+ /// usual earth centered wgs84 coordinate system. Units are meters.
/// On success, true is returned.
bool get_cart_ground_intersection(const SGVec3d& start, const SGVec3d& dir,
SGVec3d& nearestHit,
osg::Group *get_models_branch () const { return models_branch.get(); }
osg::Group *get_aircraft_branch () const { return aircraft_branch.get(); }
- /// Returns true if scenery is avaliable for the given lat, lon position
+ /// Returns true if scenery is available for the given lat, lon position
/// within a range of range_m.
/// lat and lon are expected to be in degrees.
bool scenery_available(const SGGeod& position, double range_m);
// Static because access to the pager is needed before the rest of
// the scenery is initialized.
static flightgear::SceneryPager* getPagerSingleton();
+ flightgear::SceneryPager* getPager() { return _pager.get(); }
};
_terra_sync(NULL),
_visibilityMeters(fgGetNode("/environment/visibility-m", true)),
_maxTileRangeM(fgGetNode("/sim/rendering/static-lod/bare", true)),
- _disableNasalHooks(fgGetNode("/sim/temp/disable-scenery-nasal", true))
+ _disableNasalHooks(fgGetNode("/sim/temp/disable-scenery-nasal", true)),
+ _pager(FGScenery::getPagerSingleton())
{
}
*/
void FGTileMgr::update_queues()
{
- SceneryPager* pager = FGScenery::getPagerSingleton();
osg::FrameStamp* framestamp
= globals->get_renderer()->getViewer()->getFrameStamp();
double current_time = framestamp->getReferenceTime();
e->is_current_view() ))
{
// schedule tile for loading with osg pager
- pager->queueRequest(e->tileFileName,
- e->getNode(),
- e->get_priority(),
- framestamp,
- e->getDatabaseRequest(),
- _options.get());
+ _pager->queueRequest(e->tileFileName,
+ e->getNode(),
+ e->get_priority(),
+ framestamp,
+ e->getDatabaseRequest(),
+ _options.get());
loading++;
}
} else
delete old;
// zeros out subgraph ref_ptr, so subgraph is owned by
// the pager and will be deleted in the pager thread.
- pager->queueDeleteRequest(subgraph);
+ _pager->queueDeleteRequest(subgraph);
if (--drop_count > 0)
drop_index = tile_cache.get_drop_tile();
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/bucket/newbucket.hxx>
+#include "SceneryPager.hxx"
#include "tileentry.hxx"
#include "tilecache.hxx"
SGPropertyNode_ptr _visibilityMeters;
SGPropertyNode_ptr _maxTileRangeM, _disableNasalHooks;
-
+
+ osg::ref_ptr<flightgear::SceneryPager> _pager;
+
public:
FGTileMgr();