Skip to content

Commit

Permalink
Merge branch 'master' into ff/polar_segments
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch authored Sep 12, 2023
2 parents d733ccb + eda228a commit 14e6093
Show file tree
Hide file tree
Showing 43 changed files with 260 additions and 219 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: Docs build and deploy
on:
push:
pull_request:
branches:
- main
- master
- breaking-release
tags: '*'
pull_request:
- sd/beta-20
push:
tags:
- '*'
branches:
- main
- master
- breaking-release

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/cairomakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ on:
- '*.md'
branches:
- master
- breaking-release
- sd/beta-20
push:
paths-ignore:
- 'docs/**'
- '*.md'
branches:
- master
- breaking-release
tags: '*'
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ on:
- '*.md'
branches:
- master
- breaking-release
- sd/beta-20
push:
paths-ignore:
- 'docs/**'
- '*.md'
tags:
- '*'
branches:
- master
- breaking-release
tags: '*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compilation-benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-release
- sd/beta-20
jobs:
benchmark:
name: ${{ matrix.package }}
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/glmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ on:
- '*.md'
branches:
- master
- breaking-release
- sd/beta-20
push:
paths-ignore:
- 'docs/**'
- '*.md'
tags:
- '*'
branches:
- master
- breaking-release
tags: '*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -44,7 +41,7 @@ jobs:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev xsettingsd x11-xserver-utils
- name: Install Julia dependencies
shell: julia --project=monorepo {0}
run: |
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/rprmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ on:
- '*.md'
branches:
- master
- breaking-release
- sd/beta-20
push:
paths-ignore:
- 'docs/**'
- '*.md'
tags:
- '*'
branches:
- master
- breaking-release
tags: '*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/wglmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ on:
- '*.md'
branches:
- master
- breaking-release
- sd/beta-20
push:
paths-ignore:
- 'docs/**'
- '*.md'
tags:
- '*'
branches:
- master
- breaking-release
tags: '*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
4 changes: 2 additions & 2 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 <sdanisch@gmail.com>"]
version = "0.10.8"
version = "0.10.9"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand All @@ -23,7 +23,7 @@ FFTW = "1"
FileIO = "1.1"
FreeType = "3, 4.0"
GeometryBasics = "0.4.1"
Makie = "=0.19.8"
Makie = "=0.19.9"
PrecompileTools = "1.0"
julia = "1.3"

Expand Down
48 changes: 16 additions & 32 deletions CairoMakie/src/primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
################################################################################

function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Union{Lines, LineSegments}))
fields = @get_attribute(primitive, (color, linewidth, linestyle))
linestyle = Makie.convert_attribute(linestyle, Makie.key"linestyle"())
@get_attribute(primitive, (color, linewidth, linestyle))
ctx = screen.context
model = primitive[:model][]
positions = primitive[1][]
Expand Down Expand Up @@ -245,7 +244,7 @@ function draw_multi(primitive::Lines, ctx, positions, colors::AbstractArray, lin
this_linewidth != prev_linewidth && error("Encountered two different linewidth values $prev_linewidth and $this_linewidth in `lines` at index $(i-1). Different linewidths in one line are only permitted in CairoMakie when separated by a NaN point.")
Cairo.line_to(ctx, this_position...)
prev_continued = true

if i == lastindex(positions)
# this is the last element so stroke this
Cairo.set_line_width(ctx, this_linewidth)
Expand Down Expand Up @@ -293,8 +292,7 @@ end
################################################################################

function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Scatter))
fields = @get_attribute(primitive, (markersize, strokecolor, strokewidth, marker, marker_offset, rotations))
@get_attribute(primitive, (transform_marker,))
@get_attribute(primitive, (markersize, strokecolor, strokewidth, marker, marker_offset, rotations, transform_marker))

ctx = screen.context
model = primitive.model[]
Expand All @@ -306,22 +304,15 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Scat

colors = to_color(primitive.calculated_colors[])

markerspace = to_value(get(primitive, :markerspace, :pixel))
space = to_value(get(primitive, :space, :data))

markerspace = primitive.markerspace[]
space = primitive.space[]
transfunc = Makie.transform_func(primitive)

marker_conv = _marker_convert(marker)

draw_atomic_scatter(scene, ctx, transfunc, colors, markersize, strokecolor, strokewidth, marker_conv, marker_offset, rotations, model, positions, size_model, font, markerspace, space)
return draw_atomic_scatter(scene, ctx, transfunc, colors, markersize, strokecolor, strokewidth, marker,
marker_offset, rotations, model, positions, size_model, font, markerspace,
space)
end

# an array of markers is converted to string by itself, which is inconvenient for the iteration logic
_marker_convert(markers::AbstractArray) = map(m -> convert_attribute(m, key"marker"(), key"scatter"()), markers)
_marker_convert(marker) = convert_attribute(marker, key"marker"(), key"scatter"())
# image arrays need to be converted as a whole
_marker_convert(marker::AbstractMatrix{<:Colorant}) = [ convert_attribute(marker, key"marker"(), key"scatter"()) ]

function draw_atomic_scatter(scene, ctx, transfunc, colors, markersize, strokecolor, strokewidth, marker, marker_offset, rotations, model, positions, size_model, font, markerspace, space)
broadcast_foreach(positions, colors, markersize, strokecolor,
strokewidth, marker, marker_offset, remove_billboard(rotations)) do point, col,
Expand All @@ -336,15 +327,14 @@ function draw_atomic_scatter(scene, ctx, transfunc, colors, markersize, strokeco
Cairo.set_source_rgba(ctx, rgbatuple(col)...)

Cairo.save(ctx)
marker_converted = Makie.to_spritemarker(m)
# Setting a markersize of 0.0 somehow seems to break Cairos global state?
# At least it stops drawing any marker afterwards
# TODO, maybe there's something wrong somewhere else?
if !(norm(scale) 0.0)
if marker_converted isa Char
draw_marker(ctx, marker_converted, best_font(m, font), pos, scale, strokecolor, strokewidth, offset, rotation)
if m isa Char
draw_marker(ctx, m, best_font(m, font), pos, scale, strokecolor, strokewidth, offset, rotation)
else
draw_marker(ctx, marker_converted, pos, scale, strokecolor, strokewidth, offset, rotation)
draw_marker(ctx, m, pos, scale, strokecolor, strokewidth, offset, rotation)
end
end
Cairo.restore(ctx)
Expand Down Expand Up @@ -691,7 +681,7 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Unio
t = Makie.transform_func(primitive)
identity_transform = (t === identity || t isa Tuple && all(x-> x === identity, t)) && (abs(model[1, 2]) < 1e-15)
regular_grid = xs isa AbstractRange && ys isa AbstractRange
xy_aligned = let
xy_aligned = let
# Only allow scaling and translation
pv = scene.camera.projectionview[]
M = Mat4f(
Expand Down Expand Up @@ -720,7 +710,7 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Unio
xymax = project_position(scene, space, Point2f(last.(imsize)), model)
w, h = xymax .- xy

can_use_fast_path = !(is_vector && !interpolate) && regular_grid && identity_transform &&
can_use_fast_path = !(is_vector && !interpolate) && regular_grid && identity_transform &&
(interpolate || xy_aligned)
use_fast_path = can_use_fast_path && !disable_fast_path

Expand Down Expand Up @@ -862,23 +852,19 @@ nan2zero(x) = !isnan(x) * x


function draw_mesh3D(scene, screen, attributes, mesh; pos = Vec4f(0), scale = 1f0)
# Priorize colors of the mesh if present
@get_attribute(attributes, (color,))
@get_attribute(attributes, (shading, diffuse, specular, shininess, faceculling))

matcap = to_value(get(attributes, :matcap, nothing))

meshpoints = decompose(Point3f, mesh)::Vector{Point3f}
meshfaces = decompose(GLTriangleFace, mesh)::Vector{GLTriangleFace}
meshnormals = decompose_normals(mesh)::Vector{Vec3f}
meshuvs = texturecoordinates(mesh)::Union{Nothing, Vector{Vec2f}}

# Priorize colors of the mesh if present
color = hasproperty(mesh, :color) ? mesh.color : to_value(attributes.calculated_colors)

per_face_col = per_face_colors(color, matcap, meshfaces, meshnormals, meshuvs)

@get_attribute(attributes, (shading, diffuse,
specular, shininess, faceculling))

model = attributes.model[]::Mat4f
space = to_value(get(attributes, :space, :data))::Symbol
func = Makie.transform_func(attributes)
Expand Down Expand Up @@ -1052,8 +1038,6 @@ end

function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Makie.MeshScatter))
@get_attribute(primitive, (model, marker, markersize, rotations))

m = convert_attribute(marker, key"marker"(), key"meshscatter"())
pos = primitive[1][]
# For correct z-ordering we need to be in view/camera or screen space
model = copy(model)
Expand Down Expand Up @@ -1093,7 +1077,7 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Maki
scale = markersize isa Vector ? markersize[i] : markersize

draw_mesh3D(
scene, screen, submesh, m, pos = p,
scene, screen, submesh, marker, pos = p,
scale = scale isa Real ? Vec3f(scale) : to_ndim(Vec3f, scale, 1f0)
)
end
Expand Down
4 changes: 4 additions & 0 deletions CairoMakie/test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
ReferenceTests = "d37af2e0-5618-4e00-9939-d430db56ee94"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4 changes: 1 addition & 3 deletions CairoMakie/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Test
using CairoMakie
using Pkg
using Makie.FileIO
using ReferenceTests

path = normpath(joinpath(dirname(pathof(Makie)), "..", "ReferenceTests"))
Pkg.develop(PackageSpec(path = path))
# Before changing Pkg environment, try the test in #864
@testset "Runs without error" begin
fig = Figure()
Expand Down
4 changes: 2 additions & 2 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.8.8"
version = "0.8.9"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand Down Expand Up @@ -29,7 +29,7 @@ FixedPointNumbers = "0.7, 0.8"
FreeTypeAbstraction = "0.10"
GLFW = "3"
GeometryBasics = "0.4.1"
Makie = "=0.19.8"
Makie = "=0.19.9"
MeshIO = "0.4"
ModernGL = "1"
Observables = "0.5.1"
Expand Down
2 changes: 2 additions & 0 deletions GLMakie/test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[deps]
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ReferenceTests = "d37af2e0-5618-4e00-9939-d430db56ee94"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
8 changes: 2 additions & 6 deletions GLMakie/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
using Makie
using GLMakie, Test
using FileIO
using GeometryBasics
using GeometryBasics: origin
using Makie
using ImageMagick
using Pkg
using Random
using ReferenceTests

if !GLMakie.ModernGL.enable_opengl_debugging
# can't error, since we can't enable debugging for users
@warn("TESTING WITHOUT OPENGL DEBUGGING")
end

reference_tests_dir = normpath(joinpath(dirname(pathof(Makie)), "..", "ReferenceTests"))
Pkg.develop(PackageSpec(path = reference_tests_dir))
using ReferenceTests

GLMakie.activate!(framerate=1.0)

Expand Down
2 changes: 1 addition & 1 deletion MakieCore/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
authors = ["Simon Danisch"]
name = "MakieCore"
uuid = "20f20a25-4f0e-4fdf-b5d1-57303727442b"
version = "0.6.5"
version = "0.6.6"

[deps]
Observables = "510215fc-4207-5dde-b226-833fc4488ee2"
Expand Down
7 changes: 6 additions & 1 deletion MakieCore/src/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,12 @@ function get_attribute(dict, key, default=nothing)
if haskey(dict, key)
value = to_value(dict[key])
value isa Automatic && return default
return convert_attribute(to_value(dict[key]), Key{key}())
plot_k = plotkey(dict)
if isnothing(plot_k)
return convert_attribute(value, Key{key}())
else
return convert_attribute(value, Key{key}(), Key{plot_k}())
end
else
return default
end
Expand Down
2 changes: 1 addition & 1 deletion MakieCore/src/basic_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Creates a connected line plot for each element in `(x, y, z)`, `(x, y)` or `posi
- `color=theme(scene, :linecolor)` sets the color of the line. If no color is set, multiple calls to `line!` will cycle through the axis color palette.
Otherwise, one can set one color per line point by passing a `Vector{<:Colorant}`, or one colorant for the whole line. If color is a vector of numbers, the colormap args are used to map the numbers to colors.
- `cycle::Vector{Symbol} = [:color]` sets which attributes to cycle when creating multiple plots.
- `linestyle::Union{Nothing, Symbol, Vector} = nothing` sets the pattern of the line (e.g. `:solid`, `:dot`, `:dashdot`)
- `linestyle::Union{Nothing, Symbol, Linestyle} = nothing` sets the pattern of the line e.g. `:solid`, `:dot`, `:dashdot`. For custom patterns look at `Linestyle(Number[...])`.
- `linewidth::Union{Real, Vector} = 1.5` sets the width of the line in pixel units.
$(Base.Docs.doc(colormap_attributes!))
Expand Down
Loading

0 comments on commit 14e6093

Please sign in to comment.