-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.h
More file actions
77 lines (66 loc) · 1.68 KB
/
Camera.h
File metadata and controls
77 lines (66 loc) · 1.68 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
67
68
69
70
71
72
73
74
75
76
77
#ifndef CAMERA_H
#define CAMERA_H
#ifdef __APPLE__ // if compiling on Mac OS
#include <GLUT/glut.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else // else compiling on Linux OS
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#include <cmath>
#include"Point.h"
#include"Direction.h"
#include<iostream>
class Camera : public Point, public Direction {
private:
//float x, y, z;
//float rho, theta, phi;
//float rho;
float upX, upY, upZ;
float carX, carY, carZ;
//float dirX, dirY, dirZ;
bool arcBall;
Direction upVec;
Point car;
public:
// Constructor
Camera() {
//x = y = z = 0;
//rho = theta = phi = 0;
//rho = 0;
//upX = upY = upZ = 0;
//carX = carY = carZ = 0;
//dirX = dirY = dirZ = 0;
arcBall = true;
};
// Getters
/*
float getX() { return x; }
float getY() { return y; }
float getZ() { return z; }
float getDirX() { return dirX; }
float getDirY() { return dirY; }
float getDirZ() { return dirZ; }
*/
//float getRho() { return rho; }
//float getTheta() { return theta; }
//float getPhi() { return phi; }
// Update camera orientation
void updateOrientation(float rho, float theta, float phi);
void updatePosition(float x, float y, float z, float dirX, float dirY, float dirZ);
// Update the car position
void updateCarPosition(float x, float y, float z);
void updateCarPosition(Point pos);
// Update camera up vector
void updateUpVector(float x, float y, float z);
void updateUpVector(Direction up);
// Switch camera modes
void enableFreeCam();
void enableArcBallCam();
bool arcBallEnabled() { return arcBall; }
// Setup camera look-at direction
void doLookAt();
};
#endif