-
Notifications
You must be signed in to change notification settings - Fork 0
/
camera.h
56 lines (43 loc) · 1.36 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
//***************************************************************************
//
// Advanced CodeColony Camera
// Philipp Crocoll, 2003
//
//***************************************************************************
#include <gl\glut.h> // Need to include it here because the GL* types are required
#define PI 3.1415926535897932384626433832795
#define PIdiv180 (PI/180.0)
/////////////////////////////////
//Note: All angles in degrees //
/////////////////////////////////
struct SF3dVector //Float 3d-vect, normally used
{
GLfloat x,y,z;
};
struct SF2dVector
{
GLfloat x,y;
};
SF3dVector F3dVector ( GLfloat x, GLfloat y, GLfloat z );
class CCamera
{
private:
SF3dVector ViewDir;
SF3dVector RightVector;
SF3dVector UpVector;
SF3dVector Position;
GLfloat RotatedX, RotatedY, RotatedZ;
public:
CCamera(); //inits the values (Position: (0|0|0) Target: (0|0|-1) )
void Render ( void ); //executes some glRotates and a glTranslate command
//Note: You should call glLoadIdentity before using Render
void Reset();
void Move ( SF3dVector Direction );
void RotateX ( GLfloat Angle );
void RotateY ( GLfloat Angle );
void RotateZ ( GLfloat Angle );
SF3dVector GetPosition( void );
void MoveForward ( GLfloat Distance );
void MoveUpward ( GLfloat Distance );
void StrafeRight ( GLfloat Distance );
};