Skip to content

Commit

Permalink
Fix calculation of focal length for RPRMakie (#3494)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel authored Dec 20, 2023
1 parent e3d834d commit ada44a2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions RPRMakie/src/scene.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ function update_rpr_camera!(oldvals, camera, cam_controls, cam)
c = cam_controls
l, u, p, fov = c.lookat[], c.upvector[], c.eyeposition[], c.fov[]
far, near, res = c.far[], c.near[], cam.resolution[]
fov = 45f0 # The current camera ignores fov updates
new_vals = (; l, u, p, fov, far, near, res)
new_vals == oldvals && return oldvals
wd = norm(l - p)
Expand All @@ -14,8 +13,8 @@ function update_rpr_camera!(oldvals, camera, cam_controls, cam)
lookat!(camera, p, l, u)
RPR.rprCameraSetFarPlane(camera, far)
RPR.rprCameraSetNearPlane(camera, near)
h = norm(res)
RPR.rprCameraSetFocalLength(camera, (30*h)/fov)
focal_length = res[2] / (2 * tand(fov / 2)) # fov is vertical
RPR.rprCameraSetFocalLength(camera, focal_length)
# RPR_CAMERA_FSTOP
# RPR_CAMERA_MODE
return new_vals
Expand Down

0 comments on commit ada44a2

Please sign in to comment.