ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
Go to the documentation of this file.
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;
390 GLuint* m_punSelectionBuffer;
395 SFrameGrabData m_sFrameGrabData;
408 QMap<EDirection, int> m_mapPressedKeys;
410 CRay3 m_cSelectionRay;
void Init(TConfigurationNode &t_tree)
The basic operation to be stored in the vtable.
void PauseExperiment()
Pauses the experiment.
virtual void keyReleaseEvent(QKeyEvent *pc_event)
virtual void initializeGL()
Called when the GL context must be initialized.
The namespace containing all the ARGoS related code.
void SetCamera(int n_camera)
Sets the current camera in use.
This entity is a link to a body in the physics engine.
void SetGrabFrame(bool b_grab_on)
Toggles frame grabbing.
Data arelated to robot selection.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
virtual ~CQTOpenGLOperationDrawSelected()
virtual QSize minimumSize() const
Called internally by Qt to know the minimum widget size.
void SelectEntity(CEntity &c_entity)
Selects the passed entity.
void DrawEntity(CPositionalEntity &c_entity)
Draws a positional entity.
CEntity * GetSelectedEntity()
Returns the currently selected entity, or NULL if none is selected.
virtual void mousePressEvent(QMouseEvent *pc_event)
void ExperimentDone()
Emitted when the experiment is finished.
void DrawBoundingBox(CEmbodiedEntity &c_entity)
Draws the bounding box of an embodied entity.
virtual void resizeEvent(QResizeEvent *pc_event)
void FastForwardExperiment()
Fast forwards the experiment.
void SetCameraFocalLength(double f_length)
Sets the focal length of the current camera.
virtual ~CQTOpenGLOperationDrawNormal()
void EntityDeselected(size_t un_index)
Emitted when an entity is deselected.
CRay3 RayFromWindowCoord(int n_x, int n_y)
Casts a ray from the given window coordinate.
virtual void mouseReleaseEvent(QMouseEvent *pc_event)
void KeyReleased(QKeyEvent *pc_event)
Handles key release events.
virtual void paintGL()
Logic for scene drawing.
virtual ~CQTOpenGLWidget()
Class destructor.
CVector3 GetWindowCoordInWorld(int n_x, int n_y)
Returns the position in the world corresponding to the given window coordinate.
The QTOpenGL user functions.
void DeselectEntity()
Deselects the currently selected entity.
virtual void keyPressEvent(QKeyEvent *pc_event)
signed int SInt32
32-bit signed integer.
void SelectInScene(UInt32 un_x, UInt32 un_y)
Selects the entity closest to the camera at the given screen coordinates.
virtual void timerEvent(QTimerEvent *pc_event)
virtual QSize sizeHint() const
Called internally by Qt to know the preferred widget size.
void StepExperiment()
Executes one experiment time step.
void ResetExperiment()
Resets the state of the experiment to its state right after initialization.
unsigned int UInt32
32-bit unsigned integer.
void SetDrawFrameEvery(int n_every)
When fast-forwarding, sets every how many steps a frame must be drawn.
void SetInvertMouse(bool b_InvertMouse)
Sets whether the mouse should be inverted when moving.
void PlayExperiment()
Plays the experiment.
CQTOpenGLUserFunctions & GetUserFunctions()
Returns a reference to the user functions.
CQTOpenGLCamera & GetCamera()
Returns a reference to the camera.
CQTOpenGLWidget(QWidget *pc_parent, CQTOpenGLMainWindow &c_main_window, CQTOpenGLUserFunctions &c_user_functions)
Class constructor.
virtual int heightForWidth(int w) const
Called internally by Qt to set the aspect ratio.
void EntitySelected(size_t un_index)
Emitted when an entity is selected.
An entity that contains a pointer to the user-defined controller.
void StepDone(int n_step)
Emitted whenever a time step has been executed.
Data regarding frame grabbing.
void DrawRays(CControllableEntity &c_entity)
Draws a ray.
virtual void mouseMoveEvent(QMouseEvent *pc_event)
void KeyPressed(QKeyEvent *pc_event)
Handles key press events.
SFrameGrabData & GetFrameGrabData()
Returns the current frame grabbing data.