-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.h
More file actions
66 lines (46 loc) · 1.54 KB
/
Camera.h
File metadata and controls
66 lines (46 loc) · 1.54 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
#ifndef _CAMERA_H
#define _CAMERA_H
// class based on www.gametutorials.com - see license.txt
#include "CVector3.h"
#include "Engine.h"
#include "WindowsHelper.h"
#include <iostream>
#ifdef __APPLE__
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#endif
using namespace std;
// handles the camera movement (per keyboard and mouse)
class Camera {
public:
Camera();
~Camera();
finline CVector3 getPosition() { return position; }
finline CVector3 getView() { return view; }
finline CVector3 getUpVector() { return upVector; }
CVector3 getDirectionNormalized();
CVector3 getMinusDirectionNormalized();
finline CVector3 getStrafe() { return strafe; }
finline CVector3* getPositionPointer() { return &position; }
finline CVector3* getViewPointer() { return &view; }
finline CVector3* getStrafePointer() { return &strafe; }
finline CVector3* getUpVectorPointer() { return &upVector; }
void setPosition(CVector3 pos_){ position = pos_; }
void setView(CVector3 view_){ view = view_; }
void setUpVector(CVector3 up_){ upVector = up_; }
void rotateView(float angle, float X, float Y, float Z);
void applyMouseLook();
void applyKeyboardMovements();
void strafeCamera(float speed);
void moveCamera(float speed);
void update();
private:
void init();
CVector3 position;
CVector3 view;
CVector3 upVector;
CVector3 strafe;
int cameraDirectionIsTooSmall; // for error handling
};
#endif