-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera.cpp
More file actions
58 lines (47 loc) · 1.14 KB
/
Copy pathcamera.cpp
File metadata and controls
58 lines (47 loc) · 1.14 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
#include "camera.h"
#ifndef WIN32
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#endif
Camera::Camera(){
position.x = 59;
position.y = 10;
position.z = 59;
gCameraRotation[0] = 0.f;
gCameraRotation[1] = 90.f;
gCameraRotation[2] = 0.f;
};
Camera::Camera(Point3d startPos) : position(startPos) {};
Point3d Camera::GetLocation() const
{
return position;
};
void Camera::SetLocation(Point3d pos)
{
position = pos;
};
void Camera::GetOrientation(){};
void Camera::Move(float x, float y, float z)
{
position.x += x;
position.y = y;
position.z += z;
};
void Camera::Display()
{
// Clear the GL buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
//glPushMatrix();
// gluLookAt(0.0, 0.0, -10.0, 0, 0.0, 0, 0.0, 1.0, 0.0);
// Rotate to the Camera Rotation angle
glRotatef(gCameraRotation[ROTATE_PITCH], 1.f, 0.f, 0.f);
glRotatef(gCameraRotation[ROTATE_YAW], 0.f, 1.f, 0.f);
// Move to the Camera Position
glTranslatef(-position.x, -position.y , -position.z);
};