Add percent complete readout in terminal

This commit is contained in:
maddiebaka
2023-06-14 22:37:18 -04:00
parent 826a85bc36
commit 0a9a799cb3
4 changed files with 215 additions and 23 deletions

View File

@@ -58,6 +58,14 @@ impl PerspectiveCamera {
dir: Vec3::new(sensor_x, sensor_y, 1.0).normalize(),
}
}
pub fn percent_complete(&self, row: u32) -> f64 {
let float_row = row as f64;
let float_scene_height = self.scene_height as f64;
let float_scene_width = self.scene_width as f64;
((float_row * float_scene_width) / (float_scene_width * float_scene_height)) * 100.0
}
}
impl RaySource for PerspectiveCamera {