Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
LbLayer.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <Common/primitive_type.h>
6
7namespace ph
8{
9
11{
12public:
13 LbLayer();
14 explicit LbLayer(const math::Spectrum& iorN);
15 LbLayer(real alpha, const math::Spectrum& iorN);
16 LbLayer(real alpha, const math::Spectrum& iorN, const math::Spectrum& iorK);
17 LbLayer(real g, real depth, const LbLayer& previousLayer);
18 LbLayer(real g, real depth, const math::Spectrum& sigmaA, const LbLayer& previousLayer);
19 LbLayer(real g, real depth, const math::Spectrum& sigmaA, const math::Spectrum& sigmaS, const LbLayer& previousLayer);
20
21 real getAlpha() const;
22 const math::Spectrum& getIorN() const;
23 const math::Spectrum& getIorK() const;
24 real getDepth() const;
25 real getG() const;
26 const math::Spectrum& getSigmaA() const;
27 const math::Spectrum& getSigmaS() const;
28 bool isConductor() const;
29 bool isSurface() const;
30 bool isVolume() const;
31
32private:
33 // The alpha variable for GGX distribution.
34 real m_alpha;
35
36 // Complex index of refraction n + ik.
37 math::Spectrum m_iorN, m_iorK;
38
39 // Thickness of the layer.
40 real m_depth;
41
42 // The g variable in Henyey-Greenstein phase function.
43 real m_g;
44
45 // Absorption and scattering coefficient in volume rendering.
46 math::Spectrum m_sigmaA, m_sigmaS;
47};
48
49// In-header Implementations:
50
52 LbLayer(math::Spectrum(1))
53{}
54
55inline LbLayer::LbLayer(const math::Spectrum& iorN) :
56 LbLayer(0.0_r, iorN)
57{}
58
59inline LbLayer::LbLayer(const real alpha, const math::Spectrum& iorN) :
60 LbLayer(alpha, iorN, math::Spectrum(0))
61{}
62
63inline LbLayer::LbLayer(const real alpha, const math::Spectrum& iorN, const math::Spectrum& iorK) :
64 m_alpha(alpha),
65 m_iorN(iorN), m_iorK(iorK),
66 m_depth(0.0_r),
67 m_g(1.0_r),
68 m_sigmaA(0.0_r),
69 m_sigmaS(0.0_r)
70{}
71
72inline LbLayer::LbLayer(const real g, const real depth, const LbLayer& previousLayer) :
73 LbLayer(g, depth, math::Spectrum(0), previousLayer)
74{}
75
76inline LbLayer::LbLayer(const real g, const real depth, const math::Spectrum& sigmaA, const LbLayer& previousLayer) :
77 LbLayer(g, depth, sigmaA, math::Spectrum(0), previousLayer)
78{}
79
81 const real g,
82 const real depth,
83 const math::Spectrum& sigmaA,
84 const math::Spectrum& sigmaS,
85 const LbLayer& previousLayer) :
86
87 m_alpha(previousLayer.getAlpha()),
88 m_iorN(previousLayer.getIorN()), m_iorK(previousLayer.getIorK()),
89 m_depth(depth),
90 m_g(g),
91 m_sigmaA(sigmaA),
92 m_sigmaS(sigmaS)
93{}
94
95inline real LbLayer::getAlpha() const
96{
97 return m_alpha;
98}
99
100inline const math::Spectrum& LbLayer::getIorN() const
101{
102 return m_iorN;
103}
104
105inline const math::Spectrum& LbLayer::getIorK() const
106{
107 return m_iorK;
108}
109
110inline real LbLayer::getDepth() const
111{
112 return m_depth;
113}
114
115inline real LbLayer::getG() const
116{
117 return m_g;
118}
119
121{
122 return m_sigmaA;
123}
124
126{
127 return m_sigmaS;
128}
129
130inline bool LbLayer::isConductor() const
131{
132 return m_iorK.avg() > 0.0_r;
133}
134
135inline bool LbLayer::isSurface() const
136{
137 return m_depth == 0.0_r;
138}
139
140inline bool LbLayer::isVolume() const
141{
142 return m_depth > 0.0_r;
143}
144
145}// end namespace ph
Definition LbLayer.h:11
bool isSurface() const
Definition LbLayer.h:135
bool isVolume() const
Definition LbLayer.h:140
const math::Spectrum & getSigmaS() const
Definition LbLayer.h:125
real getG() const
Definition LbLayer.h:115
bool isConductor() const
Definition LbLayer.h:130
LbLayer()
Definition LbLayer.h:51
const math::Spectrum & getIorN() const
Definition LbLayer.h:100
real getAlpha() const
Definition LbLayer.h:95
const math::Spectrum & getSigmaA() const
Definition LbLayer.h:120
real getDepth() const
Definition LbLayer.h:110
const math::Spectrum & getIorK() const
Definition LbLayer.h:105
T avg() const
Definition TArithmeticArrayBase.ipp:342
Definition TTristimulusSpectrum.h:11
The root for all renderer implementations.
Definition EEngineProject.h:6