diff options
Diffstat (limited to 'src/sphere.cpp')
| -rw-r--r-- | src/sphere.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sphere.cpp b/src/sphere.cpp index 31915a2..611dc34 100644 --- a/src/sphere.cpp +++ b/src/sphere.cpp @@ -1,6 +1,7 @@ #include "sphere.hpp" -sphere::sphere(point3 center, double radius) : center(center), radius(radius) +sphere::sphere(point3 center, double radius, std::shared_ptr<material> material) + : center(center), radius(radius), mat_ptr(material) {} bool sphere::hit(const ray& r, double t_min, double t_max, struct hit_info& info) const { @@ -29,6 +30,7 @@ bool sphere::hit(const ray& r, double t_min, double t_max, struct hit_info& info info.t = t; info.point = r.at(t); + info.mat_ptr = mat_ptr; vec3 out_normal = (info.point - center).unit(); info.set_face_normal(r, out_normal); |
