aboutsummaryrefslogtreecommitdiff
path: root/src/object.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/object.hpp')
-rw-r--r--src/object.hpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/object.hpp b/src/object.hpp
index 56c6968..3194dac 100644
--- a/src/object.hpp
+++ b/src/object.hpp
@@ -3,17 +3,41 @@
#include <memory>
#include "vector.hpp"
+#include "ray.hpp"
class Material {
- Vec3d color;
-
- double defuse;
- double emissive;
};
class Object {
public:
- std::shared_ptr<Material> m;
+ void setMaterial(std::shared_ptr<Material> m);
+
+ std::shared_ptr<Material> m_mat;
+
+ virtual Vec3d norm_at(const Vec3d &point, const Vec3d &indir) const = 0;
+ virtual double intersect(const Ray &ray, bool skip_dist) const = 0;
+};
+
+class Sphere : Object {
+ public:
+ Sphere(Vec3d center, double radius);
+ Vec3d norm_at(const Vec3d &point, const Vec3d &indir) const;
+ double intersect(const Ray &ray, bool skip_dist) const;
+
+ private:
+ Vec3d m_center;
+ double m_radius;
+};
+
+class Plane : Object {
+ public:
+ Plane(Vec3d start, Vec3d norm);
+ Vec3d norm_at(const Vec3d &point, const Vec3d &indir) const;
+ double intersect(const Ray &ray, bool skip_dist) const;
+
+ private:
+ Vec3d m_start;
+ Vec3d m_norm;
};
#endif