This repository has been archived on 2023-01-29. You can view files and clone it, but cannot push or open issues or pull requests.

28 lines
504 B
C++

#ifndef CAMERA_H
#define CAMERA_H
#include "ray.h"
class camera
{
public:
camera()
{
lower_left_corner = vec3(-2.0, -1.0, -1.0);
horizontal = vec3(4.0, 0.0, 0.0);
vertical = vec3(0.0, 2.0, 0.0);
origin = vec3(0.0, 0.0, 0.0);
}
ray get_ray(float u, float v)
{
return ray(origin, lower_left_corner + u * horizontal + v * vertical - origin);
}
vec3 origin;
vec3 lower_left_corner;
vec3 horizontal;
vec3 vertical;
};
#endif