@@ -332,13 +332,11 @@ end
332
332
render! (scene, :: Any , args... ) = false # Fallback for systems that have no rendering
333
333
334
334
function render! (scene, :: typeof (Body), sys, sol, t)
335
- sol (sol. t[1 ], idxs= sys. render)== true || return true # yes, == true
335
+ render, radius, length_fraction, cylinder_radius = sol (sol. t[1 ], idxs= [sys. render, sys. radius, sys. length_fraction, sys. cylinder_radius]) .| > Float32
336
+ render== true || return true # yes, == true
336
337
color = get_color (sys, sol, :purple )
337
338
r_cm = get_fun (sol, collect (sys. r_cm))
338
339
framefun = get_frame_fun (sol, sys. frame_a)
339
- radius = sol (sol. t[1 ], idxs= sys. radius) |> Float32
340
- length_fraction = sol (sol. t[1 ], idxs= sys. length_fraction) |> Float32
341
- cylinder_radius = sol (sol. t[1 ], idxs= sys. cylinder_radius) |> Float32
342
340
thing = @lift begin # Sphere
343
341
Ta = framefun ($ t)
344
342
coords = (Ta* [r_cm ($ t); 1 ])[1 : 3 ] # TODO : make use of a proper transformation library instead of rolling own?
504
502
function render! (scene, :: typeof (BodyShape), sys, sol, t)
505
503
color = get_color (sys, sol, :purple )
506
504
shapepath = get_shape (sys, sol)
507
- Tshape = reshape (sol (sol. t[1 ], idxs= sys. shape_transform), 4 , 4 )
508
- scale = Vec3f (Float32 (sol (sol. t[1 ], idxs= sys. shape_scale))* ones (Float32, 3 ))
509
505
if isempty (shapepath)
510
506
radius = Float32 (sol (sol. t[1 ], idxs= sys. radius))
511
507
r_0a = get_fun (sol, collect (sys. frame_a. r_0))
@@ -520,7 +516,9 @@ function render!(scene, ::typeof(BodyShape), sys, sol, t)
520
516
mesh! (scene, thing; color, specular = Vec3f (1.5 ), shininess= 20f0 , diffuse= Vec3f (1 ), transparency= true )
521
517
else
522
518
T = get_frame_fun (sol, sys. frame_a)
523
-
519
+ scale = Vec3f (Float32 (sol (sol. t[1 ], idxs= sys. shape_scale))* ones (Float32, 3 ))
520
+ Tshape = reshape (sol (sol. t[1 ], idxs= sys. shape_transform), 4 , 4 )
521
+
524
522
@info " Loading shape mesh $shapepath "
525
523
shapemesh = FileIO. load (shapepath)
526
524
m = mesh! (scene, shapemesh; color, specular = Vec3f (1.5 ))
@@ -570,9 +568,7 @@ function render!(scene, ::typeof(BodyBox), sys, sol, t)
570
568
571
569
# NOTE: This draws a solid box without the hole in the middle. Cannot figure out how to render a hollow box
572
570
color = get_color (sys, sol, [1 , 0.2 , 1 , 0.9 ])
573
- width = Float32 (sol (sol. t[1 ], idxs= sys. width))
574
- height = Float32 (sol (sol. t[1 ], idxs= sys. height))
575
- length = Float32 (sol (sol. t[1 ], idxs= sys. render_length))
571
+ width, height, length = Float32 .(sol (sol. t[1 ], idxs= [sys. width, sys. height, sys. render_length]))
576
572
577
573
length_dir = sol (sol. t[1 ], idxs= collect (sys. render_length_dir))
578
574
width_dir = sol (sol. t[1 ], idxs= collect (sys. render_width_dir))
0 commit comments