-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcamera.h
executable file
·71 lines (51 loc) · 1.36 KB
/
camera.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once
#include <QObject>
#include <QVector3D>
struct CameraState {
CameraState(const QVector3D& position_, const QVector3D& rotation_,
double frontClippingDistance_, double farClippingDistance_)
: position(position_),
rotation(rotation_),
frontClippingDistance(frontClippingDistance_),
rearClippingDistance(farClippingDistance_)
{}
const QVector3D position;
const QVector3D rotation;
const double frontClippingDistance;
const double rearClippingDistance;
};
class Camera : public QObject
{
Q_OBJECT
public:
enum RotationSTEP {RK = 1};
Camera();
void forward();
void backward();
void left();
void right();
void up();
void down();
void setPosition(const QVector3D& position);
void rotate(int dx, int dy, int dz);
void setFrontCPDistance(double distance);
void setRearCPDistance(double distance);
CameraState state() const;
signals:
void changed(const CameraState& newState);
void xRotationChanged(int angle);
void yRotationChanged(int angle);
void zRotationChanged(int angle);
public slots:
void setXRotation(int angle);
void setYRotation(int angle);
void setZRotation(int angle);
private:
double _frontClippingPlaneDistance;
double _rearClippingDistance;
QVector3D _position;
int _xRotation;
int _yRotation;
int _zRotation;
void _notify() {emit changed(state());}
};