- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.h
More file actions
Latest commit
66 lines (46 loc) · 1.54 KB
/
Copy pathCamera.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
usingnamespacestd;
// handles the camera movement (per keyboard and mouse)
classCamera {
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; }
voidsetPosition(CVector3 pos_){ position = pos_; }
voidsetView(CVector3 view_){ view = view_; }
voidsetUpVector(CVector3 up_){ upVector = up_; }
voidrotateView(float angle, float X, float Y, float Z);
voidapplyMouseLook();
voidapplyKeyboardMovements();
voidstrafeCamera(float speed);
voidmoveCamera(float speed);
voidupdate();
private:
voidinit();
CVector3 position;
CVector3 view;
CVector3 upVector;
CVector3 strafe;
int cameraDirectionIsTooSmall; // for error handling
};
#endif