From Wang Rui, "I've made a small fix to osgViewer/Scene.cpp, which is already attached. I would like to explain what I've done and why.
In Scene::updateSceneGraph(), change:
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()));
}
to
if (getDatabasePager())
{
// synchronize changes required by the DatabasePager thread to the scene graph
getDatabasePager()->updateSceneGraph((*updateVisitor.getFrameStamp()));
}
if (getSceneData())
{
updateVisitor.setImageRequestHandler(getImagePager());
getSceneData()->accept(updateVisitor);
}
That is, just swap the positions of two 'if () {...}' segments.
While working on a paged terrain, I need to collect every newly allocated PagedLODs and make them temporarily unrenderable in the next frame, which are all done in a update callback. But I found that these PagedLODs will always be shown before collecting them, because of the unsuitable sequence in Scene::updateSceneGraph(). DatabasePager is synchronized AFTER the user updating traversal, that is, user cannot IMMEDIATELY find out changes made by DatabasePager.
"
This commit is contained in:
@@ -81,25 +81,24 @@ 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 (getSceneData())
|
||||
{
|
||||
updateVisitor.setImageRequestHandler(getImagePager());
|
||||
getSceneData()->accept(updateVisitor);
|
||||
}
|
||||
|
||||
if (getImagePager())
|
||||
{
|
||||
// synchronize changes required by the DatabasePager thread to the scene graph
|
||||
getImagePager()->updateSceneGraph(*(updateVisitor.getFrameStamp()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user