This commit is contained in:
2023-02-01 22:30:20 +01:00
parent 0a70a1e1de
commit 560b2b1196
5 changed files with 21 additions and 27 deletions

View File

@@ -10,6 +10,8 @@ pub mod material;
use std::{io::{BufWriter, Write, stdout}, fs::File, time::Instant};
use material::Metal;
use crate::{
color::*,
sphere::*,
@@ -22,7 +24,7 @@ use crate::{
};
fn ray_color(r: &Ray, world: &mut dyn Hittable, depth: i32) -> Color {
let mut rec = HitRecord::new_empty();
let mut rec = HitRecord::new_empty(&Metal{ albedo: Color::new_empty() });
// Limit the bounces
if depth <= 0 {
@@ -33,7 +35,7 @@ fn ray_color(r: &Ray, world: &mut dyn Hittable, depth: i32) -> Color {
let mut scattered = Ray::new_empty();
let mut attenuation = Color::new_empty();
if rec.mat_ptr
//if rec.mat_ptr
}
let unit_direction: Vec3 = r.direction().unit_vector();
@@ -52,8 +54,8 @@ fn main() {
// World
let mut world = HittableList::new_empty();
world.add(Box::new(Sphere::new(Point3::new(0.0, 0.0, -1.0), 0.5)));
world.add(Box::new(Sphere::new(Point3::new(0.0, -100.5, -1.0), 100.0)));
//world.add(Box::new(Sphere::new(Point3::new(0.0, 0.0, -1.0), 0.5)));
//world.add(Box::new(Sphere::new(Point3::new(0.0, -100.5, -1.0), 100.0)));
// Camera
let cam = Camera::new();