Moved the scene related requiresUpdateSceneGraph() implementation details from View into Scene.
Added check against the ImagePager.
This commit is contained in:
parent
48c1d0e8da
commit
990c04d4b9
@ -45,7 +45,9 @@ class OSGVIEWER_EXPORT Scene : public osg::Referenced
|
||||
osgDB::ImagePager* getImagePager() { return _imagePager.get(); }
|
||||
const osgDB::ImagePager* getImagePager() const { return _imagePager.get(); }
|
||||
|
||||
void updateSceneGraph(osg::NodeVisitor& updateVisitor);
|
||||
virtual bool requiresUpdateSceneGraph() const;
|
||||
|
||||
virtual void updateSceneGraph(osg::NodeVisitor& updateVisitor);
|
||||
|
||||
|
||||
/** Get the Scene object that has the specified node assigned to it.
|
||||
|
@ -19,7 +19,7 @@ using namespace osgViewer;
|
||||
|
||||
namespace osgViewer
|
||||
{
|
||||
|
||||
|
||||
|
||||
struct SceneSingleton
|
||||
{
|
||||
@ -113,6 +113,20 @@ void Scene::setImagePager(osgDB::ImagePager* ip)
|
||||
_imagePager = ip;
|
||||
}
|
||||
|
||||
bool Scene::requiresUpdateSceneGraph() const
|
||||
{
|
||||
// check if the database pager needs to update the scene
|
||||
if (getDatabasePager()->requiresUpdateSceneGraph() || getDatabasePager()->getRequestsInProgress()) return true;
|
||||
|
||||
// check if the image pager needs to update the scene
|
||||
if (getImagePager()->requiresUpdateSceneGraph()) return true;
|
||||
|
||||
// check if scene graph needs update traversal
|
||||
if (_sceneData.valid() && (_sceneData->getUpdateCallback() || (_sceneData->getNumChildrenRequiringUpdateTraversal()>0))) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Scene::updateSceneGraph(osg::NodeVisitor& updateVisitor)
|
||||
{
|
||||
if (!_sceneData) return;
|
||||
|
@ -1132,17 +1132,11 @@ void View::removeDevice(osgGA::Device* eventSource)
|
||||
|
||||
bool View::requiresUpdateSceneGraph() const
|
||||
{
|
||||
// check if the database pager needs to update the scene
|
||||
if (getDatabasePager()->requiresUpdateSceneGraph() || getDatabasePager()->getRequestsInProgress()) return true;
|
||||
|
||||
// check if there are camera update callbacks
|
||||
if (_camera->getUpdateCallback()) return true;
|
||||
|
||||
// check if there are node update callbacks
|
||||
if (getSceneData() != 0)
|
||||
{
|
||||
if (getSceneData()->getUpdateCallback() || (getSceneData()->getNumChildrenRequiringUpdateTraversal()>0)) return true;
|
||||
}
|
||||
// check if there scene requires an update traversal
|
||||
if (_scene.valid() && _scene->requiresUpdateSceneGraph()) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user