-
Notifications
You must be signed in to change notification settings - Fork 0
/
Camera.hpp
57 lines (51 loc) · 1.26 KB
/
Camera.hpp
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
#ifndef CAMERA_HPP
#define CAMERA_HPP
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#endif
#ifdef __gnu_linux__
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#include "helpers.hpp"
#include "Transform.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
class Camera
{
private:
int oldMouseX;
int oldMouseY;
int screenWidth;
int screenHeight;
int mb; // keeps track of which mouse button is pressed
float far;
float near;
float mode;
float speed;
public:
// variables
glm::vec4 loc;
glm::vec4 focus;
glm::vec4 up;
glm::vec4 dir;
enum {CAM_ORBIT, CAM_FPS};
// functions
Camera();
void rot_mouse(int x, int y);
void rot_fps(int x, int y);
void update();
void storeMouseLoc(int x, int y, int button);
void storeScreenSize(int w, int h);
void toggleMode();
int getMode();
void mov_forward(float amount);
void mov_upward(float amount);
void mov_sideways(float amount);
void changeSpeed(float amount);
int getMouseButton();
glm::mat4 getModelview();
glm::mat4 getProjection();
};
#endif