From 30b972ce5c21f6cb087fbf9f75114c31c07706d4 Mon Sep 17 00:00:00 2001 From: "max.nuding" Date: Mon, 11 Jul 2022 08:11:07 +0200 Subject: [PATCH] Add example to lower system load --- .gitignore | 1 + src/main.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e1d680e..bcfd494 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .idea *.iml .vscode/ +*.png diff --git a/src/main.rs b/src/main.rs index c75c992..d0a3a93 100644 --- a/src/main.rs +++ b/src/main.rs @@ -117,6 +117,7 @@ fn cornell_box() -> Scene { ))); // Boxes + let rotated1 = RotateY::new( Cuboid::new( Point3::new(0.0, 0.0, 0.0), @@ -144,7 +145,6 @@ fn cornell_box() -> Scene { ); world.push(Arc::new(box2)); - let look_from = Point3::new(278.0, 278.0, -800.0); let look_at = Point3::new(278.0, 278.0, 0.0); let focus_dist = 2.0; @@ -493,6 +493,7 @@ fn main() { let image_height: usize = (IMAGE_WIDTH as f64 / scene_setup.cam.aspect_ratio()) as usize; let mut pixels = vec![0; IMAGE_WIDTH * image_height * 3]; let bands: Vec<(usize, &mut [u8])> = pixels.chunks_mut(3).enumerate().collect(); + //rayon::ThreadPoolBuilder::new().num_threads(3).build_global().unwrap(); // Enable, to reduce load let count = Mutex::new(0); bands.into_par_iter().for_each(|(i, pixel)| { let row = image_height - (i / IMAGE_WIDTH) - 1;