Actively use image library for exporting
This commit is contained in:
parent
69b77db716
commit
223ac1eb24
1 changed files with 6 additions and 6 deletions
12
src/main.rs
12
src/main.rs
|
@ -72,10 +72,10 @@ fn main() {
|
||||||
default_file = &args[1];
|
default_file = &args[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
//let mut image = RgbImage::new(image_width, image_height);
|
let mut image = RgbImage::new(image_width, image_height);
|
||||||
|
|
||||||
let mut file = BufWriter::new(File::create(default_file).unwrap());
|
//let mut file = BufWriter::new(File::create(default_file).unwrap());
|
||||||
writeln!(&mut file, "P3\n{image_width} {image_height}\n255\n").unwrap();
|
//writeln!(&mut file, "P3\n{image_width} {image_height}\n255\n").unwrap();
|
||||||
|
|
||||||
for j in (0..image_height).rev() {
|
for j in (0..image_height).rev() {
|
||||||
eprint!("\rScanlines remaining: {j:5}");
|
eprint!("\rScanlines remaining: {j:5}");
|
||||||
|
@ -88,11 +88,11 @@ fn main() {
|
||||||
);
|
);
|
||||||
let pixel_color = ray_color(&r, &mut world);
|
let pixel_color = ray_color(&r, &mut world);
|
||||||
|
|
||||||
color::write_color(&mut file, &pixel_color);
|
//color::write_color(&mut file, &pixel_color);
|
||||||
//color::put_color(&mut image, &pixel_color, image_width-i-1, image_height-j-1);
|
color::put_color(&mut image, &pixel_color, image_width-i-1, image_height-j-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//image.save(default_file).unwrap();
|
image.save(default_file).unwrap();
|
||||||
eprintln!("\nDone!");
|
eprintln!("\nDone!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue