forked from wjakob/nori
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdielectric.cpp
62 lines (49 loc) · 1.78 KB
/
dielectric.cpp
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
/*
This file is part of Nori, a simple educational ray tracer
Copyright (c) 2015 by Wenzel Jakob
Nori is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License Version 3
as published by the Free Software Foundation.
Nori is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <nori/bsdf.h>
#include <nori/frame.h>
NORI_NAMESPACE_BEGIN
/// Ideal dielectric BSDF
class Dielectric : public BSDF {
public:
Dielectric(const PropertyList &propList) {
/* Interior IOR (default: BK7 borosilicate optical glass) */
m_intIOR = propList.getFloat("intIOR", 1.5046f);
/* Exterior IOR (default: air) */
m_extIOR = propList.getFloat("extIOR", 1.000277f);
}
Color3f eval(const BSDFQueryRecord &) const {
/* Discrete BRDFs always evaluate to zero in Nori */
return Color3f(0.0f);
}
float pdf(const BSDFQueryRecord &) const {
/* Discrete BRDFs always evaluate to zero in Nori */
return 0.0f;
}
Color3f sample(BSDFQueryRecord &bRec, const Point2f &sample) const {
throw NoriException("Unimplemented!");
}
std::string toString() const {
return tfm::format(
"Dielectric[\n"
" intIOR = %f,\n"
" extIOR = %f\n"
"]",
m_intIOR, m_extIOR);
}
private:
float m_intIOR, m_extIOR;
};
NORI_REGISTER_CLASS(Dielectric, "dielectric");
NORI_NAMESPACE_END