From 18ebf3be2c8a9caf0cdec3338bd6ecb1333a144e Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Mon, 30 Sep 2024 00:44:13 -0700 Subject: [PATCH] Display: add turntable for benchmarking Together with 25fa108 and 4f8f360, this lets us do a benchmarking routine for `full-interface` which is comparable to the one we've been using for `inversive-display`. --- app-proto/full-interface/src/display.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app-proto/full-interface/src/display.rs b/app-proto/full-interface/src/display.rs index 67062b7..c32b470 100644 --- a/app-proto/full-interface/src/display.rs +++ b/app-proto/full-interface/src/display.rs @@ -98,6 +98,7 @@ pub fn Display() -> View { let roll_cw = create_signal(0.0); let zoom_in = create_signal(0.0); let zoom_out = create_signal(0.0); + let turntable = create_signal(false); /* BENCHMARKING */ // change listener let scene_changed = create_signal(true); @@ -120,6 +121,7 @@ pub fn Display() -> View { // viewpoint const ROT_SPEED: f64 = 0.4; // in radians per second const ZOOM_SPEED: f64 = 0.15; // multiplicative rate per second + const TURNTABLE_SPEED: f64 = 0.1; /* BENCHMARKING */ let mut orientation = DMatrix::::identity(5, 5); let mut rotation = DMatrix::::identity(5, 5); let mut location_z: f64 = 5.0; @@ -242,6 +244,7 @@ pub fn Display() -> View { let roll_cw_val = roll_cw.get(); let zoom_in_val = zoom_in.get(); let zoom_out_val = zoom_out.get(); + let turntable_val = turntable.get(); /* BENCHMARKING */ // update the assembly's orientation let ang_vel = { @@ -253,6 +256,10 @@ pub fn Display() -> View { } else { 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); rotation_sp.copy_from( @@ -352,6 +359,7 @@ pub fn Display() -> View { || roll_ccw_val != 0.0 || zoom_in_val != 0.0 || zoom_out_val != 0.0 + || turntable_val /* BENCHMARKING */ ); } else { frames_since_last_sample = 0; @@ -401,6 +409,10 @@ pub fn Display() -> View { pitch_up.set(0.0); pitch_down.set(0.0); } else { + if event.key() == "Enter" { /* BENCHMARKING */ + turntable.set_fn(|turn| !turn); + scene_changed.set(true); + } set_nav_signal(event, 1.0); } },