Fixed double registeration bug.

This commit is contained in:
Robert Osfield 2010-06-03 16:24:25 +00:00
parent 634e55eee3
commit 768f466365
2 changed files with 6 additions and 16 deletions

View File

@ -347,6 +347,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
virtual void moveActivePagedLODTo(PagedLODList& activePagedLODList, const osg::FrameStamp& framestamp) = 0; virtual void moveActivePagedLODTo(PagedLODList& activePagedLODList, const osg::FrameStamp& framestamp) = 0;
virtual void removeExpiredChildren(int& numberChildrenToRemove, double expiryTime, int expiryFrame, osg::NodeList& childrenRemoved) = 0; virtual void removeExpiredChildren(int& numberChildrenToRemove, double expiryTime, int expiryFrame, osg::NodeList& childrenRemoved) = 0;
virtual void insertPagedLOD(osg::PagedLOD* plod) = 0; virtual void insertPagedLOD(osg::PagedLOD* plod) = 0;
virtual bool containsPagedLOD(osg::PagedLOD* plod) = 0;
}; };
protected: protected:

View File

@ -264,6 +264,8 @@ public:
return; return;
} }
// OSG_NOTICE<<"OK: SetBasedPagedLODList::insertPagedLOD("<<plod<<") inserting"<<std::endl;
_pagedLODs.insert(plod); _pagedLODs.insert(plod);
} }
@ -1677,9 +1679,10 @@ void DatabasePager::addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp)
// OSG_NOTICE<<"Merging "<<_frameNumber-(*itr)->_frameNumberLastRequest<<std::endl; // OSG_NOTICE<<"Merging "<<_frameNumber-(*itr)->_frameNumberLastRequest<<std::endl;
osg::Group* group = databaseRequest->_groupForAddingLoadedSubgraph; osg::Group* group = databaseRequest->_groupForAddingLoadedSubgraph;
#if 0
if (osgDB::Registry::instance()->getSharedStateManager()) if (osgDB::Registry::instance()->getSharedStateManager())
osgDB::Registry::instance()->getSharedStateManager()->share(databaseRequest->_loadedModel.get()); osgDB::Registry::instance()->getSharedStateManager()->share(databaseRequest->_loadedModel.get());
#endif
osg::PagedLOD* plod = dynamic_cast<osg::PagedLOD*>(group); osg::PagedLOD* plod = dynamic_cast<osg::PagedLOD*>(group);
if (plod) if (plod)
@ -1699,7 +1702,7 @@ void DatabasePager::addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp)
group->addChild(databaseRequest->_loadedModel.get()); group->addChild(databaseRequest->_loadedModel.get());
registerPagedLODs(group, frameStamp.getFrameNumber()); registerPagedLODs(databaseRequest->_loadedModel.get(), frameStamp.getFrameNumber());
// OSG_NOTICE<<"merged subgraph"<<databaseRequest->_fileName<<" after "<<databaseRequest->_numOfRequests<<" requests and time="<<(timeStamp-databaseRequest->_timestampFirstRequest)*1000.0<<std::endl; // OSG_NOTICE<<"merged subgraph"<<databaseRequest->_fileName<<" after "<<databaseRequest->_numOfRequests<<" requests and time="<<(timeStamp-databaseRequest->_timestampFirstRequest)*1000.0<<std::endl;
@ -1873,22 +1876,8 @@ void DatabasePager::registerPagedLODs(osg::Node* subgraph, int frameNumber)
{ {
if (!subgraph) return; if (!subgraph) return;
static std::set<osg::Node*> s_registedSet;
OSG_NOTICE<<"DatabasePager::registerPagedLODs("<<subgraph<<") "<<frameNumber<<std::endl;
if (s_registedSet.count(subgraph)!=0)
{
OSG_NOTICE<<"DatabasePager::registerPagedLODs("<<subgraph<<") subgraph already registered"<<std::endl;
}
else
{
s_registedSet.insert(subgraph);
}
FindPagedLODsVisitor fplv(*_activePagedLODList, frameNumber); FindPagedLODsVisitor fplv(*_activePagedLODList, frameNumber);
subgraph->accept(fplv); subgraph->accept(fplv);
} }
bool DatabasePager::requiresCompileGLObjects() const bool DatabasePager::requiresCompileGLObjects() const