Moved the updating and expiry of the Registry object cache from DatabasePager into osgViewer::Viewer/CompositeViewer.
This commit is contained in:
@@ -1037,27 +1037,18 @@ void CompositeViewer::updateTraversal()
|
||||
++sitr)
|
||||
{
|
||||
Scene* scene = *sitr;
|
||||
if (scene->getSceneData())
|
||||
{
|
||||
_updateVisitor->setImageRequestHandler(scene->getImagePager());
|
||||
|
||||
scene->getSceneData()->accept(*_updateVisitor);
|
||||
}
|
||||
|
||||
if (scene->getDatabasePager())
|
||||
{
|
||||
// synchronize changes required by the DatabasePager thread to the scene graph
|
||||
scene->getDatabasePager()->updateSceneGraph(*_frameStamp);
|
||||
}
|
||||
|
||||
if (scene->getImagePager())
|
||||
{
|
||||
// synchronize changes required by the DatabasePager thread to the scene graph
|
||||
scene->getImagePager()->updateSceneGraph(*_frameStamp);
|
||||
}
|
||||
|
||||
scene->updateSceneGraph(*_updateVisitor);
|
||||
}
|
||||
|
||||
// if we have a shared state manager prune any unused entries
|
||||
if (osgDB::Registry::instance()->getSharedStateManager())
|
||||
osgDB::Registry::instance()->getSharedStateManager()->prune();
|
||||
|
||||
// update the Registry object cache.
|
||||
osgDB::Registry::instance()->updateTimeStampOfObjectsInCacheWithExternalReferences(*getFrameStamp());
|
||||
osgDB::Registry::instance()->removeExpiredObjectsInCache(*getFrameStamp());
|
||||
|
||||
|
||||
if (_incrementalCompileOperation.valid())
|
||||
{
|
||||
// merge subgraphs that have been compiled by the incremental compiler operation.
|
||||
|
||||
@@ -77,6 +77,31 @@ void Scene::setImagePager(osgDB::ImagePager* ip)
|
||||
_imagePager = ip;
|
||||
}
|
||||
|
||||
void Scene::updateSceneGraph(osg::NodeVisitor& updateVisitor)
|
||||
{
|
||||
if (!_sceneData) return;
|
||||
|
||||
if (getSceneData())
|
||||
{
|
||||
updateVisitor.setImageRequestHandler(getImagePager());
|
||||
getSceneData()->accept(updateVisitor);
|
||||
}
|
||||
|
||||
if (getDatabasePager())
|
||||
{
|
||||
// synchronize changes required by the DatabasePager thread to the scene graph
|
||||
getDatabasePager()->updateSceneGraph((*updateVisitor.getFrameStamp()));
|
||||
}
|
||||
|
||||
if (getImagePager())
|
||||
{
|
||||
// synchronize changes required by the DatabasePager thread to the scene graph
|
||||
getImagePager()->updateSceneGraph(*(updateVisitor.getFrameStamp()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Scene* Scene::getScene(osg::Node* node)
|
||||
{
|
||||
|
||||
@@ -924,29 +924,22 @@ void Viewer::updateTraversal()
|
||||
_updateVisitor->setFrameStamp(getFrameStamp());
|
||||
_updateVisitor->setTraversalNumber(getFrameStamp()->getFrameNumber());
|
||||
|
||||
if (getSceneData())
|
||||
{
|
||||
_updateVisitor->setImageRequestHandler(_scene->getImagePager());
|
||||
getSceneData()->accept(*_updateVisitor);
|
||||
}
|
||||
|
||||
if (_scene->getDatabasePager())
|
||||
{
|
||||
// synchronize changes required by the DatabasePager thread to the scene graph
|
||||
_scene->getDatabasePager()->updateSceneGraph(*_frameStamp);
|
||||
}
|
||||
_scene->updateSceneGraph(*_updateVisitor);
|
||||
|
||||
// if we have a shared state manager prune any unused entries
|
||||
if (osgDB::Registry::instance()->getSharedStateManager())
|
||||
osgDB::Registry::instance()->getSharedStateManager()->prune();
|
||||
|
||||
// update the Registry object cache.
|
||||
osgDB::Registry::instance()->updateTimeStampOfObjectsInCacheWithExternalReferences(*getFrameStamp());
|
||||
osgDB::Registry::instance()->removeExpiredObjectsInCache(*getFrameStamp());
|
||||
|
||||
if (_scene->getImagePager())
|
||||
{
|
||||
// synchronize changes required by the DatabasePager thread to the scene graph
|
||||
_scene->getImagePager()->updateSceneGraph(*_frameStamp);
|
||||
}
|
||||
|
||||
if (_updateOperations.valid())
|
||||
{
|
||||
_updateOperations->runOperations(this);
|
||||
}
|
||||
|
||||
|
||||
if (_incrementalCompileOperation.valid())
|
||||
{
|
||||
// merge subgraphs that have been compiled by the incremental compiler operation.
|
||||
|
||||
Reference in New Issue
Block a user