diff options
Diffstat (limited to 'sphere.h')
-rw-r--r-- | sphere.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -10,6 +10,7 @@ #include "viewport.h" #include "timer.h" #include "bitmap.h" +#include "material.h" #include "ray.h" #include "vec.h" #include <cstdlib> @@ -19,14 +20,17 @@ #include <iostream> #include <cstdint> +class material; + class sphere : public object { vec3d center; double radius; + class material &materi; public: sphere() = delete; - sphere(const vec3d ¢er, double radius) : center(center), radius(radius) {} + sphere(const vec3d ¢er, double radius, class material &materi) : center(center), radius(radius), materi(materi) {} ~sphere() override = default; @@ -35,6 +39,10 @@ public: return (where - center) / radius; } + class material &material() const override { + return materi; + } + bool hit(const ray3d &r, double &t, double t1, double t2) const override { // Ray: {Source, Direction, time} // Sphere: {Center, radius} |