#include <glview.h>
Inheritance diagram for GLView:
These currently are:
It implements common routines like OpenGL-setup, mouse-interaction, keyboard-interaction, image-saving and animation. It contains a pure virtual so has to be subclassed.
Definition at line 38 of file glview.h.
Public Slots | |
void | setModified (const bool status=true) |
Sets the 'modified' status of the scene. Defaults to true. | |
void | toggleAnimation () |
Toggles animation on/off. | |
void | centerView (const bool update=true) |
Centers the view on the scene. | |
void | resetOrientation (const bool update=true) |
Resets the orientation of the scene. | |
void | zoomFit (const bool update=true) |
Calculates zPos so that the scene fits in the current window It uses the result of boundingSphereRadius, a pure virtual. | |
void | resetView (const bool update=true) |
Resets translation/orientation/zoom of the scene. | |
void | saveImage () |
Saves the view to an image. | |
Signals | |
void | modified () |
void | changed () |
Public Member Functions | |
GLView (QWidget *parent=0, const char *name=0) | |
virtual | ~GLView () |
The destructor. | |
bool | isModified () const |
Returns whether the view has been modified and possibly needs to be saved. | |
bool | isAnimating () const |
Returns whether the scene is animating. | |
unsigned int | calculateFPS () |
Returns the maximum attainable number of frames per second. | |
Static Public Member Functions | |
static void | setParameters (GLBaseParameters params) |
Updates the OpenGL parameters and makes sure they are adapted at the next call to updateGL(). | |
Protected Member Functions | |
void | initializeGL () |
Overridden from QGLWidget::initializeGL(). | |
void | resizeGL (int w, int h) |
Overridden from QGlWidget::resizeGL(). | |
void | paintGL () |
Overridden from QGlWidget::paintGL(). Does the drawing of the OpenGL scene. | |
void | mousePressEvent (QMouseEvent *e) |
Overridden from QGlWidget::mousePressEvent. Handles left mouse button presses. | |
void | mouseMoveEvent (QMouseEvent *e) |
Overridden from QGlWidget::mouseMoveEvent. Handles left mouse button drags. | |
void | mouseReleaseEvent (QMouseEvent *e) |
Overridden from QGlWidget::mouseReleaseEvent. | |
void | keyPressEvent (QKeyEvent *e) |
Overridden from QGlWidget::mousepressEvent. | |
void | wheelEvent (QWheelEvent *e) |
Overridden from QGlWidget::wheelEvent. | |
virtual void | drawScene ()=0 |
void | translateZ (const int amount) |
Handles the request for a translation in the Z-direction. | |
void | translateXY (const int amountX, const int amountY) |
Handles the request for a translation in the X- or Y-direction. | |
virtual void | clicked (const QPoint &) |
Handles leftbutton mouse clicks at the given position. | |
virtual void | updateGLSettings () |
Updates the OpenGL settings. | |
virtual float | boundingSphereRadius ()=0 |
void | updateFog (const float radius) |
Updates the fog parameters depending on the size of the object that's to be depth-cue'd. | |
void | updateProjection () |
Checks whether the projection type changed and does the necessary updating. | |
void | setPerspective () |
Sets the correct perspective. | |
Protected Attributes | |
GLfloat | xPos |
Amount of translation on the x-axis. | |
GLfloat | yPos |
Amount of translation on the y-axis. | |
GLfloat | zPos |
Zoomfactor = distance camera from center. | |
Quaternion< float > * | orientationQuaternion |
Orientation of the molecule in 4D. | |
QPoint | mousePosition |
Position of the mouse. | |
Static Protected Attributes | |
static const int | redrawWait = 33 |
Number of msec to wait between updates (for a max of 30 FPS). | |
static const float | fieldOfView = 60.0f |
Field of view for gluPerspective and slotZoomFit. | |
static GLBaseParameters | baseParameters |
Holds the OpenGL base parameters. | |
Private Attributes | |
GLfloat | xRot |
Amount of step-rotation around the x-axis. | |
GLfloat | yRot |
Amount of step-rotation around the y-axis. | |
GLfloat | zRot |
Amount of step-rotation around the z-axis. | |
QTimer * | timer |
Timer object. | |
bool | animation |
Is true if the scene should be animated. | |
int | updateIndex |
Holds the index of the latest local update. | |
bool | viewModified |
Holds the 'modified' status of the scene. | |
bool | startingClick |
Keeps track of click vs. move events. | |
float | maxRadius |
A copy of the result of boundingSphereRadius for use in translateZ. | |
bool | currentPerspectiveProjection |
Is true if the current projection is perspective. | |
Static Private Attributes | |
static int | staticUpdateIndex = 0 |
holds the index of the latest update of the OpenGL parameters. |
|
Definition at line 57 of file glview.cpp. |
|
The destructor.
Definition at line 82 of file glview.cpp. |
|
Returns whether the view has been modified and possibly needs to be saved.
Definition at line 89 of file glview.cpp. |
|
Returns whether the scene is animating.
Definition at line 96 of file glview.cpp. |
|
Returns the maximum attainable number of frames per second. It draws as much frames as possible in 5 seconds. Definition at line 103 of file glview.cpp. |
|
Updates the OpenGL parameters and makes sure they are adapted at the next call to updateGL().
Definition at line 137 of file glview.cpp. |
|
|
|
|
|
Sets the 'modified' status of the scene. Defaults to true.
Definition at line 150 of file glview.cpp. |
|
Toggles animation on/off.
Definition at line 167 of file glview.cpp. |
|
Centers the view on the scene.
Definition at line 185 of file glview.cpp. |
|
Resets the orientation of the scene.
Definition at line 196 of file glview.cpp. |
|
Calculates zPos so that the scene fits in the current window It uses the result of boundingSphereRadius, a pure virtual.
Definition at line 206 of file glview.cpp. |
|
Resets translation/orientation/zoom of the scene.
Definition at line 236 of file glview.cpp. |
|
Saves the view to an image.
Definition at line 247 of file glview.cpp. |
|
Overridden from QGLWidget::initializeGL(). Initializes the OpenGL window. Reimplemented in GLSimpleMoleculeView. Definition at line 309 of file glview.cpp. |
|
Overridden from QGlWidget::resizeGL(). Resizes the OpenGL viewport according to the size of the widget. Definition at line 365 of file glview.cpp. |
|
Overridden from QGlWidget::paintGL(). Does the drawing of the OpenGL scene.
Definition at line 378 of file glview.cpp. |
|
Overridden from QGlWidget::mousePressEvent. Handles left mouse button presses.
Definition at line 432 of file glview.cpp. |
|
Overridden from QGlWidget::mouseMoveEvent. Handles left mouse button drags.
Reimplemented in GLMoleculeView. Definition at line 445 of file glview.cpp. |
|
Overridden from QGlWidget::mouseReleaseEvent. Handles left mouse button releases. Definition at line 489 of file glview.cpp. |
|
Overridden from QGlWidget::mousepressEvent. Handles key presses.
Reimplemented in GLMoleculeView, and GLSimpleMoleculeView. Definition at line 506 of file glview.cpp. |
|
Overridden from QGlWidget::wheelEvent. Handles scrolls with the scrollwheel of the mouse. It provides an alternative way of zooming. Definition at line 565 of file glview.cpp. |
|
Implemented in GLOrbitalView, and GLSimpleMoleculeView. |
|
Handles the request for a translation in the Z-direction. Here the complete scene is translated (=zoomed). Definition at line 576 of file glview.cpp. |
|
Handles the request for a translation in the X- or Y-direction. Here the complete scene is translated. Definition at line 596 of file glview.cpp. |
|
Handles leftbutton mouse clicks at the given position. No implementation in this base class. Not a pure virtual because it does not need an implementation by the derived classes. Reimplemented in GLSimpleMoleculeView. Definition at line 607 of file glview.cpp. |
|
Updates the OpenGL settings. It is only called when an update is really needed (determined by staticUpdateIndex != updateIndex). Reimplemented in GLSimpleMoleculeView. Definition at line 615 of file glview.cpp. |
|
Implemented in GLMoleculeView, GLOrbitalView, and GLSimpleMoleculeView. |
|
Updates the fog parameters depending on the size of the object that's to be depth-cue'd.
Definition at line 674 of file glview.cpp. |
|
Checks whether the projection type changed and does the necessary updating.
Definition at line 687 of file glview.cpp. |
|
Sets the correct perspective.
Definition at line 700 of file glview.cpp. |
|
Amount of translation on the x-axis.
|
|
Amount of translation on the y-axis.
|
|
Zoomfactor = distance camera from center.
|
|
Orientation of the molecule in 4D.
|
|
Position of the mouse.
|
|
Number of msec to wait between updates (for a max of 30 FPS).
|
|
Field of view for gluPerspective and slotZoomFit.
|
|
Initial value: {1.0f, 1.0f, 1.0f, 0xffffff, 0.80f, 100.0f, 0x000000, false, true, false, true}
|
|
Amount of step-rotation around the x-axis.
|
|
Amount of step-rotation around the y-axis.
|
|
Amount of step-rotation around the z-axis.
|
|
Timer object.
|
|
Is true if the scene should be animated.
|
|
Holds the index of the latest local update.
|
|
Holds the 'modified' status of the scene.
|
|
Keeps track of click vs. move events.
|
|
A copy of the result of boundingSphereRadius for use in translateZ.
|
|
Is true if the current projection is perspective.
|
|
holds the index of the latest update of the OpenGL parameters.
|