latest
This commit is contained in:
@@ -23,7 +23,7 @@ use crate::{
|
||||
camera::*,
|
||||
};
|
||||
|
||||
fn ray_color(r: &Ray, world: &mut dyn Hittable, depth: i32) -> Color {
|
||||
fn ray_color(r: &Ray, world: &dyn Hittable, depth: i32) -> Color {
|
||||
let mut rec = HitRecord::new_empty(&Metal{ albedo: Color::new_empty() });
|
||||
|
||||
// Limit the bounces
|
||||
@@ -31,7 +31,7 @@ fn ray_color(r: &Ray, world: &mut dyn Hittable, depth: i32) -> Color {
|
||||
return Color::new(0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
if world.hit(r, 0.001, INFINITY, &mut rec) {
|
||||
if let Some(rec) = world.hit(r, 0.001, INFINITY) {
|
||||
let mut scattered = Ray::new_empty();
|
||||
let mut attenuation = Color::new_empty();
|
||||
|
||||
@@ -54,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