aboutsummaryrefslogtreecommitdiffstats
path: root/src/camera.cpp
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2022-07-12 22:16:26 +0200
committerladevieq <ladevie.quentin@gmail.com>2022-07-12 22:16:40 +0200
commit715ab680e68f62a3a00777e81b18f8e64110058d (patch)
tree66f825e75c84cd28ceb3a8aba3ff715036ceb362 /src/camera.cpp
parent13acb0321b5f2ed392c94e1f7c64069d4242971a (diff)
Fix BVH & vec3 API
Diffstat (limited to 'src/camera.cpp')
-rw-r--r--src/camera.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/camera.cpp b/src/camera.cpp
index e9e5f60..6950fec 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -47,6 +47,10 @@ void camera::rotate_y(float theta) {
auto h = tan(deg_to_rad(fov) / 2.f);
auto viewport_height = 2.f * h;
+ auto viewport_width = viewport_height * aspect_ratio;
+
+ horizontal = focus_distance * viewport_width * right;
+ vertical = focus_distance * viewport_height * up;
vertical = focus_distance * viewport_height * up;
first_pixel = position - horizontal / 2.0 - vertical / 2.0 + focus_distance * forward;