@@ -13,11 +13,14 @@ fn @compute_scale_from_vfov(fov: f32, aspect: f32) -> Vec2 {
1313}
1414
1515// Creates a perspective camera
16- fn @make_perspective_camera(eye: Vec3, dir: Vec3, up: Vec3, scale: Vec2, tmin: f32, tmax: f32) -> Camera {
16+ fn @make_perspective_camera(eye: Vec3, dir: Vec3, up: Vec3, scale: Vec2, tmin: f32, angle: f32, tmax: f32) -> Camera {
1717 let right = vec3_normalize(vec3_cross(dir, up));
1818 let view = make_mat3x3(right, up, dir);
1919
2020 Camera {
21+ near = tmin,
22+ far = tmax,
23+ fov = angle,
2124 generate_ray = @ |_, x, y| {
2225 let d = vec3_normalize(mat3x3_mul(view, make_vec3(scale.x * x, scale.y * y, 1)));
2326 make_ray(eye, d, tmin, tmax, ray_flag_camera)
@@ -37,6 +40,9 @@ fn @make_perspective_dof_camera(eye: Vec3, dir: Vec3, up: Vec3, scale: Vec2, ape
3740 let view = make_mat3x3(right, up, dir);
3841
3942 Camera {
43+ near = tmin,
44+ far = tmax,
45+ fov = 0,
4046 generate_ray = @ |rnd, x, y| {
4147 let global_dir = vec3_normalize(mat3x3_mul(view, make_vec3(scale.x * x, scale.y * y, 1)));
4248 let focus_pos = vec3_mulf(global_dir, focal_length);
0 commit comments