#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_InvertMouse) |
Sets whether the mouse should be inverted when moving. 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 | 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 38 of file qtopengl_widget.cpp.
|
virtual |
Class destructor.
Definition at line 76 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 329 of file qtopengl_widget.cpp.
|
protected |
Definition at line 671 of file qtopengl_widget.cpp.
|
protected |
Definition at line 773 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::DrawBoundingBox | ( | CEmbodiedEntity & | c_entity | ) |
Draws the bounding box of an embodied entity.
Definition at line 426 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::DrawEntity | ( | CPositionalEntity & | c_entity | ) |
Draws a positional entity.
Definition at line 356 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::DrawEntity | ( | CEmbodiedEntity & | c_entity | ) |
Draws an embodied entity.
Definition at line 374 of file qtopengl_widget.cpp.
void argos::CQTOpenGLWidget::DrawRays | ( | CControllableEntity & | c_entity | ) |
Draws a ray.
Definition at line 392 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 491 of file qtopengl_widget.cpp.
|
inline |
Returns a reference to the camera.
Definition at line 212 of file qtopengl_widget.h.
|
inline |
Returns the current frame grabbing data.
Definition at line 219 of file qtopengl_widget.h.
CEntity * argos::CQTOpenGLWidget::GetSelectedEntity | ( | ) |
Returns the currently selected entity, or NULL if none is selected.
Definition at line 295 of file qtopengl_widget.cpp.
|
inline |
Returns a reference to the user functions.
Definition at line 205 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 253 of file qtopengl_widget.cpp.
|
inlinevirtual |
Called internally by Qt to set the aspect ratio.
Definition at line 184 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 88 of file qtopengl_widget.cpp.
|
slot |
Handles key press events.
Definition at line 579 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 903 of file qtopengl_widget.cpp.
|
slot |
Handles key release events.
Definition at line 625 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 910 of file qtopengl_widget.cpp.
|
inlinevirtual |
Called internally by Qt to know the minimum widget size.
Definition at line 198 of file qtopengl_widget.h.
|
protectedvirtual |
Definition at line 866 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 786 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 813 of file qtopengl_widget.cpp.
|
virtual |
Logic for scene drawing.
Definition at line 128 of file qtopengl_widget.cpp.
|
slot |
Pauses the experiment.
The experiment can be resumed with PlayExperiment() or FastForwardExperiment().
Definition at line 501 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 482 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 207 of file qtopengl_widget.cpp.
|
protected |
Definition at line 917 of file qtopengl_widget.cpp.
|
slot |
Resets the state of the experiment to its state right after initialization.
Definition at line 534 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 942 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 304 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 343 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 559 of file qtopengl_widget.cpp.
|
slot |
Sets the focal length of the current camera.
f_length | The desired focal length |
Definition at line 568 of file qtopengl_widget.cpp.
|
slot |
When fast-forwarding, sets every how many steps a frame must be drawn.
Definition at line 545 of file qtopengl_widget.cpp.
|
slot |
Toggles frame grabbing.
Definition at line 552 of file qtopengl_widget.cpp.
|
inline |
Sets whether the mouse should be inverted when moving.
Definition at line 226 of file qtopengl_widget.h.
|
inlinevirtual |
Called internally by Qt to know the preferred widget size.
Definition at line 191 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 510 of file qtopengl_widget.cpp.
|
protectedvirtual |
Definition at line 779 of file qtopengl_widget.cpp.