Fixed cirular reference in DatabaseRequest
This commit is contained in:
parent
f07d106366
commit
0cc38108a5
@ -121,7 +121,7 @@ class OSG_EXPORT PagedLOD : public LOD
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~PagedLOD() {}
|
||||
virtual ~PagedLOD();
|
||||
|
||||
void expandPerRangeDataTo(unsigned int pos);
|
||||
|
||||
|
@ -332,7 +332,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
double _timestampLastRequest;
|
||||
float _priorityLastRequest;
|
||||
unsigned int _numOfRequests;
|
||||
osg::ref_ptr<osg::Group> _groupForAddingLoadedSubgraph;
|
||||
osg::observer_ptr<osg::Group> _groupForAddingLoadedSubgraph;
|
||||
osg::ref_ptr<osg::Node> _loadedModel;
|
||||
DataToCompileMap _dataToCompileMap;
|
||||
osg::ref_ptr<ReaderWriter::Options> _loadOptions;
|
||||
|
@ -59,6 +59,10 @@ PagedLOD::PagedLOD(const PagedLOD& plod,const CopyOp& copyop):
|
||||
{
|
||||
}
|
||||
|
||||
PagedLOD::~PagedLOD()
|
||||
{
|
||||
}
|
||||
|
||||
void PagedLOD::setDatabasePath(const std::string& path)
|
||||
{
|
||||
_databasePath = path;
|
||||
|
@ -397,7 +397,7 @@ void DatabasePager::DatabaseThread::run()
|
||||
//
|
||||
// delete any children if required.
|
||||
//
|
||||
if (_pager->_deleteRemovedSubgraphsInDatabaseThread)
|
||||
if (_pager->_deleteRemovedSubgraphsInDatabaseThread && !(read_queue->_childrenToDeleteList.empty()))
|
||||
{
|
||||
ObjectList deleteList;
|
||||
|
||||
@ -558,11 +558,21 @@ void DatabasePager::DatabaseThread::run()
|
||||
databaseRequest->_loadedModel = 0;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Group> groupForAddingLoadedSubgraph = databaseRequest->_groupForAddingLoadedSubgraph.get();
|
||||
|
||||
if (!groupForAddingLoadedSubgraph)
|
||||
{
|
||||
osg::notify(osg::INFO)<<_name<<": Warning parent of loaded subgraph, deleted."<<std::endl;
|
||||
databaseRequest->_loadedModel = 0;
|
||||
}
|
||||
|
||||
//osg::notify(osg::NOTICE)<<" node read in "<<osg::Timer::instance()->delta_m(before,osg::Timer::instance()->tick())<<" ms"<<std::endl;
|
||||
|
||||
bool loadedObjectsNeedToBeCompiled = false;
|
||||
|
||||
if (_pager->_doPreCompile && databaseRequest->_loadedModel.valid() && !_pager->_activeGraphicsContexts.empty())
|
||||
if (_pager->_doPreCompile &&
|
||||
databaseRequest->_loadedModel.valid() &&
|
||||
!_pager->_activeGraphicsContexts.empty())
|
||||
{
|
||||
// force a compute of the loaded model's bounding volume, so that when the subgraph
|
||||
// merged with the main scene graph and large computeBound() isn't incurred.
|
||||
@ -582,7 +592,7 @@ void DatabasePager::DatabaseThread::run()
|
||||
|
||||
// push the soon to be parent on the nodepath of the NodeVisitor so that
|
||||
// during traversal one can test for where it'll be in the overall scene graph
|
||||
osg::NodePathList nodePathList = databaseRequest->_groupForAddingLoadedSubgraph->getParentalNodePaths();
|
||||
osg::NodePathList nodePathList = groupForAddingLoadedSubgraph->getParentalNodePaths();
|
||||
if (!nodePathList.empty())
|
||||
{
|
||||
osg::NodePath& nodePath = nodePathList.front();
|
||||
@ -594,7 +604,7 @@ void DatabasePager::DatabaseThread::run()
|
||||
}
|
||||
}
|
||||
|
||||
frov.pushOntoNodePath(databaseRequest->_groupForAddingLoadedSubgraph.get());
|
||||
frov.pushOntoNodePath(groupForAddingLoadedSubgraph.get());
|
||||
|
||||
databaseRequest->_loadedModel->accept(frov);
|
||||
|
||||
@ -1182,9 +1192,10 @@ void DatabasePager::addLoadedDataToSceneGraph(double timeStamp)
|
||||
|
||||
registerPagedLODs(databaseRequest->_loadedModel.get());
|
||||
|
||||
osg::Group* group = databaseRequest->_groupForAddingLoadedSubgraph.get();
|
||||
|
||||
osg::PagedLOD* plod = dynamic_cast<osg::PagedLOD*>(group);
|
||||
osg::ref_ptr<osg::Group> group = databaseRequest->_groupForAddingLoadedSubgraph.get();
|
||||
if (group.valid())
|
||||
{
|
||||
osg::PagedLOD* plod = dynamic_cast<osg::PagedLOD*>(group.get());
|
||||
if (plod)
|
||||
{
|
||||
plod->setTimeStamp(plod->getNumChildren(),timeStamp);
|
||||
@ -1192,7 +1203,7 @@ void DatabasePager::addLoadedDataToSceneGraph(double timeStamp)
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::ProxyNode* proxyNode = dynamic_cast<osg::ProxyNode*>(group);
|
||||
osg::ProxyNode* proxyNode = dynamic_cast<osg::ProxyNode*>(group.get());
|
||||
if (proxyNode)
|
||||
{
|
||||
proxyNode->getDatabaseRequest(proxyNode->getNumChildren()) = 0;
|
||||
@ -1210,6 +1221,7 @@ void DatabasePager::addLoadedDataToSceneGraph(double timeStamp)
|
||||
|
||||
_totalTimeToMergeTiles += timeToMerge;
|
||||
++_numTilesMerges;
|
||||
}
|
||||
|
||||
// reset the loadedModel pointer
|
||||
databaseRequest->_loadedModel = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user