Added support for an update OperationQueue to Viewer and CompositeViewer to allow asyncrnous adding of operations to be added
to the view to be done during syncronous updateTraversal(). This feature can be used for doing things like merging subgraphs that have been loaded in a background thread.
This commit is contained in:
@@ -1326,6 +1326,25 @@ void Viewer::eventTraversal()
|
||||
|
||||
}
|
||||
|
||||
void Viewer::addUpdateOperation(osg::Operation* operation)
|
||||
{
|
||||
if (!operation) return;
|
||||
|
||||
if (!_updateOperations) _updateOperations = new osg::OperationQueue;
|
||||
|
||||
_updateOperations->add(operation);
|
||||
}
|
||||
|
||||
void Viewer::removeUpdateOperation(osg::Operation* operation)
|
||||
{
|
||||
if (!operation) return;
|
||||
|
||||
if (_updateOperations.valid())
|
||||
{
|
||||
_updateOperations->remove(operation);
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::updateTraversal()
|
||||
{
|
||||
if (_done) return;
|
||||
@@ -1343,6 +1362,11 @@ void Viewer::updateTraversal()
|
||||
_scene->getDatabasePager()->updateSceneGraph(_frameStamp->getReferenceTime());
|
||||
}
|
||||
|
||||
if (_updateOperations.valid())
|
||||
{
|
||||
_updateOperations->runOperations(this);
|
||||
}
|
||||
|
||||
{
|
||||
// call any camera update callbacks, but only traverse that callback, don't traverse its subgraph
|
||||
// leave that to the scene update traversal.
|
||||
|
||||
Reference in New Issue
Block a user