-
Notifications
You must be signed in to change notification settings - Fork 1
/
camera.h
46 lines (28 loc) · 1.06 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
#ifndef CAMERA_H_
#define CAMERA_H_
#include <iostream>
#include <iomanip>
#include <glm/glm.hpp>
#include "onb.h"
#include "ray.h"
class Camera
{
public:
Camera( void );
Camera( const glm::ivec2 &resolution,
const glm::vec3 &position,
const glm::vec3 &up,
const glm::vec3 &look_at );
virtual ~Camera( void );
void setPosition( const glm::vec3 &position );
void setUp( const glm::vec3 &up );
void setLookAt( const glm::vec3 &look_at );
virtual Ray getWorldSpaceRay( const glm::vec2 &pixel_coord ) const = 0;
glm::ivec2 resolution_;
glm::vec3 up_{ 0.0f, 1.0f, 0.0f }; // up vector (usually equal to universe Y axis: [0, 1, 0]).
glm::vec3 look_at_{ 0.0f, 0.0f, -1.0f }; // point the camera is looking at.
glm::vec3 position_{ 0.0f, 0.0f, 0.0f }; // position of the camera in the universe space.
glm::vec3 direction_{ 0.0f, 0.0f, -1.0f }; // direction the camera is looking.
ONB onb_; // orthonormal RHS basis
};
#endif /* CAMERA_H_ */