From b4f5eaa5416bac350c2b1b81151de588a6252a97 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Fri, 19 Nov 2010 13:39:20 +0100 Subject: [PATCH] Current timestamps for forced scenery loading. Priorities during forced model loads won't work unless using current framestamps... --- simgear/scene/model/CheckSceneryVisitor.cxx | 7 ++++--- simgear/scene/model/CheckSceneryVisitor.hxx | 3 ++- simgear/scene/model/SGPagedLOD.cxx | 4 ++-- simgear/scene/model/SGPagedLOD.hxx | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/simgear/scene/model/CheckSceneryVisitor.cxx b/simgear/scene/model/CheckSceneryVisitor.cxx index ebcc011e..a21f103b 100644 --- a/simgear/scene/model/CheckSceneryVisitor.cxx +++ b/simgear/scene/model/CheckSceneryVisitor.cxx @@ -29,10 +29,11 @@ using namespace simgear; -CheckSceneryVisitor::CheckSceneryVisitor(osgDB::DatabasePager* dbp, const osg::Vec3 &position, double range) +CheckSceneryVisitor::CheckSceneryVisitor(osgDB::DatabasePager* dbp, const osg::Vec3 &position, double range, + osg::FrameStamp* framestamp) :osg::NodeVisitor(osg::NodeVisitor::NODE_VISITOR, osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN), -_position(position), _range(range), _loaded(true), _dbp(dbp) +_position(position), _range(range), _loaded(true), _dbp(dbp), _framestamp(framestamp) { _viewMatrices.push_back(osg::Matrix::identity()); } @@ -53,7 +54,7 @@ void CheckSceneryVisitor::apply(osg::PagedLOD& node) // if the DatabasePager would load LODs while the splashscreen // is there, we could just wait for the models to be loaded // by only setting setLoaded(false) here - sgplod->forceLoad(_dbp); + sgplod->forceLoad(_dbp,_framestamp); setLoaded(false); } } diff --git a/simgear/scene/model/CheckSceneryVisitor.hxx b/simgear/scene/model/CheckSceneryVisitor.hxx index e3e5109f..4b9a357d 100644 --- a/simgear/scene/model/CheckSceneryVisitor.hxx +++ b/simgear/scene/model/CheckSceneryVisitor.hxx @@ -38,7 +38,7 @@ class SGPagedLOD; class CheckSceneryVisitor : public osg::NodeVisitor { public: - CheckSceneryVisitor(osgDB::DatabasePager* dbp, const osg::Vec3 &position, double range); + CheckSceneryVisitor(osgDB::DatabasePager* dbp, const osg::Vec3 &position, double range, osg::FrameStamp* framestamp); virtual void apply(osg::Node& node); virtual void apply(osg::PagedLOD& node); @@ -59,6 +59,7 @@ private: double _range; bool _loaded; osgDB::DatabasePager* _dbp; + osg::FrameStamp* _framestamp; osg::fast_back_stack _viewMatrices; }; diff --git a/simgear/scene/model/SGPagedLOD.cxx b/simgear/scene/model/SGPagedLOD.cxx index faaf42bb..d309feb8 100644 --- a/simgear/scene/model/SGPagedLOD.cxx +++ b/simgear/scene/model/SGPagedLOD.cxx @@ -60,14 +60,14 @@ bool SGPagedLOD::addChild(osg::Node *child) return true; } -void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp) +void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp, osg::FrameStamp* framestamp) { //SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::forceLoad(" << //getFileName(getNumChildren()) << ")"); unsigned childNum = getNumChildren(); setTimeStamp(childNum, 0); double priority=1.0; - dbp->requestNodeFile(getFileName(childNum),this,priority,0, + dbp->requestNodeFile(getFileName(childNum),this,priority,framestamp, getDatabaseRequest(childNum), _readerWriterOptions.get()); } diff --git a/simgear/scene/model/SGPagedLOD.hxx b/simgear/scene/model/SGPagedLOD.hxx index 7bf54266..fe256446 100644 --- a/simgear/scene/model/SGPagedLOD.hxx +++ b/simgear/scene/model/SGPagedLOD.hxx @@ -43,7 +43,7 @@ public: META_Node(simgear, SGPagedLOD); // virtual void traverse(osg::NodeVisitor& nv); - virtual void forceLoad(osgDB::DatabasePager* dbp); + virtual void forceLoad(osgDB::DatabasePager* dbp, osg::FrameStamp* framestamp); // reimplemented to notify the loading through ModelData bool addChild(osg::Node *child); -- 2.39.5