-
Notifications
You must be signed in to change notification settings - Fork 0
/
camera.h
executable file
·52 lines (43 loc) · 1.48 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
#ifndef CAMERA_H
#define CAMERA_H
#include <Eigen/Core>
#include <QtOpenGL>
class Camera
{
public:
Camera();
void setPerpective(double fovy, double aspect);
void setViewport(int width, int height);
void getViewport(int &width, int &height) const;
void setZClipping(double near, double far);
void getZClipping(double &near, double &far) const;
void applyProjection() const;
void applyViewport() const;
void applyLookAt() const;
void setDefault3D();
void translateEye(const Eigen::Vector3d &v);
void translateCenter(const Eigen::Vector3d &v);
void orbit(const Eigen::Matrix3d &M);
void orbitCenter(const Eigen::Matrix3d &M);
void getSpanningSet(Eigen::Vector3d &right, Eigen::Vector3d &up, Eigen::Vector3d ¢er);
const Eigen::Vector3d &getEye() const;
const Eigen::Vector3d &getCenter() const;
void setCenter(const Eigen::Vector3d ¢er);
void setEye(const Eigen::Vector3d &eye);
void setUp(const Eigen::Vector3d &up);
void project(const Eigen::Vector3d &pos, double &x, double &y);
void getPixelAt(const Eigen::Vector2d &pos, GLubyte *pixelbuf) const;
// Eigen::Vector3d getEye() const { return eye; }
// Eigen::Vector3d getCenter() const { return viewCenter_; }
private:
Eigen::Vector3d viewCenter_;
Eigen::Vector3d eye_;
Eigen::Vector3d up_;
double p_fovy_;
double p_aspect_;
double z_near_;
double z_far_;
double v_width_;
double v_height_;
};
#endif // CAMERA_H