diff --git a/src/main.rs b/src/main.rs index 809ae7d..f291773 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,6 +50,8 @@ Usage: Options: -i , --input Input .psy file. -s , --spp Number of samples per pixel. + -t , --threads Number of threads to render with. Defaults + to the number of logical cores on the system. -h, --help Show this screen. --version Show version. "#; @@ -58,6 +60,7 @@ Options: struct Args { flag_input: Option, flag_spp: Option, + flag_threads: Option, flag_version: bool, } @@ -101,8 +104,14 @@ fn main() { r.spp = spp; } - println!("Rendering scene..."); - r.render(num_cpus::get() as u32); + let thread_count = if let Some(threads) = args.flag_threads { + threads as u32 + } else { + num_cpus::get() as u32 + }; + + println!("Rendering scene with {} threads...", thread_count); + r.render(thread_count); } } }