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:
@@ -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;
|
||||
|
||||
31
src/main.rs
31
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<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,
|
||||
|
||||
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user