Added Viewer::isRealized() and run() methods to make it easier to

set up and run a viewer, taking care of realized() calls if not already
done, and assigning trackball manipulator if not already assigned.
This commit is contained in:
Robert Osfield
2007-01-05 10:59:23 +00:00
parent 9e30014634
commit 552bda4cc5
2 changed files with 63 additions and 2 deletions

View File

@@ -29,6 +29,9 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
Viewer();
virtual ~Viewer();
/** Get whether at least of one of this viewers windows are realized.*/
bool isRealized() const;
/** set up windows and associated threads.*/
void realize();
@@ -58,6 +61,13 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
/** Set the key value that the viewer checks on each frame to see if the viewer's done flag.*/
int getKeySetsDone() const { return _keySetsDone; }
/** Execute a main frame loop.
* Equivialant to while (!viewer.done()) viewer.frame();
* Also calls realize() if the viewer is not already realized,
* and installs trackball manipulator if one is not already assigned.
*/
virtual void run();
/** Render a complete new frame.
* Calls frameAdvance(), frameEventTraversal(), frameUpateTraversal(), frameRenderingTraversals(). */
virtual void frame();