Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/reference_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ jobs:
# dev mono repo versions
pkg"registry up"
Pkg.update()
pkg"dev . ./MakieCore ./WGLMakie ./ReferenceTests"
pkg"add Bonito#sd/fix-ci; dev . ./MakieCore ./WGLMakie ./ReferenceTests"
- name: Run the tests
continue-on-error: true
run: >
Expand Down
39 changes: 37 additions & 2 deletions ReferenceTests/src/tests/examples2d.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# this is not perfect because diagonal edges appear thinner than orthogonal ones
function with_scaled_hole(base::BezierPath, fraction = 0.8; _scale = (1, -1))
inner = Makie.rotate(Makie.scale(base, fraction .* _scale), pi)
BezierPath([base.commands; inner.commands])
end

for marker in [:circle, :rect, :diamond, :utriangle, :rtriangle, :dtriangle, :ltriangle, :hexagon, :pentagon, :star4, :star5, :star6, :star8]
funcname = Symbol("open_", marker)
@eval begin
"""
$($(funcname))(fraction = 0.8)
Returns a `BezierPath` of an open $($(string(marker))) whose radius `r` is by default size-matched
to the `:$($(string(marker)))` marker. The relative size of the hole is
determined by `fraction`.
"""
function $funcname(fraction = 0.8)
with_scaled_hole(Makie.to_spritemarker($(QuoteNode(marker))), fraction; _scale = $(marker in (:rtriangle, :ltriangle) ? (-1, 1) : (1, -1)))
end
end
end

@reference_test "Open scatter markers" begin
x = rand(40)
y = rand(40)
s = Scene()
cam2d!(s)
funcs = [open_circle, open_rect, open_diamond, open_utriangle, open_rtriangle, open_dtriangle, open_ltriangle, open_hexagon, open_pentagon, open_star4, open_star5, open_star6, open_star8]
for (i, func) in enumerate(funcs)
for (j, args) in enumerate([(), (0.5,)])
scatter!(s, i .+ (x.*0.5), 5*j .+ (y.*4), marker = func(args...))
end
end
center!(s)
s
end

@reference_test "RGB heatmap, heatmap + image overlap" begin
fig = Figure()
Expand Down Expand Up @@ -852,7 +887,7 @@ end
y = [0.0, 0.0, dxy, 0.0, -dxy, dxy/2, dxy/2, -dxy/2, -dxy/2];
@. f1(x,y) = x^2 + y^2;
z = f1(x,y);

f = Figure()
ax1=Axis(f[1,1], title = "alpha = 1.0 (default)")
ax2=Axis(f[1,2], title = "alpha = 0.5 (semitransparent)")
Expand Down Expand Up @@ -1953,4 +1988,4 @@ end
translate!(a.scene, 0.1, 0.05) # test that pattern are anchored to the plot
Makie.step!(st)
st
end
end
5 changes: 3 additions & 2 deletions WGLMakie/src/WGLMakie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ using Makie: apply_transform_and_f32_conversion, f32_conversion_obs, f32_convert

struct WebGL <: ShaderAbstractions.AbstractContext end

const WGL = ES6Module(@path joinpath(@__DIR__, "wglmakie.js"))
# using as THREE version: "https://cdn.esm.sh/v66/[email protected]/es2021/three.js"
const WGL = ES6Module(@path joinpath(@__DIR__, "wglmakie.js"))


include("display.jl")
include("three_plot.jl")
Expand Down Expand Up @@ -70,7 +71,7 @@ end

const TEXTURE_ATLAS = Observable(Float32[])

wgl_texture_atlas() = Makie.get_texture_atlas(1024, 32)
wgl_texture_atlas() = Makie.get_texture_atlas(2048, 32)

function __init__()
# Activate WGLMakie as backend!
Expand Down
2 changes: 1 addition & 1 deletion WGLMakie/src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function Base.size(screen::Screen)
return size(screen.scene)
end

function get_screen_session(screen::Screen; timeout=100,
function get_screen_session(screen::Screen; timeout=200,
error::Union{Nothing,String}=nothing)::Union{Nothing,Session}
function throw_error(status)
if !isnothing(error)
Expand Down
4 changes: 2 additions & 2 deletions src/utilities/texture_atlas.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const SERIALIZATION_FORMAT_VERSION = "v7"
const SERIALIZATION_FORMAT_VERSION = "v8"

struct TextureAtlas
rectangle_packer::RectanglePacker{Int32}
Expand Down Expand Up @@ -47,7 +47,7 @@ function get_uv_img(atlas::TextureAtlas, uv_rect::Vec4f)
return atlas.data[Rect(xmin, ymin, xmax - xmin, ymax - ymin)]
end

function TextureAtlas(; resolution=2048, pix_per_glyph=64, glyph_padding=12, downsample=5)
function TextureAtlas(; resolution=2048, pix_per_glyph=64, glyph_padding=ceil(Int32, pix_per_glyph * 1.5/8), downsample=5)
return TextureAtlas(
RectanglePacker(Rect2{Int32}(0, 0, resolution, resolution)),
Dict{UInt32, Int}(),
Expand Down
Loading