X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FScenery%2Fscenery.cxx;h=5ed687e83c3175e9f0acfd70a39931c4b11b6b80;hb=7c8ad455a327276e09687b380fb4147ae90b6c8c;hp=12c3ebb69029e40fa8d99f2dfecddbddbe568b8b;hpb=b5025ccf5d1dbe5e1dff3b24710ad70deee78558;p=flightgear.git diff --git a/src/Scenery/scenery.cxx b/src/Scenery/scenery.cxx index 12c3ebb69..5ed687e83 100644 --- a/src/Scenery/scenery.cxx +++ b/src/Scenery/scenery.cxx @@ -36,16 +36,19 @@ #include #include +#include #include #include #include +#include #include +#include #include #include -#include -#include +#include +#include -#include
+#include #include
#include "tilemgr.hxx" @@ -91,7 +94,7 @@ public: { return _haveHit; } const SGLineSegmentd& getLineSegment() const { return _lineSegment; } - const SGMaterial* getMaterial() const + const simgear::BVHMaterial* getMaterial() const { return _material; } virtual void apply(osg::Node& node) @@ -151,7 +154,7 @@ private: SGLineSegmentd lineSegment = _lineSegment; bool haveHit = _haveHit; - const SGMaterial* material = _material; + const simgear::BVHMaterial* material = _material; _haveHit = false; _lineSegment = lineSegment.transform(SGMatrixd(inverseMatrix.ptr())); @@ -204,7 +207,7 @@ private: SGLineSegmentd _lineSegment; const osg::Node* _skipNode; - const SGMaterial* _material; + const simgear::BVHMaterial* _material; bool _haveHit; }; @@ -212,6 +215,8 @@ private: 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() { @@ -245,7 +250,11 @@ void FGScenery::init() { } -void FGScenery::update(double dt) { +void FGScenery::update(double dt) +{ + SG_UNUSED(dt); + // nothing here, don't call again + suspend(); } @@ -258,7 +267,8 @@ void FGScenery::unbind() { bool FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff, - double& alt, const SGMaterial** material, + double& alt, + const simgear::BVHMaterial** material, const osg::Node* butNotFrom) { SGGeod geod = SGGeod::fromCart(pos); @@ -268,7 +278,7 @@ FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff, bool FGScenery::get_elevation_m(const SGGeod& geod, double& alt, - const SGMaterial** material, + const simgear::BVHMaterial** material, const osg::Node* butNotFrom) { SGVec3d start = SGVec3d::fromGeod(geod); @@ -327,7 +337,7 @@ bool FGScenery::scenery_available(const SGGeod& position, double range_m) 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