Skip to content

Commit 091d9a6

Browse files
committed
better handling of transparency
1 parent 8e3f8c1 commit 091d9a6

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

ext/Render.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ function render!(scene, ::typeof(FixedTranslation), sys, sol, t)
607607
radius = Float32(sol($t, idxs=sys.radius))
608608
Makie.GeometryBasics.Cylinder(origin, extremity, radius)
609609
end
610-
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=true)
610+
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=color.alpha != 1)
611611
true
612612
end
613613

@@ -630,7 +630,7 @@ function render!(scene, ::typeof(BodyShape), sys, sol, t)
630630
extremity = r2
631631
Makie.GeometryBasics.Cylinder(origin, extremity, radius)
632632
end
633-
mesh!(scene, thing; color, specular = Vec3f(1.5), transparency=true)
633+
mesh!(scene, thing; color, specular = Vec3f(1.5), transparency=color.alpha != 1)
634634
elseif shape == "box"
635635
Rfun = get_rot_fun(sol, sys.frame_a)
636636

@@ -652,7 +652,7 @@ function render!(scene, ::typeof(BodyShape), sys, sol, t)
652652
origin = Vec3f(0, -width/2, -height/2)
653653
extent = Vec3f(length, width, height)
654654
thing = Makie.Rect3f(origin, extent)
655-
m = mesh!(scene, thing; color, specular = Vec3f(1.5), transparency=true)
655+
m = mesh!(scene, thing; color, specular = Vec3f(1.5), transparency=color.alpha != 1)
656656
on(t) do t
657657
r1 = Point3f(r_0a(t))
658658
R = Rfun(t)
@@ -690,7 +690,7 @@ function render!(scene, ::typeof(BodyShape), sys, sol, t)
690690
# Makie.GeometryBasics.Sphere((r1+r2) ./ 2, 0.1f0)
691691
# end
692692
# mesh!(scene, thing, color=:purple)
693-
true
693+
false
694694
end
695695

696696

@@ -965,7 +965,7 @@ function render!(scene, ::typeof(P.Body), sys, sol, t)
965965
point = Point3f(coords..., 0)
966966
Sphere(point, Float32(radius))
967967
end
968-
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1))
968+
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=color.alpha != 1)
969969
false
970970
end
971971

@@ -983,7 +983,7 @@ function render!(scene, ::Union{typeof(P.FixedTranslation), typeof(P.BodyShape)}
983983
radius = Float32(sol($t, idxs=sys.radius))
984984
Makie.GeometryBasics.Cylinder(origin, extremity, radius)
985985
end
986-
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1))
986+
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=color.alpha != 1)
987987
true
988988
end
989989

@@ -1000,7 +1000,7 @@ function render!(scene, ::typeof(P.Prismatic), sys, sol, t)
10001000
radius = Float32(sol($t, idxs=sys.radius))
10011001
Makie.GeometryBasics.Cylinder(origin, extremity, radius)
10021002
end
1003-
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1))
1003+
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=color.alpha != 1)
10041004
true
10051005
end
10061006

@@ -1029,7 +1029,7 @@ function render!(scene, ::typeof(P.Revolute), sys, sol, t)
10291029
p2 = Point3f(O - length*n_w)
10301030
Makie.GeometryBasics.Cylinder(p1, p2, radius)
10311031
end
1032-
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1))
1032+
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=color.alpha != 1)
10331033
true
10341034
end
10351035

@@ -1083,7 +1083,7 @@ function render!(scene, ::Union{typeof(P.SimpleWheel), typeof(P.SlipBasedWheelJo
10831083
p2 = Point3f(O - width*n_w)
10841084
Makie.GeometryBasics.Cylinder(p1, p2, radius)
10851085
end
1086-
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1))
1086+
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=color.alpha != 1)
10871087
true
10881088
end
10891089

@@ -1126,7 +1126,7 @@ function render!(scene, ::typeof(Multibody.BoxVisualizer), sys, sol, t)
11261126
origin = Vec3f(-length/2, -width/2, -height/2) + r_shape
11271127
extent = Vec3f(length, width, height)
11281128
thing = Makie.Rect3f(origin, extent)
1129-
m = mesh!(scene, thing; color, specular = Vec3f(1.5))
1129+
m = mesh!(scene, thing; color, specular = Vec3f(1.5), transparency=color.alpha != 1)
11301130
on(t) do t
11311131
r1 = Point3f(r_0a(t))
11321132
R = Rfun(t)
@@ -1149,7 +1149,7 @@ function render!(scene, ::typeof(Multibody.SphereVisualizer), sys, sol, t)
11491149
point = Point3f(coords)
11501150
Sphere(point, Float32(radius))
11511151
end
1152-
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1))
1152+
mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=color.alpha != 1)
11531153
end
11541154

11551155
function render!(scene, ::typeof(Multibody.CylinderVisualizer), sys, sol, t)
@@ -1174,7 +1174,7 @@ function render!(scene, ::typeof(Multibody.CylinderVisualizer), sys, sol, t)
11741174
origin = r1
11751175
extremity = r2
11761176
thing = Makie.GeometryBasics.Cylinder(origin, extremity, radius)
1177-
m = mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=true)
1177+
m = mesh!(scene, thing; color, specular = Vec3f(1.5), shininess=20f0, diffuse=Vec3f(1), transparency=color.alpha != 1)
11781178

11791179

11801180
on(t) do t

0 commit comments

Comments
 (0)