camera: correct x/y calculations in Camera::render.

This commit is contained in:
Bill Thiede 2021-07-17 21:52:11 -07:00
parent 059f710706
commit e752536430

View File

@ -147,8 +147,8 @@ impl Camera {
/// ```
pub fn render(&self, w: &World) -> Canvas {
let mut image = Canvas::new(self.hsize, self.vsize, BLACK);
for y in 0..self.hsize {
for x in 0..self.vsize {
for y in 0..self.vsize {
for x in 0..self.hsize {
let ray = self.ray_for_pixel(x, y);
let color = w.color_at(&ray);
image.set(x, y, color);