Skip to main content

sim_lib_view_spatial/
reproject_loop.rs

1//! DEVICE_3 adapter-loop wiring for the two glasses paths.
2
3use sim_lib_view_device::{AdapterLoop, DeviceProfile, FrameClock, GlanceAdapter, StalePolicy};
4
5use crate::{ClampedReprojector, halo_glance_config};
6
7/// Viture loop type: stereo reprojection over the DEVICE_3 adapter loop.
8pub type VitureReprojectLoop = AdapterLoop<ClampedReprojector>;
9
10/// Halo loop type: the configured glance adapter over the DEVICE_3 adapter loop.
11pub type HaloGlanceLoop = AdapterLoop<GlanceAdapter>;
12
13/// Builds the Viture reprojection loop and modeled clock from its profile rate.
14pub fn viture_loop(
15    profile: &DeviceProfile,
16    max_predict_ms: u64,
17) -> (VitureReprojectLoop, FrameClock) {
18    (
19        AdapterLoop::new(
20            ClampedReprojector::new(max_predict_ms),
21            StalePolicy::Predict,
22        ),
23        FrameClock::at_zero(profile.rate),
24    )
25}
26
27/// Builds the Halo glance loop and modeled clock from its profile rate.
28pub fn halo_loop(profile: &DeviceProfile) -> (HaloGlanceLoop, FrameClock) {
29    (
30        AdapterLoop::new(halo_glance_config(), StalePolicy::HoldLast),
31        FrameClock::at_zero(profile.rate),
32    )
33}