Seperated out the scene->requiresRedraw() method into a osgViewer::Viewer::requiresRedraw() method to make the functionality clearer and easier to override.

This commit is contained in:
Robert Osfield 2016-07-05 11:54:31 +01:00
parent 16d497ef80
commit dce1473a53
4 changed files with 16 additions and 5 deletions

View File

@ -308,6 +308,9 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
/** Return true if there are pending updates to the scene graph that require an update. */ /** Return true if there are pending updates to the scene graph that require an update. */
virtual bool requiresUpdateSceneGraph() const; virtual bool requiresUpdateSceneGraph() const;
/** Return true if there are graphics operations that require a draw of the grpahics context. */
virtual bool requiresRedraw() const;
public: public:
osg::Texture* createDistortionTexture(int width, int height); osg::Texture* createDistortionTexture(int width, int height);

View File

@ -267,7 +267,7 @@ bool CompositeViewer::checkNeedToDoFrame()
++itr) ++itr)
{ {
osgViewer::View* view = itr->get(); osgViewer::View* view = itr->get();
if (view && view->requiresUpdateSceneGraph()) return true; if (view && (view->requiresUpdateSceneGraph() || view->requiresRedraw())) return true;
} }
// check if events are available and need processing // check if events are available and need processing

View File

@ -1138,13 +1138,18 @@ bool View::requiresUpdateSceneGraph() const
// check if the scene requires an update traversal // check if the scene requires an update traversal
if (_scene.valid() && _scene->requiresUpdateSceneGraph()) return true; if (_scene.valid() && _scene->requiresUpdateSceneGraph()) return true;
// check if the scene requires a redraw
// FIXME...
if (_scene.valid() && _scene->requiresRedraw()) return true;
return false; return false;
} }
bool View::requiresRedraw() const
{
// check if the scene requires a redraw
if (_scene.valid() && _scene->requiresRedraw()) return true;
return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// Methods that support Stereo and Keystone correction. // Methods that support Stereo and Keystone correction.

View File

@ -379,6 +379,9 @@ bool Viewer::checkNeedToDoFrame()
// check if the view needs to update the scene graph // check if the view needs to update the scene graph
if (requiresUpdateSceneGraph()) return true; if (requiresUpdateSceneGraph()) return true;
// check if the view needs to be redraw
if (requiresRedraw()) return true;
// check if events are available and need processing // check if events are available and need processing
if (checkEvents()) return true; if (checkEvents()) return true;