OpenWalnut
1.2.5
|
Class for managing one view to the scene. More...
#include <WGEViewer.h>
Classes | |
class | QueryCallback |
Small class used for querying glGet info during rendering. More... |
Public Member Functions | |
WGEViewer (std::string name, osg::ref_ptr< osg::Referenced > wdata, int x, int y, int width, int height, WGECamera::ProjectionMode projectionMode=WGECamera::ORTHOGRAPHIC) | |
Default constructor. | |
virtual | ~WGEViewer () |
Destructor. | |
virtual void | paint () |
Repaints the contents. | |
virtual void | resize (int width, int height) |
Updates size information. | |
virtual void | close () |
Close the viewer, but wait for the rendering thread to finish. | |
osg::ref_ptr< osgViewer::View > | getView () |
Getter for OpenSceneGraph View instance. | |
void | reset () |
Resets the view using the installed manipulator. | |
void | setCameraManipulator (osg::ref_ptr< osgGA::MatrixManipulator > manipulator) |
Sets the camera manipulator to use. | |
osg::ref_ptr < osgGA::MatrixManipulator > | getCameraManipulator () |
Returns current active camera manipulator. | |
void | setCamera (osg::ref_ptr< osg::Camera > camera) |
Sets the current camera. | |
osg::ref_ptr< osg::Camera > | getCamera () |
Returns the camera currently in use. | |
void | setScene (osg::ref_ptr< WGEGroupNode > node) |
Sets the scene graph node to be used for rendering. | |
osg::ref_ptr< WGEGroupNode > | getScene () |
Returns the currently set OSG node. | |
std::string | getName () const |
Returns the name of the viewer. | |
void | setBgColor (const WColor &bgColor) |
Determine the color of the viewer's background. | |
osg::ref_ptr< WPickHandler > | getPickHandler () |
Getter for the pick handler. | |
std::string | getOpenGLVendor () const |
Queries the OpenGL vendor info. | |
WBoolFlag::SPtr | isFrameRendered () const |
Returns the flag which denotes whether a frame was rendered. | |
![]() | |
WGEGraphicsWindow (osg::ref_ptr< osg::Referenced > wdata, int x, int y, int width, int height) | |
Default constructor. | |
virtual | ~WGEGraphicsWindow () |
Destructor. | |
osg::ref_ptr < osgViewer::GraphicsWindow > | getGraphicsWindow () |
Getter for m_GraphicsWindow. | |
virtual void | keyEvent (KeyEvents eventType, int key) |
Handles key events (if forwarded to this Viewer instance). | |
virtual void | mouseEvent (MouseEvents eventType, int x, int y, int button) |
Handles mouse events forwarded from widget. |
Protected Attributes | |
osg::ref_ptr< osgViewer::View > | m_View |
The OpenSceneGraph view used in this (Composite)Viewer. | |
std::string | m_name |
The name of the viewer. | |
osg::ref_ptr< WPickHandler > | m_pickHandler |
Pointer to the pick handler of the viewer. | |
osg::ref_ptr< WGEGroupNode > | m_scene |
reference to the scene which is displayed by viewer | |
WBoolFlag::SPtr | m_rendered |
This flag is true and notifies after the first rendered frame. | |
osg::ref_ptr< QueryCallback > | m_queryCallback |
The callback used for querying OpenGL features. | |
![]() | |
osg::ref_ptr < osgViewer::GraphicsWindow > | m_GraphicsWindow |
OpenSceneGraph render window. | |
osg::ref_ptr < osg::GraphicsContext > | m_GraphicsContext |
OpenSceneGraph render context. | |
osg::ref_ptr< osg::Referenced > | m_WindowData |
Widget window data. |
Additional Inherited Members | |
![]() | |
enum | KeyEvents { KEYPRESS, KEYRELEASE } |
Event types for the keyEvent() handler. More... | |
enum | MouseEvents { MOUSEPRESS, MOUSERELEASE, MOUSEDOUBLECLICK, MOUSEMOVE, MOUSESCROLL } |
Mouse event types for the mouseEvent() handler. More... | |
![]() | |
void | createContext (int x, int y, int width, int height) |
Creates a new OpenGL context in the calling thread. |
Class for managing one view to the scene.
This includes viewport, camera and graphics context. It is, besides WGraphicsEngine, the ONLY entry point for each widget for accessing the graphics engine.
Definition at line 68 of file WGEViewer.h.
WGEViewer::WGEViewer | ( | std::string | name, |
osg::ref_ptr< osg::Referenced > | wdata, | ||
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
WGECamera::ProjectionMode | projectionMode = WGECamera::ORTHOGRAPHIC |
||
) |
Default constructor.
name | the name of the viewer |
wdata | the WindowData instance for the widget to use as render widget |
x | X coordinate of widget where to create the context. |
y | Y coordinate of widget where to create the context. |
width | Width of the widget. |
height | Height of the Widget. |
projectionMode | Projection mode of the viewer. |
WGEInitFailed | thrown if initialization of graphics context or graphics window has failed. |
Definition at line 53 of file WGEViewer.cpp.
References WGEGraphicsWindow::m_GraphicsContext, WGEGraphicsWindow::m_GraphicsWindow, m_pickHandler, m_queryCallback, m_rendered, and m_View.
|
virtual |
|
virtual |
Close the viewer, but wait for the rendering thread to finish.
Reimplemented from WGEGraphicsWindow.
Definition at line 189 of file WGEViewer.cpp.
Referenced by ~WGEViewer().
osg::ref_ptr< osg::Camera > WGEViewer::getCamera | ( | ) |
Returns the camera currently in use.
Definition at line 146 of file WGEViewer.cpp.
References m_View.
osg::ref_ptr< osgGA::MatrixManipulator > WGEViewer::getCameraManipulator | ( | ) |
Returns current active camera manipulator.
Definition at line 135 of file WGEViewer.cpp.
References m_View.
std::string WGEViewer::getName | ( | ) | const |
Returns the name of the viewer.
Definition at line 195 of file WGEViewer.cpp.
References m_name.
std::string WGEViewer::getOpenGLVendor | ( | ) | const |
Queries the OpenGL vendor info.
Definition at line 210 of file WGEViewer.cpp.
References m_queryCallback.
osg::ref_ptr< WPickHandler > WGEViewer::getPickHandler | ( | ) |
Getter for the pick handler.
Definition at line 200 of file WGEViewer.cpp.
References m_pickHandler.
osg::ref_ptr< WGEGroupNode > WGEViewer::getScene | ( | ) |
Returns the currently set OSG node.
Definition at line 157 of file WGEViewer.cpp.
References m_scene.
osg::ref_ptr< osgViewer::View > WGEViewer::getView | ( | ) |
Getter for OpenSceneGraph View instance.
Definition at line 124 of file WGEViewer.cpp.
References m_View.
WBoolFlag::SPtr WGEViewer::isFrameRendered | ( | ) | const |
Returns the flag which denotes whether a frame was rendered.
Definition at line 215 of file WGEViewer.cpp.
References m_rendered.
|
virtual |
void WGEViewer::reset | ( | ) |
Resets the view using the installed manipulator.
Definition at line 205 of file WGEViewer.cpp.
References m_View.
|
virtual |
Updates size information.
Also updates camera.
width | new width. |
height | new height. |
Reimplemented from WGEGraphicsWindow.
Definition at line 174 of file WGEViewer.cpp.
References m_View, and WGECamera::resize().
void WGEViewer::setBgColor | ( | const WColor & | bgColor | ) |
Determine the color of the viewer's background.
bgColor | the new background color |
Definition at line 162 of file WGEViewer.cpp.
References m_View.
void WGEViewer::setCamera | ( | osg::ref_ptr< osg::Camera > | camera | ) |
Sets the current camera.
camera | the OSG camera instance. |
Definition at line 140 of file WGEViewer.cpp.
References m_View.
void WGEViewer::setCameraManipulator | ( | osg::ref_ptr< osgGA::MatrixManipulator > | manipulator | ) |
Sets the camera manipulator to use.
manipulator | the manipulator to use. |
Definition at line 129 of file WGEViewer.cpp.
References m_View.
void WGEViewer::setScene | ( | osg::ref_ptr< WGEGroupNode > | node | ) |
Sets the scene graph node to be used for rendering.
node | part of the scene graph |
Definition at line 151 of file WGEViewer.cpp.
|
protected |
|
protected |
Pointer to the pick handler of the viewer.
Definition at line 219 of file WGEViewer.h.
Referenced by getPickHandler(), and WGEViewer().
|
protected |
The callback used for querying OpenGL features.
Definition at line 284 of file WGEViewer.h.
Referenced by getOpenGLVendor(), and WGEViewer().
|
protected |
This flag is true and notifies after the first rendered frame.
Definition at line 229 of file WGEViewer.h.
Referenced by isFrameRendered(), and WGEViewer().
|
protected |
reference to the scene which is displayed by viewer
Definition at line 224 of file WGEViewer.h.
Referenced by getScene(), and setScene().
|
protected |
The OpenSceneGraph view used in this (Composite)Viewer.
Definition at line 208 of file WGEViewer.h.
Referenced by getCamera(), getCameraManipulator(), getView(), paint(), reset(), resize(), setBgColor(), setCamera(), setCameraManipulator(), setScene(), and WGEViewer().