Created
June 16, 2020 14:40
-
-
Save skleinbo/2917b0418a184d245e41f4dac4f21ef7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@block Contributors ["GLMakie backend tests"] begin | |
# A test case for wide lines and mitering at joints | |
@cell "Miter Joints for line rendering" [lines] begin | |
scene = Scene() | |
r = 4 | |
sep = 4*r | |
scatter!(scene, (sep+2*r)*[-1,-1,1,1], (sep+2*r)*[-1,1,-1,1]) | |
for i=-1:1 | |
for j=-1:1 | |
angle = pi/2 + pi/4*i | |
x = r*[-cos(angle/2),0,-cos(angle/2)] | |
y = r*[-sin(angle/2),0,sin(angle/2)] | |
linewidth = 40 * 2.0^j | |
lines!(scene, x .+ sep*i, y .+ sep*j, color=RGBAf0(0,0,0,0.5), linewidth=linewidth) | |
lines!(scene, x .+ sep*i, y .+ sep*j, color=:red) | |
end | |
end | |
scene | |
end | |
# Test for resizing of TextureBuffer | |
@cell "Dynamically adjusting number of particles in a meshscatter" [meshscatter] begin | |
using FileIO, Colors | |
catmesh = FileIO.load(MakieGallery.assetpath("cat.obj")) | |
pos = Node(rand(Point3f0, 2)) | |
rot = Node(rand(Vec3f0, 2)) | |
color = Node(rand(RGB, 2)) | |
size = Node(1/2*rand(2)) | |
makenew = Node(1) | |
on(makenew) do _ | |
i = rand(1:100) | |
pos[] = rand(Point3f0, i) | |
rot[] = rand(Vec3f0, i) | |
color[] = rand(RGB, i) | |
size[] = 1/2*rand(i) | |
end | |
scene = meshscatter(pos, | |
marker=catmesh, | |
rotations=rot, | |
color=color, | |
markersize=size, | |
limits=FRect3D(Point3(0), Point3(1)) | |
) | |
for _ in 1:5 | |
makenew[] = makenew[] + 1 | |
end | |
scene | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment