Current timestamps for forced scenery loading.
Priorities during forced model loads won't work unless using current framestamps...
This commit is contained in:
parent
66cdbf6215
commit
b4f5eaa541
@ -29,10 +29,11 @@
|
|||||||
|
|
||||||
using namespace simgear;
|
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(osg::NodeVisitor::NODE_VISITOR,
|
||||||
osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN),
|
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());
|
_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
|
// if the DatabasePager would load LODs while the splashscreen
|
||||||
// is there, we could just wait for the models to be loaded
|
// is there, we could just wait for the models to be loaded
|
||||||
// by only setting setLoaded(false) here
|
// by only setting setLoaded(false) here
|
||||||
sgplod->forceLoad(_dbp);
|
sgplod->forceLoad(_dbp,_framestamp);
|
||||||
setLoaded(false);
|
setLoaded(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class SGPagedLOD;
|
|||||||
class CheckSceneryVisitor : public osg::NodeVisitor
|
class CheckSceneryVisitor : public osg::NodeVisitor
|
||||||
{
|
{
|
||||||
public:
|
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::Node& node);
|
||||||
virtual void apply(osg::PagedLOD& node);
|
virtual void apply(osg::PagedLOD& node);
|
||||||
@ -59,6 +59,7 @@ private:
|
|||||||
double _range;
|
double _range;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
osgDB::DatabasePager* _dbp;
|
osgDB::DatabasePager* _dbp;
|
||||||
|
osg::FrameStamp* _framestamp;
|
||||||
|
|
||||||
osg::fast_back_stack<osg::Matrix> _viewMatrices;
|
osg::fast_back_stack<osg::Matrix> _viewMatrices;
|
||||||
};
|
};
|
||||||
|
@ -60,14 +60,14 @@ bool SGPagedLOD::addChild(osg::Node *child)
|
|||||||
return true;
|
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(" <<
|
//SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::forceLoad(" <<
|
||||||
//getFileName(getNumChildren()) << ")");
|
//getFileName(getNumChildren()) << ")");
|
||||||
unsigned childNum = getNumChildren();
|
unsigned childNum = getNumChildren();
|
||||||
setTimeStamp(childNum, 0);
|
setTimeStamp(childNum, 0);
|
||||||
double priority=1.0;
|
double priority=1.0;
|
||||||
dbp->requestNodeFile(getFileName(childNum),this,priority,0,
|
dbp->requestNodeFile(getFileName(childNum),this,priority,framestamp,
|
||||||
getDatabaseRequest(childNum),
|
getDatabaseRequest(childNum),
|
||||||
_readerWriterOptions.get());
|
_readerWriterOptions.get());
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
META_Node(simgear, SGPagedLOD);
|
META_Node(simgear, SGPagedLOD);
|
||||||
|
|
||||||
// virtual void traverse(osg::NodeVisitor& nv);
|
// 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
|
// reimplemented to notify the loading through ModelData
|
||||||
bool addChild(osg::Node *child);
|
bool addChild(osg::Node *child);
|
||||||
|
Loading…
Reference in New Issue
Block a user