-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamera.cpp
50 lines (36 loc) · 1.09 KB
/
camera.cpp
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
////////////////////////////////////////
// camera.cpp
////////////////////////////////////////
#include "camera.h"
////////////////////////////////////////////////////////////////////////////////
Camera::Camera() {
Reset();
}
////////////////////////////////////////////////////////////////////////////////
void Camera::Update() {
}
////////////////////////////////////////////////////////////////////////////////
void Camera::Reset() {
FOV=60.0f;
Aspect=1.33f;
NearClip=0.1f;
FarClip=100.0f;
Distance=5.0f;
Azimuth=0.0f;
Incline=0.0f;
}
////////////////////////////////////////////////////////////////////////////////
void Camera::Draw() {
// Tell GL we are going to adjust the projection matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set perspective projection
gluPerspective(FOV,Aspect,NearClip,FarClip);
// Place camera
glTranslatef(0,0,-Distance);
glRotatef(Incline,1.0f,0.0f,0.0f);
glRotatef(Azimuth,0.0f,1.0f,0.0f);
// Return to modelview matrix mode
glMatrixMode(GL_MODELVIEW);
}
////////////////////////////////////////////////////////////////////////////////