1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use bvh::Vector3;
use material::Material;
use std::f32::INFINITY;

#[derive(Copy, Clone)]
pub struct Hit {
	pub p: Vector3,
	pub n: Vector3,
	pub t: f32,
	pub b: Vector3,
	pub material: Material,
}

impl Hit {
	// Spawn a new Hit result data structure
	pub fn new(p: Vector3, n: Vector3, t: f32, b: Vector3, material: Material) -> Hit {
		Hit {
			p,
			n,
			t,
			b,
			material,
		}
	}

	pub fn init() -> Hit {
		Hit {
			p: Vector3::new(0.0, 0.0, 0.0),
			n: Vector3::new(0.0, 0.0, 0.0),
			t: INFINITY,
			b: Vector3::new(0.0, 0.0, 0.0),
			material: Material::black(),
		}
	}
}