Add enviromental samples per pixel

This commit is contained in:
Phireh 2021-08-21 18:26:22 +02:00
commit f622a55c5c
4 changed files with 93 additions and 20 deletions

36
camera.hpp Normal file
View file

@ -0,0 +1,36 @@
#ifndef CAMERA_H
#define CAMERA_H
#include "rtweekend.hpp"
struct camera {
/* Attributes */
point3 origin;
point3 lower_left_corner;
vec3 horizontal;
vec3 vertical;
/* Constructors */
camera()
{
double aspect_ratio = 16.0 / 9;
double viewport_height = 2.0;
double viewport_width = aspect_ratio * viewport_height;
double focal_length = 1.0;
origin = vec3(0,0,0);
horizontal = vec3(viewport_width, 0, 0);
vertical = vec3(0, viewport_height, 0);
lower_left_corner = origin - horizontal/2 - vertical/2 - vec3(0, 0, focal_length);
}
/* Methods */
ray get_ray(double u, double v) const
{
return ray(origin, lower_left_corner + u*horizontal + v*vertical - origin);
};
};
#endif