-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCamera.h
More file actions
51 lines (40 loc) · 1.04 KB
/
Camera.h
File metadata and controls
51 lines (40 loc) · 1.04 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
#ifndef CAMERA_H
#define CAMERA_H
#include "Ray.h"
#include <vecmath.h>
#include <float.h>
#include <cmath>
class Camera
{
public:
//generate rays for each screen-space coordinate
virtual Ray generateRay( const Vector2f& point ) = 0 ;
virtual float getTMin() const = 0 ;
virtual ~Camera(){}
virtual float getFocalLength() const = 0;
virtual float getFStop() const = 0;
virtual int getSamples() const = 0;
protected:
Vector3f center;
Vector3f direction;
Vector3f up;
Vector3f horizontal;
};
class PerspectiveCamera: public Camera
{
public:
PerspectiveCamera(const Vector3f& center, const Vector3f& direction,const Vector3f& up , float angle, float fl=1, float fs=25, int s=4);
virtual Ray generateRay( const Vector2f& point);
virtual float getTMin() const {
return 0.0f;
}
virtual float getFocalLength() const { return focal_length; }
virtual float getFStop() const { return fstop; }
virtual int getSamples() const { return samples; };
private:
float angle;
float focal_length;
float fstop;
int samples;
};
#endif //CAMERA_H