Skip to content

Commit

Permalink
add interpolate option to volume (#3485)
Browse files Browse the repository at this point in the history
* add interpolate option to volume

* update news
  • Loading branch information
SimonDanisch authored Dec 18, 2023
1 parent 32f1753 commit 01d57f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions GLMakie/src/drawing_primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,14 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Volume)
)
return convert(Mat4f, m) * m2
end
interp = to_value(pop!(gl_attributes, :interpolate))
interp = interp ? :linear : :nearest
Tex(x) = Texture(x; minfilter=interp)
if haskey(gl_attributes, :intensity)
intensity = pop!(gl_attributes, :intensity)
return draw_volume(screen, intensity, gl_attributes)
return draw_volume(screen, Tex(intensity), gl_attributes)
else
return draw_volume(screen, plot[4], gl_attributes)
return draw_volume(screen, Tex(plot[4]), gl_attributes)
end
end
end
3 changes: 2 additions & 1 deletion MakieCore/src/basic_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ Available algorithms are:
- `algorithm::Union{Symbol, RaymarchAlgorithm} = :mip` sets the volume algorithm that is used.
- `isorange::Real = 0.05` sets the range of values picked up by the IsoValue algorithm.
- `isovalue = 0.5` sets the target value for the IsoValue algorithm.
- `interpolate::Bool = true` sets whether the volume data should be sampled with interpolation.
$(Base.Docs.doc(shading_attributes!))
Expand All @@ -205,7 +206,7 @@ $(Base.Docs.doc(MakieCore.generic_plot_attributes!))
algorithm = :mip,
isovalue = 0.5,
isorange = 0.05,

interpolate = true,
fxaa = true,
)
generic_plot_attributes!(attr)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- DataInspector Fixes: Fixed depth order, positional labels being in transformed space and `:inspector_clear` not getting called when moving from one plot to another. [#3454](https://github.com/MakieOrg/Makie.jl/pull/3454)
- Fixed bug in GLMakie where the update from a (i, j) sized GPU buffer to a (j, i) sized buffer would fail [#3456](https://github.com/MakieOrg/Makie.jl/pull/3456).
- Add `interpolate=true` to `volume(...)`, allowing to disable interpolation [#3485](https://github.com/MakieOrg/Makie.jl/pull/3485).

## 0.20.2

Expand Down

0 comments on commit 01d57f1

Please sign in to comment.