-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCamera.h
executable file
·60 lines (43 loc) · 1.38 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
#pragma once
#include "glm/glm.hpp"
#include "glm/gtc/constants.hpp"
#include "glm/gtx/transform.hpp"
#include <algorithm>
namespace g3d{
class Camera{
float fov;
glm::vec3 vecUP, vecRight;
glm::vec3 look;
glm::vec3 position, targetPos;
glm::vec3 vecViewAngles;
glm::mat4 viewMatrix;
float moveAnimationPercentage, anglesAnimationPercentage;
float moveAnimationLength, viewAnglesAnimationLength;
glm::vec3 targetAnimationAngles, targetAnimationPosition;
glm::vec3 positionAnimationStart, anglesAnimationStart;
bool inAnglesAnimation, inMoveAnimation;
void update();
void normalizeAngles(glm::vec3 &angles);
public:
Camera();
glm::mat4 getViewMatrix();
glm::vec3 getUp();
glm::vec3 getRight();
glm::vec3 getLook();
glm::vec3 getPosition();
float getFov();
void setFov(float fov);
void setPosition(const glm::vec3& position);
void rotate(const glm::vec3 &viewAngles);
void move(const glm::vec3 &offset);
glm::vec3 getViewAngles();
void setViewAngles(const glm::vec3 &viewAngles);
bool isInAnimation();
void setMoveAnimationLength(float length);
void setViewAnglesAnimationLength(float length);
void movePositionAnimation(const glm::vec3 &finalPos);
void moveAnglesAnimation(const glm::vec3 &finalAngles);
void updateAnimation(float deltaTime);
};
extern Camera camera;
};