Application prototype #14
@ -266,7 +266,7 @@ pub fn Display() -> View {
|
|||||||
frames_since_last_sample = 0;
|
frames_since_last_sample = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the map from construction space to world space
|
// find the map from assembly space to world space
|
||||||
let location = {
|
let location = {
|
||||||
let u = -location_z;
|
let u = -location_z;
|
||||||
DMatrix::from_column_slice(5, 5, &[
|
DMatrix::from_column_slice(5, 5, &[
|
||||||
@ -277,12 +277,12 @@ pub fn Display() -> View {
|
|||||||
0.0, 0.0, 0.0, 0.0, 1.0
|
0.0, 0.0, 0.0, 0.0, 1.0
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
let construction_to_world = &location * &orientation;
|
let assembly_to_world = &location * &orientation;
|
||||||
|
|
||||||
// get the construction
|
// get the assembly
|
||||||
let elements = state.assembly.elements.get_clone();
|
let elements = state.assembly.elements.get_clone();
|
||||||
let element_iter = (&elements).into_iter();
|
let element_iter = (&elements).into_iter();
|
||||||
let reps_world: Vec<_> = element_iter.clone().map(|elt| &construction_to_world * &elt.rep).collect();
|
let reps_world: Vec<_> = element_iter.clone().map(|elt| &assembly_to_world * &elt.rep).collect();
|
||||||
let colors: Vec<_> = element_iter.map(|elt| elt.color).collect();
|
let colors: Vec<_> = element_iter.map(|elt| elt.color).collect();
|
||||||
|
|
||||||
// set the resolution
|
// set the resolution
|
||||||
@ -291,7 +291,7 @@ pub fn Display() -> View {
|
|||||||
ctx.uniform2f(resolution_loc.as_ref(), width, height);
|
ctx.uniform2f(resolution_loc.as_ref(), width, height);
|
||||||
ctx.uniform1f(shortdim_loc.as_ref(), width.min(height));
|
ctx.uniform1f(shortdim_loc.as_ref(), width.min(height));
|
||||||
|
|
||||||
// pass the construction
|
// pass the assembly
|
||||||
ctx.uniform1i(sphere_cnt_loc.as_ref(), elements.len() as i32);
|
ctx.uniform1i(sphere_cnt_loc.as_ref(), elements.len() as i32);
|
||||||
for n in 0..reps_world.len() {
|
for n in 0..reps_world.len() {
|
||||||
let v = &reps_world[n];
|
let v = &reps_world[n];
|
||||||
|
@ -13,7 +13,7 @@ struct vecInv {
|
|||||||
|
|
||||||
// --- uniforms ---
|
// --- uniforms ---
|
||||||
|
|
||||||
// construction
|
// assembly
|
||||||
const int SPHERE_MAX = 200;
|
const int SPHERE_MAX = 200;
|
||||||
uniform int sphere_cnt;
|
uniform int sphere_cnt;
|
||||||
uniform vecInv sphere_list[SPHERE_MAX];
|
uniform vecInv sphere_list[SPHERE_MAX];
|
||||||
|
Loading…
Reference in New Issue
Block a user