Show
Ignore:
Timestamp:
11/20/09 15:39:15 (4 years ago)
Author:
robert
Message:

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?.

"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgViewer/Scene.cpp

    r10520 r10810  
    8282    if (!_sceneData) return; 
    8383 
     84    if (getDatabasePager()) 
     85    { 
     86        // synchronize changes required by the DatabasePager thread to the scene graph 
     87        getDatabasePager()->updateSceneGraph((*updateVisitor.getFrameStamp())); 
     88    } 
     89 
    8490    if (getSceneData()) 
    8591    { 
    8692        updateVisitor.setImageRequestHandler(getImagePager()); 
    8793        getSceneData()->accept(updateVisitor); 
    88     } 
    89  
    90     if (getDatabasePager()) 
    91     { 
    92         // synchronize changes required by the DatabasePager thread to the scene graph 
    93         getDatabasePager()->updateSceneGraph((*updateVisitor.getFrameStamp())); 
    9494    } 
    9595 
     
    9999        getImagePager()->updateSceneGraph(*(updateVisitor.getFrameStamp())); 
    100100    } 
    101  
    102101 
    103102}