forked from StudioInfinity/dyna3
Simplify sphere data passing
This commit is contained in:
parent
cedb1d5b83
commit
68abc2ad44
1 changed files with 6 additions and 6 deletions
|
@ -517,7 +517,7 @@ pub fn Display() -> View {
|
|||
|
||||
// write the spheres in world coordinates
|
||||
let sphere_reps_world: Vec<_> = scene.spheres.representations.into_iter().map(
|
||||
|rep| &asm_to_world * rep
|
||||
|rep| (&asm_to_world * rep).cast::<f32>()
|
||||
).collect();
|
||||
|
||||
/* SCAFFOLDING */
|
||||
|
@ -554,17 +554,17 @@ pub fn Display() -> View {
|
|||
ctx.uniform2f(resolution_loc.as_ref(), width, height);
|
||||
ctx.uniform1f(shortdim_loc.as_ref(), width.min(height));
|
||||
|
||||
// pass the assembly data
|
||||
// pass the scene data
|
||||
ctx.uniform1i(sphere_cnt_loc.as_ref(), sphere_cnt);
|
||||
for n in 0..sphere_reps_world.len() {
|
||||
let v = &sphere_reps_world[n];
|
||||
ctx.uniform3f(
|
||||
ctx.uniform3fv_with_f32_array(
|
||||
sphere_sp_locs[n].as_ref(),
|
||||
v[0] as f32, v[1] as f32, v[2] as f32
|
||||
v.rows(0, 3).as_slice()
|
||||
);
|
||||
ctx.uniform2f(
|
||||
ctx.uniform2fv_with_f32_array(
|
||||
sphere_lt_locs[n].as_ref(),
|
||||
v[3] as f32, v[4] as f32
|
||||
v.rows(3, 2).as_slice()
|
||||
);
|
||||
ctx.uniform3fv_with_f32_array(
|
||||
sphere_color_locs[n].as_ref(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue