-
Notifications
You must be signed in to change notification settings - Fork 1
/
bsdf.h
74 lines (58 loc) · 1.7 KB
/
bsdf.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef _BSDF_H_
#define _BSDF_H_
namespace Renzoku {
class Bsdf {
public:
enum Type {
LAMBERTIAN = 0,
WARD = 1,
PHONG = 2,
GLASS = 3,
MIRROR = 4,
THIN_TRANSPARENT = 5,
THIN_TRANSLUCENT = 6
};
virtual Bsdf::Type get_bsdf_type() const = 0;
/**
* Sample an in-going direction from the BRDF given an out-going direction.
*/
virtual Rgb sample(Random &rd, const Onb &uvn, const Vec3 &wo, Vec3 &wi, Float &pdf) = 0;
/**
* Evaluate the BRDF value given an in, out direction.
*/
virtual Rgb eval(const Onb &uvn, const Vec3 &wo, const Vec3 &wi) = 0;
/**
* Compute the probability of sampling the direction \wi.
*/
virtual Float pdf(const Onb &uvn, const Vec3 &wo, const Vec3 &wi) = 0;
/**
* Return true if there is only a single ray that can be sampled from this material. Example: glass, mirror.
*/
virtual bool is_singular() const { return false; }
/**
* Return true if the material lets ray pass through.
*/
virtual bool is_transmissive() const { return false; }
bool is_specular() const {
return this->get_bsdf_type() != LAMBERTIAN;
}
bool is_diffuse() const {
return this->get_bsdf_type() == LAMBERTIAN;
}
};
class IDiffuse {
public:
virtual Rgb get_diffuse_component() const = 0;
};
class ISpecular {
public:
virtual Rgb get_specular_component() const = 0;
/**
* The degree of glossiness approximated by the Phong exponent.
*
* This is for classifying glossy materials, not for sampling or evaluation.
*/
virtual Float get_gloss_exponential() const = 0;
};
} // end namespace
#endif