-
Notifications
You must be signed in to change notification settings - Fork 0
/
Camera.hh
55 lines (40 loc) · 1.1 KB
/
Camera.hh
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
#ifndef Camera_hh
#define Camera_hh
#include "Vector.hh"
#include "Point.hh"
#include "Ray.hh"
class RenderContext;
class Camera
{
public:
virtual void Preprocess(float aspect) = 0;
virtual void GenerateRay(Ray& ray, const RenderContext& rc, float x, float y)const = 0;
virtual Point GetEye()=0;
};
class PinholeCamera : public Camera
{
private:
Point eye;
Point lat;
Vector up;
float fov;
Vector U, V, L;
public:
PinholeCamera(Point eye, Point lat, Vector up, float fov);
virtual Point GetEye();
virtual void Preprocess(float aspect);
virtual void GenerateRay(Ray& ray, const RenderContext& rc, float x, float y)const;
// wtf is this?
/*Ray rays[xres*yres];
float step = 2.f/(float)resx;
float xstart = -1.f + 0.5*step;
float ystart = -(float)resy*0.5 + 0.5*step;
for(int i=0; i<resx; i++){
for(int j=0; j<resy; j++){
rays[i+j*resx] = Ray(Point(eye),
(L + (xstart+i*step)*U + (ystart*j+step)*V).normal());
}
}*/
};
// Fisheye camera?
#endif