csci5607/assignment-0/src/main.rs

34 lines
567 B
Rust
Raw Normal View History

2023-01-21 08:03:11 +00:00
use std::{fs::File, path::PathBuf};
use anyhow::Result;
use clap::Parser;
use crate::value_noise::generate_noise;
mod ppm;
mod value_noise;
mod vec2;
#[derive(Parser)]
struct Opt {
#[clap(short = 'o', long = "out", default_value = "out.ppm")]
output_path: PathBuf,
}
fn main() -> Result<()> {
let opt = Opt::parse();
let rng = rand::thread_rng();
let width = 256;
let height = 256;
let ppm = generate_noise(width, height, rng);
{
let file = File::create(opt.output_path)?;
ppm.write(file)?;
}
Ok(())
}