From Wojciech Lewandowski,"These are our changes to DatabasePager. To check if parent PLOD is registered, I resurrected PagedLODList::containsPagedLOD() method. This method was available some time ago, but got removed and was not currently present in trunk. To add this method I had to also modify the DatabasePager header. "

This commit is contained in:
Robert Osfield 2010-10-01 15:37:35 +00:00
parent e5bc43f04c
commit 8f2497e21d
2 changed files with 17 additions and 1 deletions

View File

@ -355,6 +355,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
virtual void removeExpiredChildren(int& numberChildrenToRemove, double expiryTime, int expiryFrame, osg::NodeList& childrenRemoved) = 0;
virtual void removeNodes(osg::NodeList& nodesToRemove) = 0;
virtual void insertPagedLOD(const osg::observer_ptr<osg::PagedLOD>& plod) = 0;
virtual bool containsPagedLOD(const osg::observer_ptr<osg::PagedLOD>& plod) const = 0;
};
protected:

View File

@ -294,6 +294,11 @@ public:
_pagedLODs.insert(plod);
}
virtual bool containsPagedLOD(const osg::observer_ptr<osg::PagedLOD>& plod) const
{
return (_pagedLODs.count(plod)!=0);
}
};
@ -1809,7 +1814,17 @@ void DatabasePager::addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp)
group->addChild(databaseRequest->_loadedModel.get());
registerPagedLODs(databaseRequest->_loadedModel.get(), frameStamp.getFrameNumber());
// Check if parent plod was already registered if not start visitor from parent
if( plod &&
!_activePagedLODList->containsPagedLOD( plod ) &&
!_inactivePagedLODList->containsPagedLOD( plod ) )
{
registerPagedLODs(plod, frameNumber);
}
else
{
registerPagedLODs(databaseRequest->_loadedModel.get(), frameNumber);
}
// OSG_NOTICE<<"merged subgraph"<<databaseRequest->_fileName<<" after "<<databaseRequest->_numOfRequests<<" requests and time="<<(timeStamp-databaseRequest->_timestampFirstRequest)*1000.0<<std::endl;