diff --git a/src/main.rs b/src/main.rs index e7a11a9..b07c149 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,24 @@ -fn main() { - println!("Hello, world!"); +use pathtracer::render::Scene; +use std::path::PathBuf; +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +struct Options { + /// Input description for the scene to be rendered. + #[structopt(short, long, parse(from_os_str), default_value = "scene.yaml")] + input: PathBuf, + /// Output image for the rendered scene. + #[structopt(short, long, parse(from_os_str), default_value = "scene.png")] + output: PathBuf, +} + +fn main() -> Result<(), Box> { + let options = Options::from_args(); + let f = std::fs::File::open(options.input)?; + + let scene: Scene = serde_yaml::from_reader(f)?; + let image = scene.render(); + + image.save(options.output)?; + Ok(()) }