Skip to content

Commit

Permalink
Tweak Camera3D clipping (#3433)
Browse files Browse the repository at this point in the history
* tweak clipping behaviour

* update news [skip ci]

---------

Co-authored-by: Simon <sdanisch@protonmail.com>
  • Loading branch information
ffreyer and SimonDanisch authored Dec 1, 2023
1 parent 52c46cc commit 0919de0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

## master

- Fixed a bug with h/vlines and h/vspan not correctly resolving transformations [#3418](https://github.com/MakieOrg/Makie.jl/pull/3418)
- Fixed a bug with h/vlines and h/vspan returning the wrong limits, causing an error in Axis [#3427](https://github.com/MakieOrg/Makie.jl/pull/3427)
- Fixed a bug with h/vlines and h/vspan not correctly resolving transformations [#3418](https://github.com/MakieOrg/Makie.jl/pull/3418).
- Fixed a bug with h/vlines and h/vspan returning the wrong limits, causing an error in Axis [#3427](https://github.com/MakieOrg/Makie.jl/pull/3427).
- Fixed clipping when zooming out of a 3D (L)Scene [#3433](https://github.com/MakieOrg/Makie.jl/pull/3433).

## 0.20.1

Expand Down
4 changes: 2 additions & 2 deletions src/camera/camera3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ function update_cam!(scene::Scene, cam::Camera3D)
far = far_dist * far
elseif cam.settings.clipping_mode[] === :adaptive
view_dist = norm(eyeposition - lookat)
near = view_dist * near; far = far
near = view_dist * near; far = max(1f0, view_dist) * far
elseif cam.settings.clipping_mode[] !== :static
@error "clipping_mode = $(cam.settings.clipping_mode[]) not recognized, using :static."
end
Expand Down Expand Up @@ -775,7 +775,7 @@ function update_cam!(scene::Scene, cam::Camera3D, area3d::Rect, recenter::Bool =
cam.far[] = 2f0 * dist
elseif cam.settings.clipping_mode[] === :adaptive
cam.near[] = 0.1f0 * dist / norm(cam.eyeposition[] - cam.lookat[])
cam.far[] = 2f0 * dist
cam.far[] = 2.2f0 * dist / norm(cam.eyeposition[] - cam.lookat[])
end

update_cam!(scene, cam)
Expand Down

0 comments on commit 0919de0

Please sign in to comment.