Encapsulate construction
This commit is contained in:
parent
a4236a34df
commit
121934c4c3
@ -83,6 +83,22 @@ fn bind_vertex_attrib(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn push_gen_test_construction(
|
||||||
|
sphere_vec: &mut Vec<DVector<f64>>,
|
||||||
|
construction_to_world: &DMatrix<f64>,
|
||||||
|
ctrl_x: f64,
|
||||||
|
ctrl_y: f64,
|
||||||
|
radius_x: f64,
|
||||||
|
radius_y: f64
|
||||||
|
) {
|
||||||
|
sphere_vec.push(construction_to_world * engine::sphere(0.5, 0.5, ctrl_x, radius_x));
|
||||||
|
sphere_vec.push(construction_to_world * engine::sphere(-0.5, -0.5, ctrl_y, radius_y));
|
||||||
|
sphere_vec.push(construction_to_world * engine::sphere(-0.5, 0.5, 0.0, 0.75));
|
||||||
|
sphere_vec.push(construction_to_world * engine::sphere(0.5, -0.5, 0.0, 0.5));
|
||||||
|
sphere_vec.push(construction_to_world * engine::sphere(0.0, 0.15, 1.0, 0.25));
|
||||||
|
sphere_vec.push(construction_to_world * engine::sphere(0.0, -0.15, -1.0, 0.25));
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// set up a config option that forwards panic messages to `console.error`
|
// set up a config option that forwards panic messages to `console.error`
|
||||||
#[cfg(feature = "console_error_panic_hook")]
|
#[cfg(feature = "console_error_panic_hook")]
|
||||||
@ -292,12 +308,12 @@ fn main() {
|
|||||||
|
|
||||||
// update the construction
|
// update the construction
|
||||||
sphere_vec.clear();
|
sphere_vec.clear();
|
||||||
sphere_vec.push(&construction_to_world * engine::sphere(0.5, 0.5, ctrl_x.get(), radius_x.get()));
|
push_gen_test_construction(
|
||||||
sphere_vec.push(&construction_to_world * engine::sphere(-0.5, -0.5, ctrl_y.get(), radius_y.get()));
|
&mut sphere_vec,
|
||||||
sphere_vec.push(&construction_to_world * engine::sphere(-0.5, 0.5, 0.0, 0.75));
|
&construction_to_world,
|
||||||
sphere_vec.push(&construction_to_world * engine::sphere(0.5, -0.5, 0.0, 0.5));
|
ctrl_x.get(), ctrl_y.get(),
|
||||||
sphere_vec.push(&construction_to_world * engine::sphere(0.0, 0.15, 1.0, 0.25));
|
radius_x.get(), radius_y.get()
|
||||||
sphere_vec.push(&construction_to_world * engine::sphere(0.0, -0.15, -1.0, 0.25));
|
);
|
||||||
|
|
||||||
// set the resolution
|
// set the resolution
|
||||||
let width = canvas.width() as f32;
|
let width = canvas.width() as f32;
|
||||||
|
Loading…
Reference in New Issue
Block a user