latest
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::material::Material;
|
||||
use crate::ray::*;
|
||||
use crate::vec3::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct HitRecord {
|
||||
pub struct HitRecord<'a> {
|
||||
pub p: Point3,
|
||||
pub normal: Vec3,
|
||||
pub mat_ptr: Rc<Material>,
|
||||
pub mat_ptr: &'a dyn 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, mat_ptr: Rc::new(Material { }) }
|
||||
impl HitRecord<'_> {
|
||||
pub fn new_empty<T: Material>(material: &T) -> 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, mat_ptr: material }
|
||||
}
|
||||
|
||||
pub fn set_face_normal(&mut self, r: &Ray, outward_normal: &Vec3) {
|
||||
|
||||
Reference in New Issue
Block a user