aboutsummaryrefslogtreecommitdiff
path: root/src/object.hpp
blob: ac5122f71ddec7a44e2f4a7726894448c409b9a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef OBJECT_H
#define OBJECT_H

#include <memory>
#include "vector.hpp"
#include "ray.hpp"

class Material {
};

class Shape {
    public:
        void setMaterial(std::shared_ptr<Material> m);

        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 : public Shape {
    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 : public Shape {
    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