aboutsummaryrefslogtreecommitdiff
path: root/src/material/reflectant.rs
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-08-01 23:24:44 +0200
committerJulian T <julian@jtle.dk>2021-08-01 23:24:44 +0200
commit13e018067631a7401df5b232f95f3d1f7a0cd75c (patch)
tree2c91fe273cfeab48548ffb77c3392bdbdad650a5 /src/material/reflectant.rs
parent86ad7845219e8db06fe47b62794180e1b40f90a5 (diff)
Readd reflective material
Diffstat (limited to 'src/material/reflectant.rs')
-rw-r--r--src/material/reflectant.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/material/reflectant.rs b/src/material/reflectant.rs
index dea7aca..b5ec0ae 100644
--- a/src/material/reflectant.rs
+++ b/src/material/reflectant.rs
@@ -18,14 +18,14 @@ impl Reflectant {
}
}
-fn reflect(v: &Vector3f, n: &Vector3f) -> Vector3f {
- *v - *n * (2.0 * v.dot(n))
+pub fn reflect(v: Vector3f, n: Vector3f) -> Vector3f {
+ v - n * (2.0 * v.dot(&n))
}
impl Material for Reflectant {
fn scatter(&self, ray: &Ray, i: &Intersection, sampler: &mut dyn Sampler) -> Option<(Spectrum, Ray)> {
// Find reflectance vector
- let mut reflected = reflect(&ray.direction, &i.n);
+ let mut reflected = reflect(ray.direction, i.n);
if let Some(fuzz) = self.fuzz {
reflected += &(sampler.get_unit_vector() * fuzz);
}