Preliminary work on general purpose incremental compile support in osgViewer.
This commit is contained in:
@@ -497,6 +497,10 @@ void CompositeViewer::realize()
|
||||
}
|
||||
}
|
||||
|
||||
// attach contexts to _incrementalCompileOperation if attached.
|
||||
if (_incrementalCompileOperation) _incrementalCompileOperation->assignContexts(contexts);
|
||||
|
||||
|
||||
bool grabFocus = true;
|
||||
if (grabFocus)
|
||||
{
|
||||
@@ -994,6 +998,12 @@ void CompositeViewer::updateTraversal()
|
||||
|
||||
}
|
||||
|
||||
if (_incrementalCompileOperation.valid())
|
||||
{
|
||||
// merge subgraphs that have been compiled by the incremental compiler operation.
|
||||
_incrementalCompileOperation->mergeCompiledSubgraphs();
|
||||
}
|
||||
|
||||
if (_updateOperations.valid())
|
||||
{
|
||||
_updateOperations->runOperations(this);
|
||||
|
||||
@@ -448,7 +448,10 @@ void Viewer::realize()
|
||||
gc->releaseContext();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// attach contexts to _incrementalCompileOperation if attached.
|
||||
if (_incrementalCompileOperation) _incrementalCompileOperation->assignContexts(contexts);
|
||||
|
||||
bool grabFocus = true;
|
||||
if (grabFocus)
|
||||
{
|
||||
@@ -898,6 +901,13 @@ void Viewer::updateTraversal()
|
||||
{
|
||||
_updateOperations->runOperations(this);
|
||||
}
|
||||
|
||||
if (_incrementalCompileOperation.valid())
|
||||
{
|
||||
// merge subgraphs that have been compiled by the incremental compiler operation.
|
||||
_incrementalCompileOperation->mergeCompiledSubgraphs();
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// call any camera update callbacks, but only traverse that callback, don't traverse its subgraph
|
||||
|
||||
@@ -375,7 +375,7 @@ void ViewerBase::startThreading()
|
||||
|
||||
if (!gc->isRealized())
|
||||
{
|
||||
osg::notify(osg::INFO)<<"ViewerBase::startThreading() : Realizng window "<<gc<<std::endl;
|
||||
osg::notify(osg::INFO)<<"ViewerBase::startThreading() : Realizing window "<<gc<<std::endl;
|
||||
gc->realize();
|
||||
}
|
||||
|
||||
@@ -551,6 +551,21 @@ void ViewerBase::removeUpdateOperation(osg::Operation* operation)
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerBase::setIncrementalCompileOperation(osgUtil::IncrementalCompileOperation* ico)
|
||||
{
|
||||
if (_incrementalCompileOperation == ico) return;
|
||||
|
||||
Contexts contexts;
|
||||
getContexts(contexts, false);
|
||||
|
||||
if (_incrementalCompileOperation.valid()) _incrementalCompileOperation->removeContexts(contexts);
|
||||
|
||||
// assign new operation
|
||||
_incrementalCompileOperation = ico;
|
||||
|
||||
if (_incrementalCompileOperation) _incrementalCompileOperation->assignContexts(contexts);
|
||||
}
|
||||
|
||||
int ViewerBase::run()
|
||||
{
|
||||
if (!isRealized())
|
||||
|
||||
Reference in New Issue
Block a user