Repository navigation
Expand file tree
/
Copy pathcamera.h
More file actions
76 lines (51 loc) · 1.53 KB
/
Copy pathcamera.h
File metadata and controls
76 lines (51 loc) · 1.53 KB
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
71
72
73
74
75
76
#ifndef _CAMERA_H_
#define _CAMERA_H_
#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
#include <memory>
class FrameEventHandler;
class PerspectiveInfo {
public:
float fov;
float aspect;
float zNear;
float zFar;
PerspectiveInfo();
};
class CCamera{
private:
static std::shared_ptr<CCamera> current_attached_camera;
protected:
glm::mat4 _last_get_projection = glm::mat4(1.0);
glm::mat4 _last_get_modelview = glm::mat4(1.0);
glm::mat4 _last_get_mvp = glm::mat4(1.0);
virtual void setupControls();
PerspectiveInfo m_perspectiveInfo;
public:
double sensitivity = 5.0;
virtual glm::mat4 & GetProjection();
virtual glm::mat4 & GetModelView();
virtual glm::mat4 & GetMVP();
std::shared_ptr<FrameEventHandler> controller=nullptr;
virtual std::shared_ptr<FrameEventHandler> CreateController();
CCamera();
//static std::shared_ptr<CCamera> CreateFPSCamera();
};
typedef std::shared_ptr<CCamera> Camera;
class CFpsCamera :public CCamera {
private:
public:
glm::vec3 position = glm::vec3(0, 0, 0);
glm::vec3 up = glm::vec3(0, 1, 0);
float yall = 0;
float pitch = 0;
virtual glm::mat4 & GetModelView() override;
virtual std::shared_ptr<FrameEventHandler> CreateController() override;
};
typedef std::shared_ptr<CFpsCamera> FpsCamera;
namespace camera {
FpsCamera CreateFpsCamera();
}
#endif