aboutsummaryrefslogtreecommitdiff
path: root/src/object.hpp
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-07-26 12:56:27 +0200
committerJulian T <julian@jtle.dk>2020-07-26 12:56:27 +0200
commit893176a0b18a2281abe09def716ccc3db5583c3f (patch)
treea34da79b7dc0fcdbdd39e2a3f4000cc6a1c0a896 /src/object.hpp
parent18960c4b88ce912e08b12182b835a7de75388b78 (diff)
Implemented object intersection and startet work on render gui
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