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.
This commit is contained in:
2023-08-19 18:44:57 -05:00
parent fc8f9e0e15
commit 809d7b678b
3 changed files with 7 additions and 37 deletions

View File

@@ -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;

View File

@@ -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<Item = (i32, i32)> {
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,

View File

@@ -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 },