From 56bed8e38f5b6d9effd77371ad781ae71601205b Mon Sep 17 00:00:00 2001 From: ladevieq Date: Mon, 21 Dec 2020 13:51:18 +0100 Subject: Add lambertian and metallic materials --- src/sphere.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/sphere.cpp') 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) + : 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); -- cgit v1.3