added hemispherical scattering, switched to ppm version 6

This commit is contained in:
2023-01-30 13:50:32 +01:00
parent b27c90195a
commit 899e8b7228
6 changed files with 87 additions and 539 deletions

View File

@@ -1,3 +1,6 @@
use std::rc::Rc;
use crate::material::Material;
use crate::ray::*;
use crate::vec3::*;
@@ -5,13 +8,14 @@ use crate::vec3::*;
pub struct HitRecord {
pub p: Point3,
pub normal: Vec3,
pub mat_ptr: Rc<Material>,
pub t: f64,
pub front_face: bool,
}
impl HitRecord {
pub fn new_empty() -> Self {
HitRecord { p: Point3::new(0.0, 0.0, 0.0), normal: Vec3::new(0.0, 0.0, 0.0), t: 0.0, front_face: false }
HitRecord { p: Point3::new(0.0, 0.0, 0.0), normal: Vec3::new(0.0, 0.0, 0.0), t: 0.0, front_face: false, mat_ptr: Rc::new(Material { }) }
}
pub fn set_face_normal(&mut self, r: &Ray, outward_normal: &Vec3) {