camera: make supersampling configurable, wire it up in eoc8.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-07-18 20:30:06 -07:00
parent c4f10126e3
commit 839642b886
2 changed files with 34 additions and 21 deletions

View File

@@ -22,6 +22,10 @@ use rtchallenge::{
struct Opt {
#[structopt(long, default_value = "rayon")]
render_strategy: RenderStrategy,
/// Number of samples per pixel. 0 renders from the center of the pixel, 1 or more samples N
/// times randomly across the pixel.
#[structopt(short, long, default_value = "0")]
samples: usize,
}
fn main() -> Result<()> {
@@ -38,6 +42,7 @@ fn main() -> Result<()> {
let up = Tuple::point(0., 1., 0.);
camera.set_transform(view_transform(from, to, up));
camera.render_strategy = opt.render_strategy;
camera.samples_per_pixel = opt.samples;
let mut floor = Sphere::default();
floor.set_transform(Matrix4x4::scaling(10., 0.01, 10.));