Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a00859_source.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a00859_source.php on line 2
The ARGoS Website

qtopengl_camera.h
Go to the documentation of this file.
1 
7 #ifndef QTOPENGL_CAMERA_H
8 #define QTOPENGL_CAMERA_H
9 
10 namespace argos {
11  class CQTOpenGLCamera;
12 }
13 
14 class QPoint;
15 
16 #include <QObject>
17 #include <argos3/core/utility/datatypes/datatypes.h>
18 #include <argos3/core/utility/math/ray3.h>
19 #include <argos3/core/utility/configuration/argos_configuration.h>
20 
21 #ifdef __APPLE__
22 #include <gl.h>
23 #include <glu.h>
24 #else
25 #include <GL/gl.h>
26 #include <GL/glu.h>
27 #endif
28 
29 namespace argos {
30 
31  class CQTOpenGLCamera : public QObject {
32 
33  Q_OBJECT
34 
35  public:
36 
37  struct SSettings {
56 
58  Position(-2.0f, 0.0f, 2.0f),
59  Left(CVector3::Y),
60  Up(CVector3(1.0f, 0.0f, 1.0f).Normalize()),
61  Forward(CVector3(1.0f, 0.0f, -1.0f).Normalize()),
62  Target(),
63  LensFocalLength(0.02f),
64  MotionSensitivity(0.005),
65  RotationSensitivity(0.01) {
67  }
68 
70  void Init(TConfigurationNode& t_tree);
72  void RotateUpDown(const CRadians& c_angle);
74  void RotateLeftRight(const CRadians& c_angle);
76  void RotateLeftRight2(const CRadians& c_angle);
78  void Translate(const CVector3& c_delta);
80  void Do();
82  void CalculateYFieldOfView();
84  void CalculateSensitivity();
85  };
86 
87  public:
88 
91 
92  void Init(TConfigurationNode& t_tree);
93 
94  inline void Look() {
95  m_sSettings[m_unActiveSettings].Do();
96  }
97 
98  inline const CVector3& GetPosition() const {
99  return m_sSettings[m_unActiveSettings].Position;
100  }
101 
102  inline const CVector3& GetTarget() const {
103  return m_sSettings[m_unActiveSettings].Target;
104  }
105 
106  inline Real GetLensFocalLength() const {
107  return m_sSettings[m_unActiveSettings].LensFocalLength;
108  }
109 
110  void Rotate(const QPoint& c_delta);
111 
112  void Move(SInt32 n_forwards_backwards,
113  SInt32 n_sideways,
114  SInt32 n_up_down);
115 
117  return m_sSettings[m_unActiveSettings];
118  }
119 
120  inline const SSettings& GetActiveSettings() const {
121  return m_sSettings[m_unActiveSettings];
122  }
123 
124  inline void SetActiveSettings(UInt32 un_settings) {
125  m_unActiveSettings = un_settings;
126  }
127 
128  inline SSettings& GetSetting(UInt32 n_index) {
129  return m_sSettings[n_index];
130  }
131 
132  private:
133 
134  UInt32 m_unActiveSettings;
135  SSettings m_sSettings[12];
136 
137  };
138 
139 }
140 
141 #endif
142 
signed int SInt32
32-bit signed integer.
Definition: datatypes.h:93
void Move(SInt32 n_forwards_backwards, SInt32 n_sideways, SInt32 n_up_down)
Real GetLensFocalLength() const
A 3D vector class.
Definition: vector3.h:29
void Init(TConfigurationNode &t_tree)
Initialize from XML.
void Init(TConfigurationNode &t_tree)
void RotateLeftRight(const CRadians &c_angle)
Rotation around the local Z axis.
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
const CVector3 & GetTarget() const
const CVector3 & GetPosition() const
void CalculateSensitivity()
Calculate the sensitivity of the camera.
CVector3 Up
The local Z axis of the camera in the global reference frame.
void RotateLeftRight2(const CRadians &c_angle)
Rotation around the global Z axis.
CVector3 Position
The position of the camera in the global reference frame.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
It defines the basic type CDegrees, used to store an angle value in degrees.
Definition: angles.h:288
It defines the basic type CRadians, used to store an angle value in radians.
Definition: angles.h:42
unsigned int UInt32
32-bit unsigned integer.
Definition: datatypes.h:97
void SetActiveSettings(UInt32 un_settings)
void Do()
Places this camera in the right position.
void Rotate(const QPoint &c_delta)
void Translate(const CVector3 &c_delta)
c_delta is expressed in the camera local coordinates
CVector3 Forward
The local X axis of the camera in the global reference frame.
SSettings & GetActiveSettings()
Real LensFocalLength
The focal length of the lens (if this was a real camera)
Real MotionSensitivity
Motion sensitivity.
const SSettings & GetActiveSettings() const
void RotateUpDown(const CRadians &c_angle)
Rotation around the local Y axis.
CVector3 Target
The direction of sight of the camera in the global reference frame.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
Real RotationSensitivity
Rotation sensitivity.
void CalculateYFieldOfView()
Calculates the value of YFieldOfView.
CDegrees YFieldOfView
The focal length of the camera.
CVector3 Left
The local Y axis of the camera in the global reference frame.
SSettings & GetSetting(UInt32 n_index)