Application prototype #14

Merged
glen merged 101 commits from app-proto into main 2024-10-21 23:38:28 +00:00
Showing only changes of commit 18ebf3be2c - Show all commits

View File

@ -98,6 +98,7 @@ pub fn Display() -> View {
let roll_cw = create_signal(0.0); let roll_cw = create_signal(0.0);
let zoom_in = create_signal(0.0); let zoom_in = create_signal(0.0);
let zoom_out = create_signal(0.0); let zoom_out = create_signal(0.0);
let turntable = create_signal(false); /* BENCHMARKING */
// change listener // change listener
let scene_changed = create_signal(true); let scene_changed = create_signal(true);
@ -120,6 +121,7 @@ pub fn Display() -> View {
// viewpoint // viewpoint
const ROT_SPEED: f64 = 0.4; // in radians per second const ROT_SPEED: f64 = 0.4; // in radians per second
const ZOOM_SPEED: f64 = 0.15; // multiplicative rate per second const ZOOM_SPEED: f64 = 0.15; // multiplicative rate per second
const TURNTABLE_SPEED: f64 = 0.1; /* BENCHMARKING */
let mut orientation = DMatrix::<f64>::identity(5, 5); let mut orientation = DMatrix::<f64>::identity(5, 5);
let mut rotation = DMatrix::<f64>::identity(5, 5); let mut rotation = DMatrix::<f64>::identity(5, 5);
let mut location_z: f64 = 5.0; let mut location_z: f64 = 5.0;
@ -242,6 +244,7 @@ pub fn Display() -> View {
let roll_cw_val = roll_cw.get(); let roll_cw_val = roll_cw.get();
let zoom_in_val = zoom_in.get(); let zoom_in_val = zoom_in.get();
let zoom_out_val = zoom_out.get(); let zoom_out_val = zoom_out.get();
let turntable_val = turntable.get(); /* BENCHMARKING */
// update the assembly's orientation // update the assembly's orientation
let ang_vel = { let ang_vel = {
@ -253,6 +256,10 @@ pub fn Display() -> View {
} else { } else {
Vector3::zeros() Vector3::zeros()
} }
} /* BENCHMARKING */ + if turntable_val {
Vector3::new(0.0, TURNTABLE_SPEED, 0.0)
} else {
Vector3::zeros()
}; };
let mut rotation_sp = rotation.fixed_view_mut::<3, 3>(0, 0); let mut rotation_sp = rotation.fixed_view_mut::<3, 3>(0, 0);
rotation_sp.copy_from( rotation_sp.copy_from(
@ -352,6 +359,7 @@ pub fn Display() -> View {
|| roll_ccw_val != 0.0 || roll_ccw_val != 0.0
|| zoom_in_val != 0.0 || zoom_in_val != 0.0
|| zoom_out_val != 0.0 || zoom_out_val != 0.0
|| turntable_val /* BENCHMARKING */
); );
} else { } else {
frames_since_last_sample = 0; frames_since_last_sample = 0;
@ -401,6 +409,10 @@ pub fn Display() -> View {
pitch_up.set(0.0); pitch_up.set(0.0);
pitch_down.set(0.0); pitch_down.set(0.0);
} else { } else {
if event.key() == "Enter" { /* BENCHMARKING */
turntable.set_fn(|turn| !turn);
scene_changed.set(true);
}
set_nav_signal(event, 1.0); set_nav_signal(event, 1.0);
} }
}, },