aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-02-12 23:33:50 +0100
committerJulian T <julian@jtle.dk>2021-02-12 23:34:09 +0100
commit14f7b47f2c2315d0de5e52d31c57fe07a15d08ad (patch)
treef512e7e0939fd151cf9196004611e3cd82a95773 /src/main.rs
parent49c6adb0db70ffc30eaac33b66eacf7574b34e26 (diff)
Implement multithreaded compiling of tiles
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index 215e0d4..0f6502e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,7 +6,7 @@ use rendering::render::{RenderContext, RenderCoord};
use rendering::sample::UniformSampler;
use rendering::material::{Reflectant, Lambertian};
-use std::rc::Rc;
+use std::sync::Arc;
fn main() {
let res = Vector2i::new_xy(500, 500);
@@ -21,9 +21,9 @@ fn main() {
aperture: Some(20.0),
});
- let brown = Rc::new(Lambertian::new(Spectrum::new_rgb(0.5, 0.3, 0.0)));
- let blue = Rc::new(Lambertian::new(Spectrum::new_rgb(0.0, 0.3, 0.7)));
- let metal = Rc::new(Reflectant::new(Spectrum::new_rgb(0.75, 0.75, 0.75), None));
+ let brown = Arc::new(Lambertian::new(Spectrum::new_rgb(0.5, 0.3, 0.0)));
+ let blue = Arc::new(Lambertian::new(Spectrum::new_rgb(0.0, 0.3, 0.7)));
+ let metal = Arc::new(Reflectant::new(Spectrum::new_rgb(0.75, 0.75, 0.75), None));
let mut scn = Scene::new();
scn.add_objects(vec![
@@ -40,9 +40,9 @@ fn main() {
let mut film = Film::new(res);
{
- let coord = RenderCoord::new(&mut film, Vector2i::new_xy(32, 32), 100);
+ let coord = RenderCoord::new(&mut film, Vector2i::new_xy(32, 32), 300);
- coord.work(&ctx, &mut sampler);
+ coord.run_threaded(&ctx, &mut sampler, 8);
}
let image = film.finalize_image();