src/glcamera.h

changeset 1130
17f92eb2a30c
parent 1129
2b20261dc511
child 1134
daa9808d626e
equal deleted inserted replaced
1129:2b20261dc511 1130:17f92eb2a30c
17 */ 17 */
18 18
19 #pragma once 19 #pragma once
20 #include "main.h" 20 #include "main.h"
21 21
22 struct FixedCameraParameters
23 {
24 int glRotateX;
25 int glRotateY;
26 int glRotateZ;
27 Axis localX;
28 Axis localY;
29 bool negatedX;
30 bool negatedY;
31 bool negatedZ;
32 };
33
22 /* 34 /*
23 * Models a 2D x/y co-ordinate system that maps to a fixed camera position. 35 * Models a 2D x/y co-ordinate system that maps to a fixed camera position.
24 * Owns camera orientation information and provides 2Dā†ā†’3D translation. 36 * Owns camera orientation information and provides 2Dā†ā†’3D translation.
25 */ 37 */
26 class GLCamera : public QObject 38 class GLCamera : public QObject
29 41
30 public: 42 public:
31 // This is used to construct the free camera 43 // This is used to construct the free camera
32 enum FreeToken { FreeCamera }; 44 enum FreeToken { FreeCamera };
33 45
34 GLCamera(int glRotateX, int glRotateY, int glRotateZ, Axis localX, Axis localY, bool negatedX, bool negatedY, bool negatedDepth); 46 GLCamera(QString name, FixedCameraParameters&& bag);
35 GLCamera(FreeToken); 47 GLCamera(QString name, FreeToken);
36 48
37 Axis axisX() const; 49 Axis axisX() const;
38 Axis axisY() const; 50 Axis axisY() const;
39 Axis axisZ() const; 51 Axis axisZ() const;
52 Vertex convert2dTo3d(const QPoint& pos2d, Grid* grid = nullptr) const;
53 QPoint convert3dTo2d(const Vertex& pos3d) const;
40 double depth() const; 54 double depth() const;
41 int glRotate(Axis axis) const; 55 int glRotate(Axis axis) const;
42 bool isAxisNegated(Axis axis) const; 56 bool isAxisNegated(Axis axis) const;
43 Q_SLOT void rendererResized(int width, int height); 57 const QString& name() const;
44 const QSizeF& virtualSize() const; 58 void pan(int xMove, int yMove);
45 Vertex convert2dTo3d(const QPoint& pos2d, Grid* grid = nullptr) const;
46 QPoint convert3dTo2d(const Vertex& pos3d) const;
47 double panningX() const; 59 double panningX() const;
48 double panningY() const; 60 double panningY() const;
61 Q_SLOT void rendererResized(int width, int height);
62 void setPanning(double x, double y);
63 void setZoom(double zoom);
64 const QSizeF& virtualSize() const;
49 double zoom() const; 65 double zoom() const;
50 void setPanning(double x, double y);
51 void pan(int xMove, int yMove);
52 void zoomNotch(bool inward); 66 void zoomNotch(bool inward);
53 void setZoom(double zoom);
54 67
55 private: 68 private:
69 QString m_name;
56 double m_panningX = 0; 70 double m_panningX = 0;
57 double m_panningY = 0; 71 double m_panningY = 0;
58 double m_depth = 0; 72 double m_depth = 0;
59 double m_zoom = 30; 73 double m_zoom = 30;
60 QSize m_size; 74 QSize m_size;

mercurial