From 809d7b678b84fc54b980dceb6d2c2614089ea69e Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Sat, 19 Aug 2023 18:44:57 -0500 Subject: [PATCH] Clean up some leftovers Quickly sweeping up a few bits and pieces that got left around. This seems like an okay way to load the codebase into my brain before doing the big rearranging. --- src/camera.rs | 11 ----------- src/main.rs | 31 +++++++------------------------ src/material.rs | 2 -- 3 files changed, 7 insertions(+), 37 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 58482bf..7b109d1 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -1,15 +1,4 @@ -/* - * let viewport = (aspect_ratio * 2.0, 2.0); - let focal_length = 1.0; - - let origin = Vec3::new(0.0, 0.0, 0.0); - let horizontal = Vec3::new(viewport.0, 0.0, 0.0); - let vertical = Vec3::new(0.0, viewport.1, 0.0); - - let lower_left_corner = origin - horizontal/2.0 - vertical/2.0 - Vec3::new(0.0, 0.0, focal_length); - */ - use crate::vec3::Vec3; use crate::ray::Ray; use crate::degrees_to_radians; diff --git a/src/main.rs b/src/main.rs index 8625dd1..adbc408 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ - mod vec3; mod ray; mod camera; @@ -18,10 +17,9 @@ use rand::{Rng, SeedableRng}; use rand::rngs::SmallRng; use rand::distributions::Uniform; -use itertools; use itertools::Itertools; -use std::ops; +use std::ops; use std::thread; fn main() { @@ -42,19 +40,14 @@ fn main() { // camera - let lookfrom = Vec3::new(13.0, 2.0, 3.0); - let lookat = Vec3::zero(); - let vup = Vec3::new(0.0, 1.0, 0.0); - let dist_to_focus = 10.0; - let aperture = 0.1; let cam = Camera::new( - lookfrom, - lookat, - vup, + Vec3::new(13.0, 2.0, 3.0), // lookfrom + Vec3::zero(), // lookat + Vec3::new(0.0, 1.0, 0.0), // vup 20.0, - aspect_ratio, - aperture, - dist_to_focus + aspect_ratio, + 0.1, // aperture + 10.0, // dist_to_focus ); // render @@ -185,16 +178,6 @@ fn sample_pixel(x: i32, y: i32, small_rng: &mut SmallRng, context: &RenderContex ) } -fn range2d(bounds: (i32, i32, i32, i32)) -> impl Iterator { - let rheight = bounds.1..(bounds.1+bounds.3); - rheight.flat_map(move |y| { - let rwidth = bounds.0..(bounds.0+bounds.2); - rwidth.map( move |x| { - (x, y) - }) - }) -} - #[derive (Copy, Clone)] struct Rect { x: i32, diff --git a/src/material.rs b/src/material.rs index d94cffb..f9ff8ce 100644 --- a/src/material.rs +++ b/src/material.rs @@ -8,8 +8,6 @@ use rand::Rng; use rand::rngs::SmallRng; use rand::distributions::Uniform; - - #[derive(Copy, Clone, Debug)] pub enum Material{ Lambertian { albedo: Vec3 },