3#include <nlohmann/json.hpp>
35 double screen_left_coord = -1.0;
36 double screen_right_coord = 1.0;
37 double screen_bottom_coord = -1.0;
38 double screen_top_coord = 1.0;
39 double focal_length = 1.0;
43 int screen_width_pixels = 1920;
44 int screen_height_pixels = 1080;
46 int color_channels = 256;
47 int rays_per_pixel = 4;
48 int max_recursion_depth = 32;
52 Camera(
double _screen_left_coord,
double _screen_right_coord,
double _screen_bottom_coord,
double _screen_top_coord,
54 const common::Vec3 &_world_up,
int _screen_width_pixels,
int _screen_height_pixels,
ViewType _view_type,
55 int _color_channels,
int _rays_per_pixel,
int _max_recursion_depth);
65 focal_length, origin, direction, world_up, screen_width_pixels, screen_height_pixels,
66 view_type, color_channels, rays_per_pixel, max_recursion_depth)
73 [[nodiscard]]
int get_screen_width_pixels()
const
75 return screen_width_pixels;
85 return screen_height_pixels;
95 return color_channels;
105 return rays_per_pixel;
115 return max_recursion_depth;
CameraBuilder & with_direction(const common::Vec3 &direction) &
Definition camera.cpp:78
CameraBuilder & with_screen_dimensions(int width, int height) &
Definition camera.cpp:59
CameraBuilder & with_virtual_screen_boundaries(double left, double top, double right, double bottom) &
Definition camera.cpp:90
CameraBuilder & with_color_channels(int color_channels) &
Definition camera.cpp:106
CameraBuilder & with_view_type(ViewType view_type) &
Definition camera.cpp:100
CameraBuilder & with_max_recursion_depth(int max_recursion_depth) &
Definition camera.cpp:118
CameraBuilder & with_origin(const common::Vec3 &origin) &
Definition camera.cpp:72
CameraBuilder & with_rays_per_pixel(int rays_per_pixel) &
Definition camera.cpp:112
Camera build() const
Definition camera.cpp:124
CameraBuilder & with_focal_length(double focal_length) &
Definition camera.cpp:66
CameraBuilder & with_world_up(const common::Vec3 &direction) &
Definition camera.cpp:84
int get_max_recursion_depth() const
Definition camera.h:113
int get_rays_per_pixel() const
Definition camera.h:103
NLOHMANN_DEFINE_TYPE_INTRUSIVE(Camera, screen_left_coord, screen_right_coord, screen_bottom_coord, screen_top_coord, focal_length, origin, direction, world_up, screen_width_pixels, screen_height_pixels, view_type, color_channels, rays_per_pixel, max_recursion_depth) int get_screen_width_pixels() const
Definition camera.h:64
Ray compute_ray_for_pixel(Pixel p) const
Definition camera.cpp:23
int get_screen_height_pixels() const
Definition camera.h:83
int get_color_channels() const
Definition camera.h:93
Definition raytracer.cpp:29
ViewType
Definition camera.h:9
@ ORTHOGRAPHIC
Definition camera.h:10
@ PERSPECTIVE
Definition camera.h:11
NLOHMANN_JSON_SERIALIZE_ENUM(ViewType, {{ViewType::ORTHOGRAPHIC, "orthographic"}, {ViewType::PERSPECTIVE, "perspective"}}) struct Ray
Definition camera.h:14
static const Vec3 ZERO
Definition vec3.h:23
int x
Definition camera.h:25
int y
Definition camera.h:26