7 #ifndef QTOPENGL_WIDGET_H
8 #define QTOPENGL_WIDGET_H
11 class CQTOpenGLWidget;
12 class CQTOpenGLMainWindow;
16 class CQTOpenGLUserFunctions;
17 class CPositionalEntity;
18 class CControllableEntity;
19 class CEmbodiedEntity;
22 #include <argos3/plugins/simulator/visualizations/qt-opengl/qtopengl_camera.h>
23 #include <argos3/core/simulator/entity/entity.h>
24 #include <argos3/core/utility/datatypes/datatypes.h>
25 #include <QOpenGLWidget>
26 #include <QOpenGLFunctions>
27 #include <QOpenGLTexture>
50 #define REGISTER_QTOPENGL_ENTITY_OPERATION(ACTION, OPERATION, ENTITY) \
51 REGISTER_ENTITY_OPERATION(ACTION, CQTOpenGLWidget, OPERATION, void, ENTITY);
192 return QSize(1024,768);
199 return QSize(320,240);
206 return m_cUserFunctions;
220 return m_sFrameGrabData;
227 m_bInvertMouse = b_InvertMouse;
328 virtual void timerEvent(QTimerEvent* pc_event);
347 bool m_bFastForwarding;
354 bool m_bMouseGrabbed;
356 bool m_bShiftPressed;
358 QPoint m_cMouseGrabPos;
362 SSelectionInfo m_sSelectionInfo;
370 bool m_bUsingFloorTexture;
372 QOpenGLTexture* m_pcFloorTexture;
374 QOpenGLTexture* m_pcGroundTexture;
377 GLfloat* m_pfLightAmbient;
379 GLfloat* m_pfLightDiffuse;
381 GLfloat* m_pfLight0Position;
383 GLfloat* m_pfLight1Position;
386 GLuint m_unArenaList;
388 GLuint m_unFloorList;
393 SFrameGrabData m_sFrameGrabData;
406 QMap<EDirection, int> m_mapPressedKeys;
CQTOpenGLCamera & GetCamera()
Returns a reference to the camera.
The QTOpenGL user functions.
signed int SInt32
32-bit signed integer.
An entity that contains a pointer to the user-defined controller.
CQTOpenGLWidget(QWidget *pc_parent, CQTOpenGLMainWindow &c_main_window, CQTOpenGLUserFunctions &c_user_functions)
Class constructor.
CQTOpenGLUserFunctions & GetUserFunctions()
Returns a reference to the user functions.
virtual void keyReleaseEvent(QKeyEvent *pc_event)
void EntityDeselected(CEntity *pc_entity)
Emitted when an entity is deselected.
void ExperimentDone()
Emitted when the experiment is finished.
virtual void mouseReleaseEvent(QMouseEvent *pc_event)
virtual void keyPressEvent(QKeyEvent *pc_event)
CVector3 GetWindowCoordInWorld(int n_x, int n_y)
Returns the position in the world corresponding to the given window coordinate.
virtual QSize minimumSize() const
Called internally by Qt to know the minimum widget size.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
void KeyPressed(QKeyEvent *pc_event)
Handles key press events.
CEntity * GetSelectedEntity()
Returns the currently selected entity, or NULL if none is selected.
This entity is a link to a body in the physics engine.
virtual ~CQTOpenGLOperationDrawNormal()
void PauseExperiment()
Pauses the experiment.
void StepExperiment()
Executes one experiment time step.
void KeyReleased(QKeyEvent *pc_event)
Handles key release events.
void SetDrawFrameEvery(int n_every)
When fast-forwarding, sets every how many steps a frame must be drawn.
virtual QSize sizeHint() const
Called internally by Qt to know the preferred widget size.
unsigned int UInt32
32-bit unsigned integer.
virtual void paintGL()
Logic for scene drawing.
void SelectEntity(CEntity &c_entity)
Selects the passed entity.
Data regarding frame grabbing.
virtual int heightForWidth(int w) const
Called internally by Qt to set the aspect ratio.
CRay3 RayFromWindowCoord(int n_x, int n_y)
Casts a ray from the given window coordinate.
virtual void initializeGL()
Called when the GL context must be initialized.
SFrameGrabData & GetFrameGrabData()
Returns the current frame grabbing data.
virtual void mouseMoveEvent(QMouseEvent *pc_event)
void DeselectEntity()
Deselects the currently selected entity.
void SetCamera(int n_camera)
Sets the current camera in use.
void PlayExperiment()
Plays the experiment.
virtual void timerEvent(QTimerEvent *pc_event)
void ResetExperiment()
Resets the state of the experiment to its state right after initialization.
void FastForwardExperiment()
Fast forwards the experiment.
void SelectInScene(UInt32 un_x, UInt32 un_y)
Selects the entity closest to the camera at the given screen coordinates.
void SetInvertMouse(bool b_InvertMouse)
Sets whether the mouse should be inverted when moving.
void EntitySelected(CEntity *pc_entity)
Emitted when an entity is selected.
void SetGrabFrame(bool b_grab_on)
Toggles frame grabbing.
void DrawEntity(CPositionalEntity &c_entity)
Draws a positional entity.
The basic operation to be stored in the vtable.
void DrawBoundingBox(CEmbodiedEntity &c_entity)
Draws the bounding box of an embodied entity.
virtual ~CQTOpenGLWidget()
Class destructor.
void SetCameraFocalLength(double f_length)
Sets the focal length of the current camera.
void DrawRays(CControllableEntity &c_entity)
Draws a ray.
void StepDone(int n_step)
Emitted whenever a time step has been executed.
void Init(TConfigurationNode &t_tree)
virtual void mousePressEvent(QMouseEvent *pc_event)
The namespace containing all the ARGoS related code.
Data arelated to robot selection.
virtual void resizeEvent(QResizeEvent *pc_event)
virtual ~CQTOpenGLOperationDrawSelected()