Skip to content

Commit

Permalink
Merge branch 'breaking-0.22' into ff/Axis3-controls
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer authored Nov 25, 2024
2 parents 21815d4 + f8e5519 commit 288ede8
Show file tree
Hide file tree
Showing 107 changed files with 163,383 additions and 349 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ on:
pull_request:
branches:
- master
- breaking-0.21
- breaking-0.22
push:
tags:
- '*'
branches:
- master
- breaking-0.21

workflow_dispatch:

concurrency:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22
push:
tags:
- '*'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/compilation-benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/reference_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22
push:
tags:
- '*'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/relocatability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22
push:
tags:
- '*'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rprmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22
push:
tags:
- '*'
Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# Changelog

## [Breaking]

- Updated to GeometryBasics 0.5: [GeometryBasics#173](https://github.com/JuliaGeometry/GeometryBasics.jl/pull/173), [GeometryBasics#219](https://github.com/JuliaGeometry/GeometryBasics.jl/pull/219) [#4319](https://github.com/MakieOrg/Makie.jl/pull/4319)
- Removed `meta` infrastructure. Vertex attributes are now passed as kwargs.
- Simplified GeometryBasics Mesh type, improving compile times
- Added `FaceView` to allow different vertex attributes to use different indices for specifying data of the same vertex. This can be used to specify per-face data.
- Added `GeometryBasics.face_normals(points, faces)`
- Changed the order of `Rect2` coordinates to be counter-clockwise.
- Updated `Cylinder` to avoid visually rounding off the top and bottom.
- Added `MetaMesh` to store non-vertex metadata in a GeometryBasics Mesh object. These are now produced by MeshIO for `.obj` files, containing information from `.mtl` files.
- Renamed `Tesselation/tesselation` to `Tessellation/tessellation` [GeometryBasics#227](https://github.com/JuliaGeometry/GeometryBasics.jl/pull/227) [#4564](https://github.com/MakieOrg/Makie.jl/pull/4564)
- Added `Makie.mesh` option for `MetaMesh` which applies some of the bundled information [#4368](https://github.com/MakieOrg/Makie.jl/pull/4368), [#4496](https://github.com/MakieOrg/Makie.jl/pull/4496)
- `Voronoiplot`s automatic colors are now defined based on the underlying point set instead of only those generators appearing in the tessellation. This makes the selected colors consistent between tessellations when generators might have been deleted or added. [#4357](https://github.com/MakieOrg/Makie.jl/pull/4357)
- Added translation, zoom and limit reset interactions to Axis3 [4131](https://github.com/MakieOrg/Makie.jl/pull/4131)
- Split `marker_offset` handling from marker centering and fix various bugs with it [#4594](https://github.com/MakieOrg/Makie.jl/pull/4594)

## [Unreleased]

- Fix uint16 overflow for over ~65k elements in WGLMakie picking [#4604](https://github.com/MakieOrg/Makie.jl/pull/4604).
- Improve performance for line plot in CairoMakie [#4601](https://github.com/MakieOrg/Makie.jl/pull/4601).
- Prevent more default actions when canvas has focus [#4602](https://github.com/MakieOrg/Makie.jl/pull/4602).
- Fix an error in `convert_arguments` for PointBased plots and 3D polygons [#4585](https://github.com/MakieOrg/Makie.jl/pull/4585).
- Fix polygon rendering issue of `crossbar(..., show_notch = true)` in CairoMakie [#4587](https://github.com/MakieOrg/Makie.jl/pull/4587).
- Added translation, zoom and limit reset interactions to Axis3 [4131](https://github.com/MakieOrg/Makie.jl/pull/4131)
- Fix render order of Axis3 frame lines in CairoMakie [#4591](https://github.com/MakieOrg/Makie.jl/pull/4591)

## [0.21.16] - 2024-11-06
Expand Down Expand Up @@ -66,6 +81,7 @@
- Fix voxel clipping not being based on voxel centers [#4397](https://github.com/MakieOrg/Makie.jl/pull/4397)
- Parsing `Q` and `q` commands in svg paths with `BezierPath` is now supported [#4413](https://github.com/MakieOrg/Makie.jl/pull/4413)


## [0.21.11] - 2024-09-13

- Hot fixes for 0.21.10 [#4356](https://github.com/MakieOrg/Makie.jl/pull/4356).
Expand Down
6 changes: 3 additions & 3 deletions CairoMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CairoMakie"
uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
author = ["Simon Danisch <[email protected]>"]
version = "0.12.16"
version = "0.13.0"

[deps]
CRC32c = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
Expand All @@ -22,9 +22,9 @@ Cairo_jll = "1.18.0"
Colors = "0.10, 0.11, 0.12, 0.13"
FileIO = "1.1"
FreeType = "3, 4.0"
GeometryBasics = "0.4.11"
GeometryBasics = "0.5"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.21.16"
Makie = "=0.22.0"
PrecompileTools = "1.0"
julia = "1.3"

Expand Down
16 changes: 10 additions & 6 deletions CairoMakie/src/overrides.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function draw_plot(scene::Scene, screen::Screen, poly::Poly)
# dispatch on input arguments to poly to use smarter drawing methods than
# meshes if possible.
# however, since recipes exist, we can't explicitly handle all cases here
# so, we should also take a look at converted
# so, we should also take a look at converted
# First, we check whether a `draw_poly` method exists for the input arguments
# before conversion:
return if Base.hasmethod(draw_poly, Tuple{Scene, Screen, typeof(poly), typeof.(to_value.(poly.args))...})
Expand Down Expand Up @@ -85,10 +85,14 @@ draw_poly(scene::Scene, screen::Screen, poly, rect::Rect2) = draw_poly(scene, sc
draw_poly(scene::Scene, screen::Screen, poly, bezierpath::BezierPath) = draw_poly(scene, screen, poly, [bezierpath])

function draw_poly(scene::Scene, screen::Screen, poly, shapes::Vector{<:Union{Rect2, BezierPath}})
model = poly.model[]
space = to_value(get(poly, :space, :data))
clipped_shapes = clip_shape.(Ref(poly.clip_planes[]), shapes, space, Ref(model))
projected_shapes = project_shape.(Ref(poly), space, clipped_shapes, Ref(model))
model = poly.model[]::Mat4d
space = to_value(get(poly, :space, :data))::Symbol
planes = poly.clip_planes[]::Vector{Plane3f}

projected_shapes = map(shapes) do shape
clipped = clip_shape(planes, shape, space, model)
return project_shape(poly, space, clipped, model)
end

color = to_cairo_color(poly.color[], poly)

Expand Down Expand Up @@ -188,7 +192,7 @@ end
function draw_poly(scene::Scene, screen::Screen, poly, polygons::AbstractArray{<: MultiPolygon})
model = poly.model[]
space = to_value(get(poly, :space, :data))
projected_polys = map(polygons) do polygon
projected_polys = map(polygons) do polygon
project_multipolygon(poly, space, polygon, poly.clip_planes[], model)
end

Expand Down
1 change: 1 addition & 0 deletions CairoMakie/src/precompiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ let
include(shared_precompile)
end
end
precompile(openurl, (String,))
precompile(draw_atomic_scatter, (Scene, Cairo.CairoContext, Tuple{typeof(identity),typeof(identity)},
Vector{ColorTypes.RGBA{Float32}}, Vec{2,Float32}, ColorTypes.RGBA{Float32},
Float32, BezierPath, Vec{2,Float32}, Quaternionf,
Expand Down
46 changes: 9 additions & 37 deletions CairoMakie/src/primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Unio

isempty(positions) && return

# workaround for a LineSegments object created from a GLNormalMesh
# the input argument is a view of points using faces, which results in
# a vector of tuples of two points. we convert those to a list of points
# so they don't trip up the rest of the pipeline
# TODO this shouldn't be necessary anymore!
if positions isa SubArray{<:Point3, 1, P, <:Tuple{Array{<:AbstractFace}}} where P
positions = let
pos = Point3f[]
for tup in positions
push!(pos, tup[1])
push!(pos, tup[2])
end
pos
end
end

# color is now a color or an array of colors
# if it's an array of colors, each segment must be stroked separately
color = to_color(primitive.calculated_colors[])
Expand Down Expand Up @@ -386,15 +370,6 @@ function draw_atomic_scatter(
end

function draw_marker(ctx, marker::Char, font, pos, scale, strokecolor, strokewidth, marker_offset, rotation)
# Marker offset is meant to be relative to the
# bottom left corner of the box centered at
# `pos` with sides defined by `scale`, but
# this does not take the character's dimensions
# into account.
# Here, we reposition the marker offset to be
# relative to the center of the char.
marker_offset = marker_offset .+ scale ./ 2

cairoface = set_ft_font(ctx, font)

charextent = Makie.FreeTypeAbstraction.get_extent(font, marker)
Expand Down Expand Up @@ -436,7 +411,6 @@ function draw_marker(ctx, marker::Char, font, pos, scale, strokecolor, strokewid
end

function draw_marker(ctx, ::Type{<: Circle}, pos, scale, strokecolor, strokewidth, marker_offset, rotation)
marker_offset = marker_offset + scale ./ 2
pos += Point2f(marker_offset[1], -marker_offset[2])

if scale[1] != scale[2]
Expand All @@ -461,10 +435,10 @@ end

function draw_marker(ctx, ::Union{Makie.FastPixel,<:Type{<:Rect}}, pos, scale, strokecolor, strokewidth,
marker_offset, rotation)
s2 = Point2((scale .* (1, -1))...)
pos = pos .+ Point2f(marker_offset[1], -marker_offset[2])

Cairo.translate(ctx, pos[1] + marker_offset[1], pos[2] - marker_offset[2])
Cairo.rotate(ctx, to_2d_rotation(rotation))
Cairo.rectangle(ctx, pos[1], pos[2], s2...)
Cairo.rectangle(ctx, -0.5scale[1], -0.5scale[2], scale...)
Cairo.fill_preserve(ctx)
Cairo.set_line_width(ctx, Float64(strokewidth))
sc = to_color(strokecolor)
Expand All @@ -474,7 +448,7 @@ end

function draw_marker(ctx, beziermarker::BezierPath, pos, scale, strokecolor, strokewidth, marker_offset, rotation)
Cairo.save(ctx)
Cairo.translate(ctx, pos[1], pos[2])
Cairo.translate(ctx, pos[1] + marker_offset[1], pos[2] - marker_offset[2])
Cairo.rotate(ctx, to_2d_rotation(rotation))
Cairo.scale(ctx, scale[1], -scale[2]) # flip y for cairo
draw_path(ctx, beziermarker)
Expand Down Expand Up @@ -530,9 +504,7 @@ function draw_marker(ctx, marker::Matrix{T}, pos, scale,

w, h = size(marker)

Cairo.translate(ctx,
scale[1]/2 + pos[1] + marker_offset[1],
scale[2]/2 + pos[2] + marker_offset[2])
Cairo.translate(ctx, pos[1] + marker_offset[1], pos[2] - marker_offset[2])
Cairo.rotate(ctx, to_2d_rotation(rotation))
Cairo.scale(ctx, scale[1] / w, scale[2] / h)
Cairo.set_source_surface(ctx, marker_surf, -w/2, -h/2)
Expand Down Expand Up @@ -912,7 +884,7 @@ function draw_mesh2D(scene, screen, @nospecialize(plot::Makie.Mesh), @nospeciali
space = to_value(get(plot, :space, :data))::Symbol
transform_func = Makie.transform_func(plot)
model = plot.model[]::Mat4d
vs = project_position(scene, transform_func, space, GeometryBasics.metafree(GeometryBasics.coordinates(mesh)), model)::Vector{Point2f}
vs = project_position(scene, transform_func, space, GeometryBasics.coordinates(mesh), model)::Vector{Point2f}
fs = decompose(GLTriangleFace, mesh)::Vector{GLTriangleFace}
uv = decompose_uv(mesh)::Union{Nothing, Vector{Vec2f}}
# Note: This assume the function is only called from mesh plots
Expand Down Expand Up @@ -1200,7 +1172,7 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Maki

pos = primitive[1][]
# For correct z-ordering we need to be in view/camera or screen space
model = copy(model)
model = copy(model)::Mat4d
view = scene.camera.view[]

zorder = sortperm(pos, by = p -> begin
Expand Down Expand Up @@ -1253,7 +1225,7 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Maki
pos = Makie.voxel_positions(primitive)
scale = Makie.voxel_size(primitive)
colors = Makie.voxel_colors(primitive)
marker = GeometryBasics.normal_mesh(Rect3f(Point3f(-0.5), Vec3f(1)))
marker = GeometryBasics.expand_faceviews(normal_mesh(Rect3f(Point3f(-0.5), Vec3f(1))))

# Face culling
if !isempty(primitive.clip_planes[]) && Makie.is_data_space(primitive.space[])
Expand All @@ -1263,7 +1235,7 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Maki
end

# For correct z-ordering we need to be in view/camera or screen space
model = copy(primitive.model[])
model = copy(primitive.model[])::Mat4d
view = scene.camera.view[]

zorder = sortperm(pos, by = p -> begin
Expand Down
5 changes: 3 additions & 2 deletions CairoMakie/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,12 @@ function clip_shape(clip_planes::Vector{Plane3f}, shape::Rect2, space::Symbol, m

xy = origin(shape)
w, h = widths(shape)
ps = [xy, xy + Vec2(w, 0), xy + Vec2f(w, h), xy + Vec2(0, h)]
ps = Vec2f[xy, xy + Vec2f(w, 0), xy + Vec2f(w, h), xy + Vec2f(0, h)]
if any(p -> Makie.is_clipped(clip_planes, p), ps)
push!(ps, xy)
ps = clip_poly(clip_planes, ps, space, model)
return BezierPath([MoveTo(ps[1]), LineTo.(ps[2:end])..., ClosePath()])
commands = Makie.PathCommand[MoveTo(ps[1]), LineTo.(ps[2:end])..., ClosePath()]
return BezierPath(commands::Vector{Makie.PathCommand})
else
return shape
end
Expand Down
2 changes: 2 additions & 0 deletions CairoMakie/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ excludes = Set([
"Miter Joints for line rendering", # CairoMakie does not show overlap here
"Scatter with FastPixel", # almost works, but scatter + markerspace=:data seems broken for 3D
"picking", # Not implemented
"scatter marker_offset 3D with rotation", # missing support for 3D scatter with markerspace = :data
"MetaMesh (Sponza)", # makes little sense without per pixel depth order
])

functions = [:volume, :volume!, :uv_mesh]
Expand Down
10 changes: 5 additions & 5 deletions GLMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "GLMakie"
uuid = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
version = "0.10.16"
version = "0.11.0"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand Down Expand Up @@ -28,15 +28,15 @@ FileIO = "1.6"
FixedPointNumbers = "0.7, 0.8"
FreeTypeAbstraction = "0.10"
GLFW = "3.4.3"
GeometryBasics = "0.4.11"
GeometryBasics = "0.5"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.21.16"
Makie = "=0.22.0"
Markdown = "1.0, 1.6"
MeshIO = "0.4"
MeshIO = "0.5"
ModernGL = "1"
Observables = "0.5.1"
PrecompileTools = "1.0"
Printf = "1.0, 1.6"
ShaderAbstractions = "0.4"
ShaderAbstractions = "0.5"
StaticArrays = "0.12, 1.0"
julia = "1"
5 changes: 4 additions & 1 deletion GLMakie/assets/shader/dots.vert
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct Nothing{ //Nothing type, to encode if some variable doesn't contain any d
{{color_norm_type}} color_norm;
{{color_map_type}} color_map;
{{scale_type}} scale;
{{marker_offset_type}} marker_offset;

uniform vec2 resolution;
uniform uint objectid;
Expand Down Expand Up @@ -59,9 +60,9 @@ void main(){
vec4 world_position = model * _position(vertex);
process_clip_planes(world_position.xyz);
vec4 clip_pos = projectionview * world_position;
gl_Position = vec4(clip_pos.xy, clip_pos.z + (clip_pos.w * depth_shift), clip_pos.w);
if (markerspace == 0) {
// pixelspace
clip_pos += vec4(2.0 * px_per_unit * marker_offset / vec3(resolution, 1), 0);
gl_PointSize = px_per_unit * scale.x;
} else {
// dataspace with 3D camera
Expand All @@ -70,7 +71,9 @@ void main(){
vec4 up_clip = projectionview * vec4(world_position.xyz + scale_vec, 1);
float yup = abs(up_clip.y - clip_pos.y) / clip_pos.w;
gl_PointSize = ceil(0.5 * yup * resolution.y);
clip_pos += projectionview * vec4(marker_offset, 0);
}
gl_Position = vec4(clip_pos.xy, clip_pos.z + (clip_pos.w * depth_shift), clip_pos.w);

colorize(color_map, color, color_norm);
o_objectid = uvec2(objectid, gl_VertexID+1);
Expand Down
10 changes: 7 additions & 3 deletions GLMakie/src/GLAbstraction/GLExtendedFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ function glGenRenderbuffers(format::GLenum, attachment::GLenum, dimensions)
return renderbuffer[1]
end

function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer, h::Integer, d::Integer, border::Integer, format::GLenum, datatype::GLenum, data)
Makie.@noconstprop function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer,
h::Integer, d::Integer, border::Integer, format::GLenum,
datatype::GLenum, data)
glTexImage3D(GL_PROXY_TEXTURE_3D, level, internalFormat, w, h, d, border, format, datatype, C_NULL)
for l in 0:level
result = glGetTexLevelParameteriv(GL_PROXY_TEXTURE_3D, l, GL_TEXTURE_WIDTH)
Expand All @@ -200,7 +202,8 @@ function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::In
glTexImage3D(ttype, level, internalFormat, w, h, d, border, format, datatype, data)
end

function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer, h::Integer, border::Integer, format::GLenum, datatype::GLenum, data)
Makie.@noconstprop function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer,
h::Integer, border::Integer, format::GLenum, datatype::GLenum, data)
maxsize = glGetIntegerv(GL_MAX_TEXTURE_SIZE)
glTexImage2D(GL_PROXY_TEXTURE_2D, level, internalFormat, w, h, border, format, datatype, C_NULL)
for l in 0:level
Expand All @@ -220,7 +223,8 @@ function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::In
glTexImage2D(ttype, level, internalFormat, w, h, border, format, datatype, data)
end

function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer, border::Integer, format::GLenum, datatype::GLenum, data)
Makie.@noconstprop function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer,
border::Integer, format::GLenum, datatype::GLenum, data)
glTexImage1D(GL_PROXY_TEXTURE_1D, level, internalFormat, w, border, format, datatype, C_NULL)
for l in 0:level
result = glGetTexLevelParameteriv(GL_PROXY_TEXTURE_1D, l, GL_TEXTURE_WIDTH)
Expand Down
Loading

0 comments on commit 288ede8

Please sign in to comment.