#include <QGLViewer.h>
Inheritance diagram for QGLViewer:
Public Types | |
enum | ProjectionMode { parallel, perspective } |
enum | CameraType { CurrentCam = 1, HomeCam = 2, BothCams = 3 } |
enum | StereoMode { STEREO_ON, STEREO_OFF, STEREO_SIMULATE } |
enum | StereoBuffer { MONO, STEREO_LEFT, STEREO_RIGHT } |
Public Slots | |
virtual void | sltUpdateView () |
virtual void | sltToggleStereo () |
virtual void | sltViewAll () |
Signals | |
void | sigProjModeToggled () |
void | sigRenderModeChanged () |
void | sigSelected (QMouseEvent *pqEvent) |
void | sigReleased (QMouseEvent *pqEvent) |
void | sigMoved (QMouseEvent *pqEvent) |
void | sigInitGL () |
void | sigRedrawGL () |
void | sigResizeGL (int nWidth, int nHeight) |
void | sigRatioChanged (double rdRatio) |
void | sigFovyChanged (double rdFovy) |
Public Member Functions | |
QGLViewer (QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0, bool viewertype=true, const QGLFormat &format=QGLFormat::defaultFormat()) | |
QGLViewer (const CCamera &homecam, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0, bool viewertype=true, const QGLFormat &format=QGLFormat::defaultFormat()) | |
QGLViewer (const CBoundingBox3D &bbox, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0, bool viewertype=true, const QGLFormat &format=QGLFormat::defaultFormat()) | |
virtual | ~QGLViewer () |
void | setRefreshRate (int nFramesPerSecond) |
int | getRefreshRate () |
virtual void | setBoundingBox (const CBoundingBox3D &cBBox, bool fUpdate=false) |
virtual void | setCamera (const CCamera &cCamera, CameraType which=CurrentCam) |
CCamera & | getCamera () |
CCamera * | getCameraPtr () |
virtual ProjectionMode | getProjectionMode () |
virtual void | setFullViewer (bool state) |
bool | isFullViewer () |
QGLSignalWidget * | getDrawArea () |
void | makeCurrent () |
virtual void | enableMouseEvents (bool fFlag) |
GLenum | getRenderMode () |
QPopupMenu * | getMainMenu () |
int | insertItem (const QString &text, const QObject *receiver, const char *member) |
int | insertItem (const QIconSet &icon, const QString &text, const QObject *receiver, const char *member) |
int | insertItem (const QPixmap &pixmap, const QString &text, const QObject *receiver, const char *member) |
int | insertItem (const QString &text, QPopupMenu *pqPopup) |
int | insertItem (const QPixmap &pixmap, QPopupMenu *pqPopup) |
bool | isItemEnabled (int nID) |
void | setItemEnabled (int nID, bool fEnable) |
bool | isItemChecked (int nID) |
void | setItemChecked (int nID, bool fCheck) |
void | allowStereoSimulation (bool flag) |
StereoMode | getStereoMode () |
Protected Slots | |
virtual void | sltSetProjectionMode () |
virtual void | sltSetHome () |
virtual void | sltGoHome () |
virtual void | sltToggleProjectionMode () |
virtual void | sltToggleRenderMode () |
virtual void | sltManageDrop (QDropEvent *pqEvent) |
virtual void | sltManageDragEnter (QDragEnterEvent *pqEvent) |
virtual void | sltManageDragLeave (QDragLeaveEvent *pqEvent) |
Protected Member Functions | |
virtual void | initQFrame (const char *name, const QGLWidget *shareWidget, WFlags f, const QGLFormat &format=QGLFormat::defaultFormat()) |
QFrame * | getQFrame () |
void | setFrustum (StereoBuffer buffer=QGLViewer::MONO) |
void | setFrustumMono () |
void | setFrustumStereoLeft () |
void | setFrustumStereoRight () |
void | setLookAt () |
virtual void | ManageMouseMove (QMouseEvent *) |
virtual void | ManageMousePress (QMouseEvent *) |
virtual void | ManageMouseRelease (QMouseEvent *) |
virtual void | mousePressEvent (QMouseEvent *pqEvent) |
virtual void | timerEvent (QTimerEvent *pqEvent) |
Protected Attributes | |
CCamera | m_cCurrentCamera |
CCamera | m_cHomeCamera |
GLenum | m_eRenderMode |
bool | m_fFullViewer |
QFrame * | m_pQFrame |
QGLSignalWidget * | m_pQGLWidget |
QHBoxLayout * | m_pQHBoxLayout |
QPopupMenu * | m_pqPopupMenu |
QBitmap | m_qMovePix |
QBitmap | m_qSelectPix |
QBitmap | m_qMoveMaskPix |
QBitmap | m_qSelectMaskPix |
QCursor * | m_pqMoveCursor |
QCursor * | m_pqSelectCursor |
StereoMode | m_stereoMode |
bool | m_fAllowStereoSimulation |
QStereoCtrl * | m_pStereoCtrl |
Private Slots | |
void | sltResizeGL (int w, int h) |
void | sltPaintGL () |
void | sltSwitchMousePress (QMouseEvent *event) |
void | sltSwitchMouseRelease (QMouseEvent *event) |
void | sltSwitchMouseMove (QMouseEvent *event) |
void | sltPopMenu (QMouseEvent *pqEvent) |
Private Member Functions | |
void | initCursors () |
void | initPopupMenu () |
void | initConnects () |
virtual void | setVPRes (int nWidth, int nHeight) |
Private Attributes | |
bool | m_fRefresh |
bool | m_fHandleMouseEvents |
int | m_nRefreshRate |
int | m_nTimerID |
This is an abstract class which defines the interface for any derived OpenGL-viewers.
|
An enum type for the different types of saved cameras. |
|
An enum type for the different types of projection. |
|
An enum type for framebuffers |
|
An enum type for possible stereo modes |
|
Default Constructor. |
|
Constructor including a camera for the home position box of the scene.
|
|
Constructor including a boundingbox of the scene.
|
|
Default Destructor. |
|
Enables or disables stereo simulation.
|
|
Disables/enables mouse events over the draw area if fFlag = false/true. Reimplemented in QGLExaminerViewer. |
|
The currently valid viewing camera is returned. |
|
The the pointer to the currently valid viewing camera is returned. |
|
Returns a pointer to the OpenGL drawing-area. |
|
Returns the pointer to the popup menu. |
|
Returns the currently active projection mode. |
|
Get pointer to QFrame. This is necessary for the viewers derived from this abstract viewer class. Since this class does only provide a member QGLWidget placed in a QFrame but no layout. The viewer derived from this class is responsable for the layout. |
|
Returns the current refresh rate in frames per second. |
|
Returns the current rendermode. The initial value is GL_RENDER. |
|
Return the state of the stereo mode.
|
|
Makes all necessary connects. |
|
Initializes the two possible mousecursors over the drawarea. The files for the pixmaps are loaded from the directory where the enviromentvariable QGLVIEWER_PIX point to. if nothing is found one standardcursor is used.
|
|
Initializes the popup menu. |
|
Instantiates the QGLSignalWidget and place it in a QFrame. The pointer of the QFrame can be read with the function getQFrame(), see below. |
|
Same as above but with pixmap. |
|
Add a submenu to the popup menu. |
|
Same as above but with support for pixmaps. |
|
Same as above but with support for icons. |
|
Adds a menu entry to the popup menu. |
|
Returns the the value of the flag.
|
|
Returns 'true' if the item with identifier 'nID' is checked or 'false' if it is not. |
|
Returns 'true' if the item with identifier 'nID' is enabled or 'false' if it is disabled. |
|
Makes this viewer the current viewer for OpenGL operations. |
|
Has to be implemented in the derived class if you want to handle any mousemovementevents over the QGLSignalWidget.
Reimplemented in QGLExaminerViewer. |
|
Has to be implemented in derived class if you want to handle any mousebutton press-events over the QGLSignalWidget.
Reimplemented in QGLExaminerViewer. |
|
Has to be implemented in derived class if you want to handle any mousebutton release-events over the QGLSignalWidget.
Reimplemented in QGLExaminerViewer. |
|
Reimplements the mouse-press event function inherited from QWidget. |
|
Sets boundingbox of the entire scene and fits the scene to the view area if 'fUpdate' is set to 'true'. It also sets the given boundingbox to both cameras so you don't have to do that explicitly. This method should be used whenever the scene changes (in size). |
|
Sets the specified camera(s) and updates the view if necessary. Reimplemented in QGLExaminerViewer. |
|
Sets the frustum in the current OpenGL context. It automatically recognizes if mono view or stereo simulation is switched on. |
|
Sets the frustum for mono view. |
|
Sets the left frustum for stereo simulation. |
|
Sets the right frustum for stereo simulation. |
|
Sets the flag that identifies the viewer as "full viewer" or not. It should be reimplemented in the derived class for full functionality. A "full viewer" is a viewer that have some buttons, slider or other things for manipulating the camera. If it is not a "full viewer" it only have a QGLWidget for the output. Reimplemented in QGLExaminerViewer. |
|
Checks the menu item with identifier 'nID' if 'fCheck' is 'true', or unchecks the item if 'fEnable' is 'false'. |
|
Enables the menu item with identifier 'nID' if 'fEnable' is 'true', or disables the item if 'fEnable' is 'false'. |
|
Sets the 'LookAt' parameters just like the OpenGL command 'gluLookAt(...)'. But before setting it 'glLoadIdentity()' for the model view matrix is called. |
|
Sets the refresh rate of the context. If there are more refresh calls like sltUpdateView() do they were dropped. |
|
Sets the viewplane resolution of the current- and homecamera according to the resolution of the viewport. |
|
This signal is emitted if the fovy angle of the current camera has changed by the viewer. The new fovy angle is passed by the parameter. |
|
This signal is once emitted if the widget will be showed and before any drawing were done. It comes originally from the QGLSignalWidget inside the viewer and is just passed through. |
|
This signal is ONLY emitted if the viewer is in GL_SELECT-mode and the mouse was moveed. Similar to sigSelected( int, int). |
|
This signal is emitted if the projectionmode has changed. |
|
This signal is emitted if the ratio of the current camera has changed by the viewer. The new ratio is passed by the parameter. |
|
This signal is emitted if the scene should be redrawed. It comes originally from the QGLSignalWidget inside the viewer and is just passed through. |
|
This signal is ONLY emitted if the viewer is in GL_SELECT-mode and any mousebutton was released. Similar to sigSelected( int, int). |
|
This signal is emitted if the rendermode has changed so that the application knows that it should render the scene again but in the new rendermode. |
|
This signal is emitted if the widget was resized and the scene should be redrawed. It comes originally from the QGLSignalWidget inside the viewer and is just passed through. |
|
This signal is ONLY emitted if the viewer is in GL_SELECT-mode and any mousebutton was pressed. It should be used to transfer object selections over the viewer to the application. For that connect this signal to a slot of your application which does all the stuff to get selected object(s). |
|
Current viewing position is replaced by home viewing position. Reimplemented in QGLExaminerViewer. |
|
This slot is for managing drag-enter events over the signal widget. The original implementation only calls 'accept()' if the dragged was of 'class QCameraDrag'. |
|
This slot is for managing drag-enter events over the signal widget. The original implementation does nothing. |
|
This slot is for managing drop events over the signal widget. The original implementation only magages dropped 'QCameraDrag'-classes by setting the current camera. |
|
Does some initial stuff (especially sets the projection matrix) before calling the 'PaintGl()' function of the application by sending a 'sigRedrawGL()' signal. |
|
Pops up the menu. |
|
Does some initial stuff (especially sets the viewport size and the projection matrix) before calling the 'ResizeGl()' function of the application by sending a 'sigResizeGL()' signal. |
|
Set home position The current camera is copied to the home camera. |
|
Sets up the PROJECTION matrix depending on the projectionmode. |
|
Switches the mousereleaseevents between the two rendermodes. |
|
Switches the mousepressevents between the two rendermodes. |
|
Switches the mousereleaseevents between the two rendermodes. |
|
Viewing can be toggled between parallel or perspective projection. |
|
Toggles the current rendermode between GL_RENDER and GL_SELECT and sets the right mousecursor. The initial value is GL_RENDER. Reimplemented in QGLExaminerViewer. |
|
Toggles between stereo on and off (if available). Initially stereo is disabled Reimplemented in QGLExaminerViewer. |
|
Makes a redraw of the scene. (It also calls the paint function that is connected with the signal 'sigRedrawGL()' of the viewer.) |
|
Modify camera that the entire scene resides within the currently defined view frustum. |
|
This method is called by the timer and makes an redraw if there are any pending updates. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|