#include <simgear/scene/bvh/BVHNode.hxx>
#include <simgear/scene/bvh/BVHLineSegmentVisitor.hxx>
-#include <Main/renderer.hxx>
+#include <Viewer/renderer.hxx>
#include <Main/fg_props.hxx>
#include "tilemgr.hxx"
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