|
OpenFrames
|
Defines an interface that can draw a scene onto any window. More...
#include <WindowProxy.hpp>
Public Types | |
| enum | AnimationState { IDLE = 0, INITIALIZING, ANIMATING, PAUSED, FAILED, SUCCESS } |
| typedef std::vector< osg::ref_ptr< RenderRectangle > > | RenderList |
Public Member Functions | |
| WindowProxy (int x, int y, unsigned int width, unsigned int height, unsigned int nrow, unsigned int ncol, bool embedded=false, bool useVR=false) | |
| virtual void | cancelCleanup () |
| void | setWindowName (const std::string &name) |
| unsigned int | getWindowWidth () const |
| unsigned int | getWindowHeight () const |
| bool | isEmbedded () const |
| void | keyPress (int key) |
| void | keyRelease (int key) |
| void | mouseMotion (float x, float y) |
| void | buttonPress (float x, float y, unsigned int button) |
| void | buttonRelease (float x, float y, unsigned int button) |
| void | resizeWindow (int x, int y, unsigned int width, unsigned int height) |
| void | setupGrid (unsigned int width, unsigned int height) |
| void | shutdown () |
| void | setTime (double time) |
| double | getTime () const |
| void | setTimeRange (double tMin, double tMax) |
| Control allowable time range; computed simulation time will always obey this. | |
| void | getTimeRange (double &tMin, double &tMax) const |
| void | pauseTime (bool pause) |
| bool | isTimePaused () const |
| void | setTimeScale (double tscale) |
| double | getTimeScale () const |
| bool | synchronizeTime (WindowProxy *winproxy) |
| WindowProxy * | getTimeSyncWindow () const |
| void | pauseAnimation (bool pause) |
| AnimationState | getAnimationState () const |
| Get the current animation state. | |
| bool | isAnimating () const |
| Determine whether WindowProxy is in its animation loop. | |
| bool | doneAnimating () const |
| Determine whether WindowProxy is done animating. | |
| void | resetAnimationState () |
| If animation is done, then reset the animation state. | |
| void | setDesiredFramerate (const double &fps) |
| double | getDesiredFramerate () |
| double | getFramerate () |
| osgViewer::CompositeViewer * | getViewer () const |
| void | setGridSize (unsigned int row, unsigned int col) |
| unsigned int | getNumRows () const |
| unsigned int | getNumCols () const |
| void | setScene (FrameManager *fm, unsigned int row, unsigned int col) |
| FrameManager * | getScene (unsigned int row, unsigned int col) |
| RenderRectangle * | getGridPosition (unsigned int row, unsigned int col) |
| void | setMakeCurrentFunction (void(*fcn)(unsigned int *winID, bool *success)) |
| void | setUpdateContextFunction (void(*fcn)(unsigned int *winID, bool *success)) |
| void | setSwapBuffersFunction (void(*fcn)(unsigned int *winID)) |
| void | setKeyPressCallback (void(*fcn)(KEYPRESS_SIG)) |
| void | setMouseMotionCallback (void(*fcn)(MOUSEMOTION_SIG)) |
| void | setButtonPressCallback (void(*fcn)(BUTTON_SIG)) |
| void | setButtonReleaseCallback (void(*fcn)(BUTTON_SIG)) |
| void | setVREventCallback (void(*fcn)(VR_SIG)) |
| void | setID (unsigned int id) |
| unsigned int | getID () const |
| bool | getUseVR () |
| const OpenVRDevice * | getOpenVRDevice () const |
| void | setWorldUnitsPerMeter (double worldUnitsPerMeter) |
| double | getWorldUnitsPerMeter () |
| void | setWorldUnitsPerMeterLimits (const double &minWorldUnitsPerMeter, const double &maxWorldUnitsPerMeter) |
| void | getWorldUnitsPerMeterLimits (double &minWorldUnitsPerMeter, double &maxWorldUnitsPerMeter) |
| void | setUserHeight (const double &height) |
| virtual void | run () |
| void | printInfo () |
| void | captureWindow () |
| void | setWindowCaptureFile (const std::string &fname, const std::string &fext) |
| void | setWindowCaptureKey (int key) |
Protected Types | |
| typedef std::set< FrameManager * > | SceneSet |
Protected Member Functions | |
| bool | setupWindow () |
| void | collectScenes () |
| void | frame () |
Protected Attributes | |
| unsigned int | _winID |
| unsigned int | _nRow |
| unsigned int | _nCol |
| bool | _isEmbedded |
| RenderList | _renderList |
| SceneSet | _scenes |
| osg::ref_ptr< osgViewer::CompositeViewer > | _viewer |
| osg::ref_ptr< osgViewer::GraphicsWindow > | _window |
| osg::ref_ptr< EmbeddedGraphics > | _embeddedGraphics |
| osg::ref_ptr< WindowEventHandler > | _eventHandler |
| osg::ref_ptr< osgViewer::StatsHandler > | _statsHandler |
| osg::ref_ptr< osgViewer::ScreenCaptureHandler > | _screenCaptureHandler |
| FramerateLimiter | _frameThrottle |
| AnimationState | _animationState |
| bool | _pauseAnimation |
| bool | _timePaused |
| osg::Timer_t | _Tref |
| double | _currTime |
| double | _offsetTime |
| double | _timeScale |
| double | _minTime |
| double | _maxTime |
| osg::observer_ptr< WindowProxy > | _timeSyncWinProxy |
| bool | _useVR |
| osg::ref_ptr< OpenVRDevice > | _ovrDevice |
| osg::ref_ptr< VRTextureBuffer > | _vrTextureBuffer |
Defines an interface that can draw a scene onto any window.
This class defines an interface that can draw a scene onto any window, regardless of how that window is created or managed. This allows the scene to be drawn on a window created by (for example) a GUI management API such as gtk or Winteracter. Drawing is thread-safe and special consideration is given for OpenGL implementations that only allow one current context for all threads.
The state of this WindowProxy's animation loop
| void OpenFrames::WindowProxy::captureWindow | ( | ) |
Capture a screenshot of this window.
|
inline |
Get the desired framerate at which animation should occur.
|
inline |
Get the actual animation framerate. This is an instantaneous value.
| RenderRectangle* OpenFrames::WindowProxy::getGridPosition | ( | unsigned int | row, |
| unsigned int | col | ||
| ) |
Get the RenderRectangle used for the given grid position
|
inline |
Get the OpenVRDevice object that manages VR rendering
|
inline |
Get whether VR rendering is enabled
| void OpenFrames::WindowProxy::keyPress | ( | int | key | ) |
These functions should be called when keyboard/mouse input is recieved from your own Window Manager, or if you want to simulate user input to the WindowProxy. Note that x and y coordinates should be in the range [0, width] and [0, height] respectively, representing the extents of the window.
| void OpenFrames::WindowProxy::pauseAnimation | ( | bool | pause | ) |
Animation loop control (animation means process events, update objects, and render scene) Set the desired animation pause state. If currently animating, then return after actual animation state matches the desired animation state. Otherwise return immediately. NOTE: pauseAnimation should never be called from the render thread, which includes user-defined callback functions.
| void OpenFrames::WindowProxy::printInfo | ( | ) |
Print info about this window to std::cout.
|
virtual |
Inherited from OpenThreads::Thread. Called on thread launch.
|
inline |
Set the desired framerate at which animation should occur.
| void OpenFrames::WindowProxy::setGridSize | ( | unsigned int | row, |
| unsigned int | col | ||
| ) |
Set the render grid's dimensions.
|
inline |
Set the window id that will be passed into all user-defined callback functions.
|
inline |
Set callback functions for events
| void OpenFrames::WindowProxy::setMakeCurrentFunction | ( | void(*)(unsigned int *winID, bool *success) | fcn | ) |
Callback function for making the OpenGL context current
| void OpenFrames::WindowProxy::setSwapBuffersFunction | ( | void(*)(unsigned int *winID) | fcn | ) |
Callback function for swapping the front/back buffers
| void OpenFrames::WindowProxy::setTime | ( | double | time | ) |
Time control
| void OpenFrames::WindowProxy::setUpdateContextFunction | ( | void(*)(unsigned int *winID, bool *success) | fcn | ) |
Callback function to update the OpenGL context. Called whenever a renderer or geometry-changing event is handled. e.g. on OSX/Cocoa this is required on each resize event
| void OpenFrames::WindowProxy::setupGrid | ( | unsigned int | width, |
| unsigned int | height | ||
| ) |
Resize each RenderRectangle grid with the specified dimensions
|
inline |
Set the user height in VR
| void OpenFrames::WindowProxy::setWindowCaptureFile | ( | const std::string & | fname, |
| const std::string & | fext | ||
| ) |
Set the screenshot filename and image type. The filename will be sequentially numbered with each successive screenshot. Image types can be anything supported by OSG: jpg, png, bmp, tiff, etc.
|
inline |
Set the key that triggers a screenshot. Set key to 0 (zero) to disable keypress-based screenshots
| void OpenFrames::WindowProxy::setWindowName | ( | const std::string & | name | ) |
Set the window's name Only applies to non-embedded windows. For embedded windows, the window name should be set via the API used to create the window (Qt, wxWidgets, etc.)
|
inline |
Set the ratio of WorldUnits to Meters used for VR rendering
|
inline |
Set the limits of the WorldUntis/Meter ratio
|
inline |
Shut down the WindowProxy entirely.
| bool OpenFrames::WindowProxy::synchronizeTime | ( | WindowProxy * | winproxy | ) |
Synchronize time with another WindowProxy This causes all time control to be forwarded to the other WindowProxy Inputs: NULL or this: Stop synchronizing time Otherwise: Synchronize with specified WindowProxy Return: true: success, synchronized with input false: circular dependency detected, synchronization unchanged
|
protected |
Time control variables
|
protected |
The EmbeddedGraphics object allows rendering onto a user-provided OpenGL window
|
protected |
The WindowEventHandler handles user events that occur in the window
|
protected |
The ScreenCaptureHandler takes a screenshot of this window
|
protected |
The StatsHandler displays fps and other rendering statistics
|
protected |
The CompositeViewer handles drawing several scenes onto a single drawing surface (a window)
|
protected |
The GraphicsWindow is the actual window that is drawn onto
|
protected |
ID of this window. This will be used to identify this window to all user-defined callback functions
1.8.14