-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.h
More file actions
58 lines (45 loc) · 1.38 KB
/
Camera.h
File metadata and controls
58 lines (45 loc) · 1.38 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
#pragma once
#include <vector>
#include <glm/glm.hpp>
#include "engine/Tickable.h"
class Camera : public Tickable
{
protected:
glm::vec3 _target{};
glm::vec3 _angles{};
float _distance{ 0 };
glm::vec3* _tracking{};
glm::vec3 position{};
bool _swapYZ;
bool _firstPerson;
public:
Camera(const Camera& c) = default;
explicit Camera(glm::vec3 target = glm::vec3(0), glm::vec3 angles = glm::vec3(0), float distance = 10);
virtual ~Camera() override;
glm::vec3 Position() const;
inline const glm::vec3& Target() const { return _target; }
inline const glm::vec3& Angles() const { return _angles; }
inline float Distance() const { return _distance; }
inline bool SwapYZ() const { return _swapYZ; }
inline bool FirstPerson() const { return _firstPerson; }
void Target(const glm::vec3& target);
void Angles(const glm::vec3& angles);
void Distance(float distance);
void SwapYZ(bool swapYZ);
void FirstPerson(bool firstPerson);
void Set(
const glm::vec3& target,
const glm::vec3& angles,
float distance
);
inline glm::vec3& GetTarget() { return _target; }
inline glm::vec3& GetAngles() { return _angles; }
inline float& GetDistance() { return _distance; }
inline bool& GetSwapYZ() { return _swapYZ; }
void Update();
bool Locked = false;
void Target(glm::vec3* target);
bool Tick(float dt) override;
void Draw(float dt) override;
};
extern std::shared_ptr<Camera> MainCamera;