latest
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user