-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamera.h
53 lines (48 loc) · 1008 Bytes
/
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
#pragma once
#include "vector.h"
#include "defs.h"
// A class that represents a simple rectangular pinhole camera.
class Camera {
public:
void init(int w = 640, int h = 480);
Camera();
Ray getCameraRay(int x,int y);
float getRoll();
float getPitch();
float getYaw();
Vector getFront();
Vector getRight();
Vector getUp();
Vector getPos();
Vector getDir();
int getWidth();
int getHeight();
void zoomIn();
void zoomOut();
void rotateCamera(float, float, float);
void moveCameraAbsolute(const Vector &);
void moveCameraRelative(const Vector &);
void moveCameraGameLike(const Vector &);
void resetDefaults();
void lockCamera();
void unlockCamera();
bool isCameraLocked();
void switchCameraLock();
private:
int width;
int height;
float fov;
float aspect;
float roll;
float pitch;
float yaw;
float sensorWidth;
float sensorHeight;
Vector pos;
Vector cameraRight;
Vector cameraUp;
Vector cameraFront;
Vector sensorTopLeft;
Vector sensorTopRight;
Vector sensorBotLeft;
};