Current timestamps for forced scenery loading.

Priorities during forced model loads won't work unless using current framestamps...
This commit is contained in:
ThorstenB 2010-11-19 13:39:20 +01:00
parent 66cdbf6215
commit b4f5eaa541
4 changed files with 9 additions and 7 deletions

View File

@ -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);
}
}

View File

@ -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<osg::Matrix> _viewMatrices;
};

View File

@ -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());
}

View File

@ -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);