-
Notifications
You must be signed in to change notification settings - Fork 1
/
camera.h
46 lines (38 loc) · 1.16 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
#ifndef _CAMERA_H_
#define _CAMERA_H_
#include "vector3D.h"
#include "color.h"
class Camera
{
private:
Vector3D position;
Vector3D target; //Look-at point
Vector3D up;
Vector3D line_of_sight;
Vector3D u, v, w; //Camera basis vectors
unsigned char *bitmap;
unsigned int width, height;
float fovy;// expressed in degrees: FOV-Y; angular extent of the height of the image plane
float focalDistance; //Distance from camera center to the image plane
float focalWidth, focalHeight;//width and height of focal plane
float aspect;
int steps;
public:
Camera(const Vector3D& _pos, const Vector3D& _target, const Vector3D& _up, float fovy, int w, int h);
~Camera();
const Vector3D get_ray_direction(const float i, const float j) const;
const Vector3D& get_position() const { return position; }
void drawPixel(int i, int j, Color c);
unsigned char * getBitmap() {return bitmap; }
unsigned int getWidth() {return width;}
unsigned int getHeight(){return height;}
void incSteps(){ steps++; }
void resetSteps(){ steps=0; }
int getSteps() const {
return steps;
}
const Vector3D &getU() const;
const Vector3D &getV() const;
const Vector3D &getW() const;
};
#endif