diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2020-12-21 13:51:18 +0100 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2020-12-21 13:51:18 +0100 |
| commit | 56bed8e38f5b6d9effd77371ad781ae71601205b (patch) | |
| tree | 1f57155b8f5b15fd2b33ac7e926e3e5d0ce1754c /src/sphere.cpp | |
| parent | 92d66138f53645f3400f633c9821a6fa36f589e0 (diff) | |
Add lambertian and metallic materials
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); |
