diff options
| author | Sakarias Johansson <sakarias.johansson@goodbyekansas.com> | 2023-01-12 22:07:57 +0100 |
|---|---|---|
| committer | Sakarias Johansson <sakarias.johansson@goodbyekansas.com> | 2023-01-12 22:07:57 +0100 |
| commit | 9d44f7ab04e6f6979e0eebc24f8fb439a23a3865 (patch) | |
| tree | 5194f6bd792c8ccf7a164582a1ebb5dc51e3a98c /racer-tracer/src/material/lambertian.rs | |
| parent | a6302805d19273c95278c8d792ffbd9b2633fe20 (diff) | |
| download | racer-tracer-9d44f7ab04e6f6979e0eebc24f8fb439a23a3865.tar.gz racer-tracer-9d44f7ab04e6f6979e0eebc24f8fb439a23a3865.tar.xz racer-tracer-9d44f7ab04e6f6979e0eebc24f8fb439a23a3865.zip | |
🧹 Minor cleanup
- Made the traits into supertraits so we don't have to mention Send and
Sync everywhere.
- Add methods for Vec3 that modifies the existing Vector. Can be used
to make less copies.
Diffstat (limited to 'racer-tracer/src/material/lambertian.rs')
| -rw-r--r-- | racer-tracer/src/material/lambertian.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/racer-tracer/src/material/lambertian.rs b/racer-tracer/src/material/lambertian.rs index 8356685..d31e3e2 100644 --- a/racer-tracer/src/material/lambertian.rs +++ b/racer-tracer/src/material/lambertian.rs @@ -1,7 +1,7 @@ use crate::{ material::Material, ray::Ray, - vec3::{random_unit_vector, Color, Vec3}, + vec3::{random_unit_vector, Color}, }; pub struct Lambertian { @@ -17,7 +17,7 @@ impl Lambertian { impl Material for Lambertian { fn scatter( &self, - ray: &crate::ray::Ray, + _ray: &crate::ray::Ray, rec: &crate::geometry::HitRecord, ) -> Option<(Ray, Color)> { let mut scatter_direction = rec.normal + random_unit_vector(); @@ -27,7 +27,6 @@ impl Material for Lambertian { scatter_direction = rec.normal; } - let scattered = Ray::new(rec.point, scatter_direction); - Some((scattered, self.color)) + Some((Ray::new(rec.point, scatter_direction), self.color)) } } |
