aboutsummaryrefslogtreecommitdiffstats
path: root/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'object.h')
-rw-r--r--object.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/object.h b/object.h
new file mode 100644
index 0000000..5db620e
--- /dev/null
+++ b/object.h
@@ -0,0 +1,32 @@
+#ifndef OBJECT_H
+#define OBJECT_H
+
+#include "color.h"
+#include "ray.h"
+#include "vec3.h"
+
+#include <optional>
+#include <tuple>
+
+enum class Material : int {
+ Lambertian = 0,
+ Metal,
+ Dielectric,
+ Undefined
+};
+
+struct Object
+{
+ point3 center;
+ Material M;
+ color tint;
+
+ Object(point3 center_, Material M_, color tint_):
+ center(center_), M(M_), tint(tint_) {}
+
+ virtual std::pair<color, ray> scatter(const ray& r, double root) const = 0;
+ virtual std::optional<double> hit(const ray& r, double tmin, double tmax) const = 0;
+};
+
+#endif // OBJECT_H
+