Skip to content

Commit

Permalink
Merge branch 'master' into fix_boxplot_width
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch authored Oct 16, 2024
2 parents 20fd00a + 833be1d commit efaacb6
Show file tree
Hide file tree
Showing 45 changed files with 916 additions and 143 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
## [Unreleased]

- Allow `width` to be set per box in `boxplot` [#4447](https://github.com/MakieOrg/Makie.jl/pull/4447).
- Changed image, heatmap and surface picking indices to correctly index the relevant matrix arguments. [#4459](https://github.com/MakieOrg/Makie.jl/pull/4459)
- Improved performance of `record` by avoiding unnecessary copying in common cases [#4475](https://github.com/MakieOrg/Makie.jl/pull/4475).
- Fix usage of `AggMean()` and other aggregations operating on 3d data for `datashader` [#4346](https://github.com/MakieOrg/Makie.jl/pull/4346).
- Fixed `pick(scene, rect2)` in WGLMakie [#4488](https://github.com/MakieOrg/Makie.jl/pull/4488)

## [0.21.14] - 2024-10-11

Expand Down Expand Up @@ -49,7 +52,7 @@
- `plotfunc()` and `func2type()` support functions ending with `!` [#4275](https://github.com/MakieOrg/Makie.jl/pull/4275).
- Fixed Boundserror in clipped multicolor lines in CairoMakie [#4313](https://github.com/MakieOrg/Makie.jl/pull/4313)
- Fix float precision based assertions error in GLMakie.volume [#4311](https://github.com/MakieOrg/Makie.jl/pull/4311)
- Support images with reversed axes [#4338](https://github.com/MakieOrg/Makie.jl/pull/4338)
- Support images with reversed axes [#4338](https://github.com/MakieOrg/Makie.jl/pull/4338)

## [0.21.9] - 2024-08-27

Expand Down
3 changes: 2 additions & 1 deletion CairoMakie/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ excludes = Set([
"Textured meshscatter", # not yet implemented
"Voxel - texture mapping", # not yet implemented
"Miter Joints for line rendering", # CairoMakie does not show overlap here
"Scatter with FastPixel" # almost works, but scatter + markerspace=:data seems broken for 3D
"Scatter with FastPixel", # almost works, but scatter + markerspace=:data seems broken for 3D
"picking", # Not implemented
])

functions = [:volume, :volume!, :uv_mesh]
Expand Down
2 changes: 1 addition & 1 deletion GLMakie/assets/shader/heatmap.frag
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ vec4 get_color(sampler2D intensity, vec2 uv, vec2 color_norm, sampler1D color_ma

void main(){
vec4 color = get_color(intensity, o_uv, color_norm, color_map);
write2framebuffer(color, uvec2(o_objectid.x, 0));
write2framebuffer(color, uvec2(o_objectid.x, o_objectid.y));
}
2 changes: 1 addition & 1 deletion GLMakie/assets/shader/heatmap.vert
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void main(){
vec2 index01 = vec2(index2D) / (vec2(dims)-1.0);

o_uv = vec2(index01.x, 1.0 - index01.y);
o_objectid = uvec2(objectid, index1D+1);
o_objectid = uvec2(objectid, 1 + index);

float x = texelFetch(position_x, index2D.x, 0).x;
float y = texelFetch(position_y, index2D.y, 0).x;
Expand Down
11 changes: 11 additions & 0 deletions GLMakie/assets/shader/mesh.frag
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ struct Nothing{ //Nothing type, to encode if some variable doesn't contain any d
// Sets which shading procedures to use
{{shading}}

// Selects what is used to calculate the picked index
{{picking_mode}}

in vec3 o_world_normal;
in vec3 o_view_normal;
in vec4 o_color;
Expand Down Expand Up @@ -125,5 +128,13 @@ void main(){
#ifndef NO_SHADING
color.rgb = illuminate(normalize(o_world_normal), color.rgb);
#endif

#ifdef PICKING_INDEX_FROM_UV
ivec2 size = textureSize(image, 0);
ivec2 jl_idx = clamp(ivec2(o_uv * size), ivec2(0), size-1);
uint idx = uint(jl_idx.x + jl_idx.y * size.x);
write2framebuffer(color, uvec2(o_id.x, uint(1) + idx));
#else
write2framebuffer(color, o_id);
#endif
}
2 changes: 1 addition & 1 deletion GLMakie/assets/shader/surface.vert
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void main()
vec3 pos;
{{position_calc}}

o_id = uvec2(objectid, index1D+1);
o_id = uvec2(objectid, 0); // calculated from uv in mesh.frag
o_InstanceID = 0;
// match up with mesh
o_uv = apply_uv_transform(uv_transform, vec2(index01.x, 1 - index01.y));
Expand Down
2 changes: 1 addition & 1 deletion GLMakie/assets/shader/voxel.frag
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void main()

// TODO: index into 3d array
ivec3 size = ivec3(textureSize(voxel_id, 0).xyz);
ivec3 idx = ivec3(o_uvw * size);
ivec3 idx = clamp(ivec3(o_uvw * size), ivec3(0), size-1);
int lin = 1 + idx.x + size.x * (idx.y + size.y * idx.z);

// draw
Expand Down
1 change: 1 addition & 0 deletions GLMakie/src/drawing_primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ function draw_image(screen::Screen, scene::Scene, plot::Union{Heatmap, Image})
else
gl_attributes[:image] = Texture(pop!(gl_attributes, :color); minfilter=interp)
end
gl_attributes[:picking_mode] = "#define PICKING_INDEX_FROM_UV"
return draw_mesh(screen, gl_attributes)
end
end
Expand Down
1 change: 1 addition & 0 deletions GLMakie/src/glshaders/mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function draw_mesh(screen, data::Dict)
"lighting.frag",
view = Dict(
"shading" => light_calc(shading),
"picking_mode" => to_value(get(data, :picking_mode, "")),
"MAX_LIGHTS" => "#define MAX_LIGHTS $(screen.config.max_lights)",
"MAX_LIGHT_PARAMETERS" => "#define MAX_LIGHT_PARAMETERS $(screen.config.max_light_parameters)",
"buffers" => output_buffers(screen, to_value(transparency)),
Expand Down
1 change: 1 addition & 0 deletions GLMakie/src/glshaders/surface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ function draw_surface(screen, main, data::Dict)
"position_calc" => position_calc(position, position_x, position_y, position_z, Texture),
"normal_calc" => normal_calc(normal, to_value(invert_normals)),
"shading" => light_calc(shading),
"picking_mode" => "#define PICKING_INDEX_FROM_UV",
"MAX_LIGHTS" => "#define MAX_LIGHTS $(screen.config.max_lights)",
"MAX_LIGHT_PARAMETERS" => "#define MAX_LIGHT_PARAMETERS $(screen.config.max_light_parameters)",
"buffers" => output_buffers(screen, to_value(transparency)),
Expand Down
2 changes: 1 addition & 1 deletion GLMakie/src/picking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function pick_native(screen::Screen, rect::Rect2i)
rw, rh = widths(rect)
w, h = size(screen.root_scene)
ppu = screen.px_per_unit[]
if rx > 0 && ry > 0 && rx + rw <= w && ry + rh <= h
if rx >= 0 && ry >= 0 && rx + rw <= w && ry + rh <= h
rx, ry, rw, rh = round.(Int, ppu .* (rx, ry, rw, rh))
sid = zeros(SelectionID{UInt32}, rw, rh)
glReadPixels(rx, ry, rw, rh, buff.format, buff.pixeltype, sid)
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112"
Isoband = "f1662d9f-8043-43de-a69a-05efc1cc6ff4"
KernelDensity = "5ab0869b-81aa-558d-bb23-cbf5423bbe9b"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Expand Down
Loading

0 comments on commit efaacb6

Please sign in to comment.