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);
198 return QSize(1024,768);
205 return QSize(320,240);
212 return m_cUserFunctions;
226 return m_sFrameGrabData;
233 m_bInvertMouse = b_invert_mouse;
240 m_bShowBoundary = b_show_boundary;
341 virtual void timerEvent(QTimerEvent* pc_event);
345 virtual void wheelEvent(QWheelEvent *pc_event);
361 bool m_bFastForwarding;
368 bool m_bMouseGrabbed;
370 bool m_bShiftPressed;
372 QPoint m_cMouseGrabPos;
384 bool m_bShowBoundary;
387 bool m_bUsingFloorTexture;
389 QOpenGLTexture* m_pcFloorTexture;
391 QOpenGLTexture* m_pcGroundTexture;
394 GLfloat* m_pfLightAmbient;
396 GLfloat* m_pfLightDiffuse;
398 GLfloat* m_pfLight0Position;
400 GLfloat* m_pfLight1Position;
423 QMap<EDirection, int> m_mapPressedKeys;
signed int SInt32
32-bit signed integer.
unsigned int UInt32
32-bit unsigned integer.
The namespace containing all the ARGoS related code.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
An entity that contains a pointer to the user-defined controller.
This entity is a link to a body in the physics engine.
The basic operation to be stored in the vtable.
The QTOpenGL user functions.
virtual ~CQTOpenGLOperationDrawNormal()
virtual ~CQTOpenGLOperationDrawSelected()
CEntity * GetSelectedEntity()
Returns the currently selected entity, or NULL if none is selected.
void StepExperiment()
Executes one experiment time step.
void SetShowBoundary(bool b_show_boundary)
Sets whether the boundary walls should be rendered.
CVector3 GetWindowCoordInWorld(int n_x, int n_y)
Returns the position in the world corresponding to the given window coordinate.
virtual void mouseReleaseEvent(QMouseEvent *pc_event)
virtual void wheelEvent(QWheelEvent *pc_event)
virtual QSize sizeHint() const
Called internally by Qt to know the preferred widget size.
void KeyPressed(QKeyEvent *pc_event)
Handles key press events.
CRay3 RayFromWindowCoord(int n_x, int n_y)
Casts a ray from the given window coordinate.
virtual ~CQTOpenGLWidget()
Class destructor.
void SelectEntity(CEntity &c_entity)
Selects the passed entity.
void KeyReleased(QKeyEvent *pc_event)
Handles key release events.
void SetCameraFocalLength(double f_length)
Sets the focal length of the current camera.
void FastForwardExperiment()
Fast forwards the experiment.
CQTOpenGLUserFunctions & GetUserFunctions()
Returns a reference to the user functions.
void EntitySelected(CEntity *pc_entity)
Emitted when an entity is selected.
virtual QSize minimumSize() const
Called internally by Qt to know the minimum widget size.
void DrawRays(CControllableEntity &c_entity)
Draws a ray.
void PlayExperiment()
Plays the experiment.
void ResetExperiment()
Resets the state of the experiment to its state right after initialization.
virtual void mouseMoveEvent(QMouseEvent *pc_event)
void EntityDeselected(CEntity *pc_entity)
Emitted when an entity is deselected.
void DrawEntity(CPositionalEntity &c_entity)
Draws a positional entity.
void DeselectEntity()
Deselects the currently selected entity.
void SetGrabFrame(bool b_grab_on)
Toggles frame grabbing.
CQTOpenGLCamera & GetCamera()
Returns a reference to the camera.
void SetInvertMouse(bool b_invert_mouse)
Sets whether the mouse should be inverted when moving.
virtual void keyReleaseEvent(QKeyEvent *pc_event)
SFrameGrabData & GetFrameGrabData()
Returns the current frame grabbing data.
void DrawBoundingBox(CEmbodiedEntity &c_entity)
Draws the bounding box of an embodied entity.
virtual void keyPressEvent(QKeyEvent *pc_event)
void SetDrawFrameEvery(int n_every)
When fast-forwarding, sets every how many steps a frame must be drawn.
void SelectInScene(UInt32 un_x, UInt32 un_y)
Selects the entity closest to the camera at the given screen coordinates.
virtual void paintGL()
Logic for scene drawing.
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 ExperimentDone()
Emitted when the experiment is finished.
virtual void initializeGL()
Called when the GL context must be initialized.
virtual void mousePressEvent(QMouseEvent *pc_event)
void PauseExperiment()
Pauses the experiment.
virtual void resizeEvent(QResizeEvent *pc_event)
void StepDone(int n_step)
Emitted whenever a time step has been executed.
void SetCamera(int n_camera)
Sets the current camera in use.
virtual void timerEvent(QTimerEvent *pc_event)
Data regarding frame grabbing.
void Init(TConfigurationNode &t_tree)
Data arelated to robot selection.