src/glcamera.h

changeset 1151
0eddb5bcf25b
parent 1140
c5791a3aa1ba
child 1159
6ad8cdcd88d9
equal deleted inserted replaced
1150:262345e53050 1151:0eddb5bcf25b
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #pragma once 19 #pragma once
20 #include "main.h" 20 #include "main.h"
21 #include "glShared.h"
21 22
22 struct FixedCameraParameters 23 struct FixedCameraParameters
23 { 24 {
24 int glRotateX; 25 GLRotationMatrix rotationMatrix;
25 int glRotateY;
26 int glRotateZ;
27 Axis localX; 26 Axis localX;
28 Axis localY; 27 Axis localY;
29 bool negatedX; 28 bool negatedX;
30 bool negatedY; 29 bool negatedY;
31 bool negatedZ; 30 bool negatedZ;
50 Axis axisY() const; 49 Axis axisY() const;
51 Axis axisZ() const; 50 Axis axisZ() const;
52 Vertex convert2dTo3d(const QPoint& pos2d, Grid* grid = nullptr) const; 51 Vertex convert2dTo3d(const QPoint& pos2d, Grid* grid = nullptr) const;
53 QPoint convert3dTo2d(const Vertex& pos3d) const; 52 QPoint convert3dTo2d(const Vertex& pos3d) const;
54 double depth() const; 53 double depth() const;
55 int glRotate(Axis axis) const;
56 bool isAxisNegated(Axis axis) const; 54 bool isAxisNegated(Axis axis) const;
57 const QString& name() const; 55 const QString& name() const;
58 void pan(int xMove, int yMove); 56 void pan(int xMove, int yMove);
59 double panningX() const; 57 double panningX() const;
60 double panningY() const; 58 double panningY() const;
61 Q_SLOT void rendererResized(int width, int height); 59 Q_SLOT void rendererResized(int width, int height);
62 void setPanning(double x, double y); 60 void setPanning(double x, double y);
63 void setZoom(double zoom); 61 void setZoom(double zoom);
64 Matrix transformationMatrix(double scale) const; 62 const GLRotationMatrix& transformationMatrix() const;
63 GLRotationMatrix transformationMatrix(double scale) const;
65 const QSizeF& virtualSize() const; 64 const QSizeF& virtualSize() const;
66 double zoom() const; 65 double zoom() const;
67 void zoomNotch(bool inward); 66 void zoomNotch(bool inward);
68 67
69 private: 68 private:
72 double m_panningY = 0; 71 double m_panningY = 0;
73 double m_depth = 0; 72 double m_depth = 0;
74 double m_zoom = 30; 73 double m_zoom = 30;
75 QSize m_size; 74 QSize m_size;
76 QSizeF m_virtualSize; 75 QSizeF m_virtualSize;
77 int m_glrotate[3] = {0, 0, 0}; // GL model transformation to use 76 GLRotationMatrix m_rotationMatrix;
78 Axis m_localX = X; // Which axis to use for Y 77 Axis m_localX = X; // Which axis to use for Y
79 Axis m_localY = Y; // Which axis to use for Y 78 Axis m_localY = Y; // Which axis to use for Y
80 bool m_isFree = false; // Is this the free camera? 79 bool m_isFree = false; // Is this the free camera?
81 bool m_negatedX = false; // Is +x to the left? 80 bool m_negatedX = false; // Is +x to the left?
82 bool m_negatedY = false; // Is +y downwards? 81 bool m_negatedY = false; // Is +y downwards?

mercurial