aboutsummaryrefslogtreecommitdiffstats
path: root/object.h
blob: 5db620e53a73b5ebc93516889f5959d7045ecc48 (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
#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