-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCamera.h
73 lines (59 loc) · 1.35 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// Camera.h
//
// Camera class.
//
// Author: Jietong Chen
// Date: 5/2/2018
//
#ifndef _CAMERA_H_
#define _CAMERA_H_
#include <glm/glm.hpp>
#include <vector>
using namespace glm;
///
// A camera in 3D scene.
///
class Camera {
public:
// camera location in world space
vec3 position;
// lookat point location in world space
vec3 lookat;
// up vector
vec3 up;
// clipping window boundaries
float znear;
float zfar;
// field of view in degree
float fov;
// aspect ratio of clipping window
float aspect;
///
// Constructor
//
// @param position - camera location
// @param lookat - lookat point location
// @param fov - field of view
// @param aspect - aspect ratio
// @param near - near clipping plate
// @param far - far clipping plate
///
Camera( vec3 position = vec3( 0.0f ),
vec3 lookat = vec3( 0.0f, 0.0f, -1.0f ),
float fov = 45.0f, float aspect = 1.0f, float near = 1.0f,
float far = 100.0f );
///
// Get the viewing transformation matrix of the camera.
//
// @return the viewing transformation matrix
///
mat4 getViewMat();
///
// Get the projection matrix of the camera.
//
// @return the projection matrix
///
mat4 getProjectionMat();
};
#endif //_CAMERA_H_