#include <RenderWidget.h>
Public Slots | |
void | changeView (bool enablePerspective) |
Public Member Functions | |
void | bindRenderMode (VolumeRendering::Rendering *rendering) |
const Util::Camera * | getCamera () const |
void | render (bool prepare=true, bool render=true) const |
RenderWidget (QWidget *parent=0) | |
void | resetTransformations () |
void | rotate (double angle, const Eigen::Vector3d &axis) |
void | saveScreenshot (std::string &path) |
void | scale (double factor) |
void | setupCamera () const |
void | translate (const Eigen::Vector2d &t) |
~RenderWidget () | |
Protected Member Functions | |
void | initializeGL () |
void | mouseMoveEvent (QMouseEvent *event) |
void | mousePressEvent (QMouseEvent *event) |
void | mouseReleaseEvent (QMouseEvent *event) |
void | paintGL () |
void | resizeGL (int width, int height) |
VolVis::Gui::RenderWidget::RenderWidget | ( | QWidget * | parent = 0 |
) |
Constructor. Sets up a new QGLWidget.
parent | parent widget of this one. |
VolVis::Gui::RenderWidget::~RenderWidget | ( | ) |
Destructor.
void VolVis::Gui::RenderWidget::bindRenderMode | ( | VolumeRendering::Rendering * | rendering | ) |
Binds a render mode (e.g. Slicing) to the widget. When rendering the widget, the render-method of the render mode will be called.
rendering | the active render mode which should be used at rendering |
void VolVis::Gui::RenderWidget::changeView | ( | bool | enablePerspective | ) | [slot] |
Sets the view to perspective or orthographic projection.
enablePerspective | if true, perspective projection is enabled, otherwise orthographic projection. |
const Util::Camera* VolVis::Gui::RenderWidget::getCamera | ( | ) | const |
Returns the camera used for setting up the projection matrix
void VolVis::Gui::RenderWidget::initializeGL | ( | ) | [protected] |
Implements all necessary operations for initializing OpenGL.
void VolVis::Gui::RenderWidget::mouseMoveEvent | ( | QMouseEvent * | event | ) | [protected] |
This method is inherited from QWidget and is called when the mouse is pressed and moved over the widget. The transformation of the scene is changed due to which mousebutton has been pressed.
event | contains the parameters of the mouse event (e.g. which button has been used) |
void VolVis::Gui::RenderWidget::mousePressEvent | ( | QMouseEvent * | event | ) | [protected] |
This method is inherited from QWidget and is called when a mouse button is pressed. It is needed to change the quality of rendering before the scene is transformed.
event | contains the parameters of the mouse event (e.g. which button has been used) |
void VolVis::Gui::RenderWidget::mouseReleaseEvent | ( | QMouseEvent * | event | ) | [protected] |
This method is inherited from QWidget and is called when a pressed mousebutton is released. This method is needed for changing the quality of rendering after the scene transformation has been finished.
event | contains the parameters of the mouse event (e.g. which button has been used) |
void VolVis::Gui::RenderWidget::paintGL | ( | ) | [protected] |
This method is called by the slot updateGL() from the base class QGLWidget. This is needed for the openGL callback. It calls render(true, true).
void VolVis::Gui::RenderWidget::render | ( | bool | prepare = true , |
|
bool | render = true | |||
) | const |
This renders the loaded volume with the selected render mode. Before it assigns the transformations defined by mouse interaction. Sometimes it's useful to only prepare for rendering or only to render and use the preparation of the last frame (e.g. when rendering a high resolution image).
prepare | Calls the prepareForRender method of the render mode | |
render | Calls the render method of the render mode |
void VolVis::Gui::RenderWidget::resetTransformations | ( | ) |
Resets the rotation and translation which have been set by rotate/translate.
void VolVis::Gui::RenderWidget::resizeGL | ( | int | width, | |
int | height | |||
) | [protected] |
This method is called when the size of the widget is changed.
width | new width of the widget | |
height | new height of the widget |
void VolVis::Gui::RenderWidget::rotate | ( | double | angle, | |
const Eigen::Vector3d & | axis | |||
) |
Rotates all objects drawn in the GL area
angle | rotation angle | |
axis | rotation axis |
void VolVis::Gui::RenderWidget::saveScreenshot | ( | std::string & | path | ) |
The current content of the render widget will be saved as an image.
path | path to the file where the image should be stored |
void VolVis::Gui::RenderWidget::scale | ( | double | factor | ) |
Scales the objects in the GL area by the given factor.
factor | factor with which the scene is scaled |
void VolVis::Gui::RenderWidget::setupCamera | ( | ) | const |
Redefines the projection matrix with the camera attached to this render widget.
void VolVis::Gui::RenderWidget::translate | ( | const Eigen::Vector2d & | t | ) |
Translates all objects in the GL area in x and y translation
t | contains the translation in x and y directions |