-
Notifications
You must be signed in to change notification settings - Fork 0
/
material.h
56 lines (42 loc) · 1008 Bytes
/
material.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef MATERIAL_H
#define MATERIAL_H
#include "rtweekend.h"
#include "ray.h"
#include "hittable.h"
class HitRecord;
class Material {
public:
virtual bool scatter(
const Ray& ray, const HitRecord& rec, Colour& attenuation, Ray& scattered
) const = 0;
};
class Metal : public Material {
private:
Colour albedo;
double fuzz;
public:
Metal(const Colour& alb, double f);
virtual bool scatter(
const Ray& ray, const HitRecord& rec, Colour& attenuation, Ray& scattered
) const override;
};
class Dielectric : public Material {
private:
double indexOfRefraction;
static double reflectance(double cosine, double refIndex);
public:
Dielectric(double ir);
virtual bool scatter(
const Ray& ray, const HitRecord& rec, Colour& attenuation, Ray& scattered
) const override;
};
class Lambertian : public Material {
private:
Colour albedo;
public:
Lambertian(const Colour& alb);
virtual bool scatter(
const Ray& ray, const HitRecord& rec, Colour& attenuation, Ray& scattered
) const override;
};
#endif