#include <qtopengl_widget.h>
Classes | |
struct | SFrameGrabData |
Data regarding frame grabbing. More... | |
struct | SSelectionInfo |
Data arelated to robot selection. More... | |
Public Slots | |
void | PlayExperiment () |
Plays the experiment. More... | |
void | FastForwardExperiment () |
Fast forwards the experiment. More... | |
void | PauseExperiment () |
Pauses the experiment. More... | |
void | StepExperiment () |
Executes one experiment time step. More... | |
void | ResetExperiment () |
Resets the state of the experiment to its state right after initialization. More... | |
void | SetDrawFrameEvery (int n_every) |
When fast-forwarding, sets every how many steps a frame must be drawn. More... | |
void | SetGrabFrame (bool b_grab_on) |
Toggles frame grabbing. More... | |
void | SetCamera (int n_camera) |
Sets the current camera in use. More... | |
void | SetCameraFocalLength (double f_length) |
Sets the focal length of the current camera. More... | |
void | KeyPressed (QKeyEvent *pc_event) |
Handles key press events. More... | |
void | KeyReleased (QKeyEvent *pc_event) |
Handles key release events. More... | |
Signals | |
void | StepDone (int n_step) |
Emitted whenever a time step has been executed. More... | |
void | ExperimentDone () |
Emitted when the experiment is finished. More... | |
void | EntitySelected (CEntity *pc_entity) |
Emitted when an entity is selected. More... | |
void | EntityDeselected (CEntity *pc_entity) |
Emitted when an entity is deselected. More... | |
Public Member Functions | |
CQTOpenGLWidget (QWidget *pc_parent, CQTOpenGLMainWindow &c_main_window, CQTOpenGLUserFunctions &c_user_functions) | |
Class constructor. More... | |
virtual | ~CQTOpenGLWidget () |
Class destructor. More... | |
virtual void | initializeGL () |
Called when the GL context must be initialized. More... | |
virtual void | paintGL () |
Logic for scene drawing. More... | |
CRay3 | RayFromWindowCoord (int n_x, int n_y) |
Casts a ray from the given window coordinate. More... | |
CVector3 | GetWindowCoordInWorld (int n_x, int n_y) |
Returns the position in the world corresponding to the given window coordinate. More... | |
CEntity * | GetSelectedEntity () |
Returns the currently selected entity, or NULL if none is selected. More... | |
void | SelectEntity (CEntity &c_entity) |
Selects the passed entity. More... | |
void | DeselectEntity () |
Deselects the currently selected entity. More... | |
void | SelectInScene (UInt32 un_x, UInt32 un_y) |
Selects the entity closest to the camera at the given screen coordinates. More... | |
void | DrawEntity (CPositionalEntity &c_entity) |
Draws a positional entity. More... | |
void | DrawEntity (CEmbodiedEntity &c_entity) |
Draws an embodied entity. More... | |
void | DrawRays (CControllableEntity &c_entity) |
Draws a ray. More... | |
void | DrawBoundingBox (CEmbodiedEntity &c_entity) |
Draws the bounding box of an embodied entity. More... | |
virtual int | heightForWidth (int w) const |
Called internally by Qt to set the aspect ratio. More... | |
virtual QSize | sizeHint () const |
Called internally by Qt to know the preferred widget size. More... | |
virtual QSize | minimumSize () const |
Called internally by Qt to know the minimum widget size. More... | |
CQTOpenGLUserFunctions & | GetUserFunctions () |
Returns a reference to the user functions. More... | |
CQTOpenGLCamera & | GetCamera () |
Returns a reference to the camera. More... | |
SFrameGrabData & | GetFrameGrabData () |
Returns the current frame grabbing data. More... | |
void | SetInvertMouse (bool b_invert_mouse) |
Sets whether the mouse should be inverted when moving. More... | |
void | SetShowBoundary (bool b_show_boundary) |
Sets whether the boundary walls should be rendered. More... | |
Protected Member Functions | |
void | DrawScene () |
void | DrawArena () |
void | DrawAxes () |
virtual void | timerEvent (QTimerEvent *pc_event) |
virtual void | mousePressEvent (QMouseEvent *pc_event) |
virtual void | mouseReleaseEvent (QMouseEvent *pc_event) |
virtual void | mouseMoveEvent (QMouseEvent *pc_event) |
virtual void | wheelEvent (QWheelEvent *pc_event) |
virtual void | keyPressEvent (QKeyEvent *pc_event) |
virtual void | keyReleaseEvent (QKeyEvent *pc_event) |
virtual void | resizeEvent (QResizeEvent *pc_event) |
void | reactToKeyEvent () |
Definition at line 56 of file qtopengl_widget.h.
argos::CQTOpenGLWidget::CQTOpenGLWidget | ( | QWidget * | pc_parent, |
CQTOpenGLMainWindow & | c_main_window, | ||
CQTOpenGLUserFunctions & | c_user_functions | ||
) |
Class constructor.
pc_parent | The containing widget. |
pc_main_window | A pointer to the main window. |
c_user_functions | A reference to the main window. |
Definition at line 39 of file qtopengl_widget.cpp.
|
virtual |
Class destructor.
Definition at line 78 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::DeselectEntity | ( | ) |
Deselects the currently selected entity.
If no entity is selected, nothing is done.
Definition at line 331 of file qtopengl_widget.cpp.
|
protected |
Definition at line 673 of file qtopengl_widget.cpp.
|
protected |
Definition at line 777 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::DrawBoundingBox | ( | CEmbodiedEntity & | c_entity | ) |
Draws the bounding box of an embodied entity.
Definition at line 428 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::DrawEntity | ( | CEmbodiedEntity & | c_entity | ) |
Draws an embodied entity.
Definition at line 376 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::DrawEntity | ( | CPositionalEntity & | c_entity | ) |
Draws a positional entity.
Definition at line 358 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::DrawRays | ( | CControllableEntity & | c_entity | ) |
Draws a ray.
Definition at line 394 of file qtopengl_widget.cpp.
|
protected |
|
signal |
Emitted when an entity is deselected.
The | deselected entity |
|
signal |
Emitted when an entity is selected.
The | selected entity |
|
signal |
Emitted when the experiment is finished.
An experiment can finish "naturally", when CSimulator::IsExperimentFinished() returns true
; or "forcedly", when the user pressed the terminate button.
|
slot |
Fast forwards the experiment.
Internally sets a timer whose period is 1ms.
Definition at line 493 of file qtopengl_widget.cpp.
|
inline |
Returns a reference to the camera.
Definition at line 218 of file qtopengl_widget.h.
|
inline |
Returns the current frame grabbing data.
Definition at line 225 of file qtopengl_widget.h.
CEntity * argos::CQTOpenGLWidget::GetSelectedEntity | ( | ) |
Returns the currently selected entity, or NULL if none is selected.
Definition at line 297 of file qtopengl_widget.cpp.
|
inline |
Returns a reference to the user functions.
Definition at line 211 of file qtopengl_widget.h.
CVector3 argos::CQTOpenGLWidget::GetWindowCoordInWorld | ( | int | n_x, |
int | n_y | ||
) |
Returns the position in the world corresponding to the given window coordinate.
Definition at line 255 of file qtopengl_widget.cpp.
|
inlinevirtual |
Called internally by Qt to set the aspect ratio.
Definition at line 190 of file qtopengl_widget.h.
|
virtual |
Called when the GL context must be initialized.
This happens once per runtime, either before the first call to resizeGL() or to paintGL().
Definition at line 90 of file qtopengl_widget.cpp.
|
slot |
Handles key press events.
Definition at line 581 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 942 of file qtopengl_widget.cpp.
|
slot |
Handles key release events.
Definition at line 627 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 949 of file qtopengl_widget.cpp.
|
inlinevirtual |
Called internally by Qt to know the minimum widget size.
Definition at line 204 of file qtopengl_widget.h.
|
protectedvirtual |
Definition at line 872 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 790 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 817 of file qtopengl_widget.cpp.
|
virtual |
Logic for scene drawing.
Definition at line 130 of file qtopengl_widget.cpp.
|
slot |
Pauses the experiment.
The experiment can be resumed with PlayExperiment() or FastForwardExperiment().
Definition at line 503 of file qtopengl_widget.cpp.
|
slot |
Plays the experiment.
Internally sets a timer whose period corresponds to the XML attribute 'ticks_per_second' in the .argos file.
Definition at line 484 of file qtopengl_widget.cpp.
CRay3 argos::CQTOpenGLWidget::RayFromWindowCoord | ( | int | n_x, |
int | n_y | ||
) |
Casts a ray from the given window coordinate.
The ray goes from the near clipping plane to the far one.
Definition at line 209 of file qtopengl_widget.cpp.
|
protected |
Definition at line 956 of file qtopengl_widget.cpp.
|
slot |
Resets the state of the experiment to its state right after initialization.
Definition at line 537 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 981 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::SelectEntity | ( | CEntity & | c_entity | ) |
Selects the passed entity.
c_entity | The entity to select. |
Definition at line 306 of file qtopengl_widget.cpp.
Selects the entity closest to the camera at the given screen coordinates.
un_x | The screen X coordinate. |
un_y | The screen Y coordinate. |
Definition at line 345 of file qtopengl_widget.cpp.
|
slot |
Sets the current camera in use.
n_camera | The index of the wanted camera [0-11] |
Definition at line 563 of file qtopengl_widget.cpp.
|
slot |
Sets the focal length of the current camera.
f_length | The desired focal length |
Definition at line 572 of file qtopengl_widget.cpp.
|
slot |
When fast-forwarding, sets every how many steps a frame must be drawn.
Definition at line 549 of file qtopengl_widget.cpp.
|
slot |
Toggles frame grabbing.
Definition at line 556 of file qtopengl_widget.cpp.
|
inline |
Sets whether the mouse should be inverted when moving.
Definition at line 232 of file qtopengl_widget.h.
|
inline |
Sets whether the boundary walls should be rendered.
Definition at line 239 of file qtopengl_widget.h.
|
inlinevirtual |
Called internally by Qt to know the preferred widget size.
Definition at line 197 of file qtopengl_widget.h.
|
signal |
Emitted whenever a time step has been executed.
n_step | The time-step count |
|
slot |
Executes one experiment time step.
Definition at line 512 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 783 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 909 of file qtopengl_widget.cpp.