split requiresUpdateSceneGraph() into requires update and requires redraw (wip)

This commit is contained in:
Philippe Renon 2016-07-04 23:19:20 +02:00
parent e23a30652d
commit 22d53357d3
6 changed files with 28 additions and 7 deletions

View File

@ -244,6 +244,9 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
* Note, must only be called from single thread update phase. */
virtual void updateSceneGraph(const osg::FrameStamp& frameStamp);
/** Return true if there are ... . */
bool requiresRedraw() const;
/** Report how many items are in the _fileRequestList queue */
unsigned int getFileRequestListSize() const { return static_cast<unsigned int>(_fileRequestQueue->size() + _httpRequestQueue->size()); }

View File

@ -49,6 +49,7 @@ class OSGVIEWER_EXPORT Scene : public osg::Referenced
virtual void updateSceneGraph(osg::NodeVisitor& updateVisitor);
virtual bool requiresRedraw() const;
/** Get the Scene object that has the specified node assigned to it.
* return 0 if no Scene has yet been assigned the specified node.*/

View File

@ -1592,8 +1592,6 @@ void DatabasePager::setDatabasePagerThreadPause(bool pause)
bool DatabasePager::requiresUpdateSceneGraph() const
{
if (getDataToCompileListSize()>0) return true;
if (getDataToMergeListSize()>0) return true;
return false;
@ -1637,6 +1635,12 @@ void DatabasePager::updateSceneGraph(const osg::FrameStamp& frameStamp)
#endif
}
bool DatabasePager::requiresRedraw() const
{
if (getDataToCompileListSize()>0) return true;
return false;
}
void DatabasePager::addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp)
{

View File

@ -1712,9 +1712,11 @@ bool SlideEventHandler::checkNeedToDoFrame()
if (_viewer->getRequestRedraw()) return true;
if (_viewer->getRequestContinousUpdate()) return true;
// If the database pager is going to update the scene the render flag is
// set so that the updates show up
if(_viewer->getDatabasePager()->requiresUpdateSceneGraph() || _viewer->getDatabasePager()->getRequestsInProgress()) return true;
// check if the database pager needs to update the scene
if (_viewer->getDatabasePager()->requiresUpdateSceneGraph()) return true;
// check if the image pager needs to update the scene
if (_viewer->getImagePager()->requiresUpdateSceneGraph()) return true;
// if there update callbacks then we need to do frame.
if (_viewer->getCamera()->getUpdateCallback()) return true;
@ -1725,7 +1727,7 @@ bool SlideEventHandler::checkNeedToDoFrame()
{
if (_slideSwitch->getChild(_activeLayer)->getNumChildrenRequiringUpdateTraversal()>0) return true;
}
else if (_viewer->getSceneData()!=0 && _viewer->getSceneData()->getNumChildrenRequiringUpdateTraversal()>0) return true;
else if (_viewer->getSceneData()!=0 && (_viewer->getSceneData()->getUpdateCallback() || (_viewer->getSceneData()->getNumChildrenRequiringUpdateTraversal()>0))) return true;
if (_autoSteppingActive)
{
@ -1753,4 +1755,3 @@ bool SlideEventHandler::checkNeedToDoFrame()
return true;
}
}

View File

@ -150,6 +150,14 @@ void Scene::updateSceneGraph(osg::NodeVisitor& updateVisitor)
}
}
bool Scene::requiresRedraw() const
{
// check if the database pager needs a redraw
if (getDatabasePager()->requiresRedraw()) return true;
return false;
}
Scene* Scene::getScene(osg::Node* node)
{

View File

@ -1138,6 +1138,10 @@ bool View::requiresUpdateSceneGraph() const
// check if the scene requires an update traversal
if (_scene.valid() && _scene->requiresUpdateSceneGraph()) return true;
// check if the scene requires a redraw
// FIXME...
if (_scene.valid() && _scene->requiresRedraw()) return true;
return false;
}