Point Cloud Viewer  1.00
A Viewer to display point clouds with phong shading by converting them to splats.
camera.h
1 #ifndef CAMERA_H
2 #define CAMERA_H
3 
4 #include "entity.h"
5 
6 #include <QMatrix4x4>
7 
13 class Camera : public Entity
14 {
15 public:
21  Camera();
22  ~Camera();
23 
31  void activatePerspective(float aspect = 1.0f, float fovy = 90.0f, float zNear = 0.1f, float zFar = 100.0f);
32 
40  void activateOrthographic(float aspect = 1.0f, float yWidth = 2.0f, float zNear = 0.1f, float zFar = 100.0f);
41  void setPos(QVector3D &pos) override;
42  void setPos(float x, float y, float z) override;
43 
50  void setTarget(QVector3D &target);
51 
58  QMatrix4x4 &getVpMat();
59 
66  QMatrix4x4 &getVMat();
67 
74  QMatrix4x4 &getInvProjMat();
75 
83  void rotate(float deg_x, float deg_y);
84 
92  void move(float up, float right);
93 
101  float &getPointSizeCoeff();
102 
111  QVector3D getViewDependentMoveVector(float up, float right);
112 
117  QVector3D getViewTarget();
118 private:
119  QMatrix4x4 viewMat, projectionMat, vpMat, invProjMat;
120  QVector3D viewTarget;
121  float pointSizeCoeff;
122 
123  void updateViewMat();
124  void updateVpMat();
125  void getAngles(float &hor, float &vert, float *viewVecLength = 0);
126 };
127 
128 #endif // CAMERA_H
QVector3D getViewTarget()
Returns the location of the camera's view target.
Definition: camera.cpp:132
float z
The z coordinate of the entity's location.
Definition: entity.h:13
void rotate(float deg_x, float deg_y)
Rotates the camera.
Definition: camera.cpp:35
QMatrix4x4 & getVMat()
Returns a link to the view matrix.
Definition: camera.cpp:69
void setTarget(QVector3D &target)
Changes the view target location.
Definition: camera.cpp:60
float & getPointSizeCoeff()
Returns a pointer to the pointSizeCoeff.
Definition: camera.cpp:51
void move(float up, float right)
Moves the camera.
Definition: camera.cpp:96
void setPos(QVector3D &pos) override
Changes the entity's location.
Definition: camera.cpp:30
This class provides camera functionality.
Definition: camera.h:13
float y
The y coordinate of the entity's location.
Definition: entity.h:12
An element with a location in 3-dimensional space.
Definition: entity.h:9
Camera()
Creates a new camera.
Definition: camera.cpp:6
void activateOrthographic(float aspect=1.0f, float yWidth=2.0f, float zNear=0.1f, float zFar=100.0f)
Switches the camera into orthographic mode. NOT SUPPORTED!
Definition: camera.cpp:22
float x
The x coordinate of the entity's location.
Definition: entity.h:11
QVector3D getViewDependentMoveVector(float up, float right)
Transforms a vector from view space to world space.
Definition: camera.cpp:118
QMatrix4x4 & getInvProjMat()
Returns a link to the inverse projection matrix.
Definition: camera.cpp:73
void activatePerspective(float aspect=1.0f, float fovy=90.0f, float zNear=0.1f, float zFar=100.0f)
Switches the camera into perspective mode.
Definition: camera.cpp:13
QMatrix4x4 & getVpMat()
Returns a link to the view projection matrix.
Definition: camera.cpp:65