From 715ab680e68f62a3a00777e81b18f8e64110058d Mon Sep 17 00:00:00 2001 From: ladevieq Date: Tue, 12 Jul 2022 22:16:26 +0200 Subject: Fix BVH & vec3 API --- src/camera.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/camera.cpp') 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; -- cgit v1.3