Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
DirectEnergyPdfQuery.h
Go to the documentation of this file.
1#pragma once
2
3#include "Math/TVector3.h"
5#include "Core/HitDetail.h"
6#include "Core/SurfaceHit.h"
7#include "Core/LTA/PDF.h"
8
9#include <Common/assertion.h>
10
11namespace ph { class Primitive; }
12
13namespace ph
14{
15
19{
20public:
21 void set(const SurfaceHit& X, const SurfaceHit& Xe);
22 void set(const math::Vector3R& targetPos, const SurfaceHit& Xe);
23
27 const math::Vector3R& getTargetPos() const;
28
32 const SurfaceHit& getXe() const;
33
38
43
47 const Primitive& getSrcPrimitive() const;
48
52 uint64 getSrcFaceID() const;
53
54private:
55 math::Vector3R m_targetPos;
56 SurfaceHit m_Xe;
57#if PH_DEBUG
58 bool m_hasSet{false};
59#endif
60};
61
65{
66public:
67 void setPdf(const lta::PDF& pdf);
68
69 real getPdfW() const;
70 const lta::PDF& getPdf() const;
71
72 operator bool () const;
73
74private:
75 lta::PDF m_pdf{};
76};
77
91
92inline void DirectEnergyPdfInput::set(const SurfaceHit& X, const SurfaceHit& Xe)
93{
94 set(X.getPos(), Xe);
95}
96
97inline void DirectEnergyPdfInput::set(const math::Vector3R& targetPos, const SurfaceHit& Xe)
98{
99 m_targetPos = targetPos;
100 m_Xe = Xe;
101
102#if PH_DEBUG
103 m_hasSet = true;
104#endif
105}
106
108{
109 PH_ASSERT(m_hasSet);
110 return m_targetPos;
111}
112
114{
115 PH_ASSERT(m_hasSet);
116 return m_Xe;
117}
118
120{
121 PH_ASSERT(m_hasSet);
122 return m_Xe.getPos();
123}
124
126{
127 PH_ASSERT(m_hasSet);
128 return m_Xe.getShadingNormal();
129}
130
132{
133 PH_ASSERT(m_hasSet);
134 PH_ASSERT(m_Xe.getDetail().getPrimitive());
135 return *m_Xe.getDetail().getPrimitive();
136}
137
139{
140 PH_ASSERT(m_hasSet);
141 return m_Xe.getDetail().getFaceID();
142}
143
145{
146 m_pdf = pdf;
147}
148
150{
151 return getPdf().getPdfW();
152}
153
155{
156 PH_ASSERT(*this);
157 return m_pdf;
158}
159
160inline DirectEnergyPdfOutput::operator bool () const
161{
162 return m_pdf;
163}
164
165}// end namespace ph
Input for DirectEnergyPdfQuery.
Definition DirectEnergyPdfQuery.h:19
const Primitive & getSrcPrimitive() const
Definition DirectEnergyPdfQuery.h:131
void set(const SurfaceHit &X, const SurfaceHit &Xe)
Definition DirectEnergyPdfQuery.h:92
math::Vector3R getEmitPos() const
Definition DirectEnergyPdfQuery.h:119
const SurfaceHit & getXe() const
Definition DirectEnergyPdfQuery.h:113
uint64 getSrcFaceID() const
Definition DirectEnergyPdfQuery.h:138
const math::Vector3R & getTargetPos() const
Definition DirectEnergyPdfQuery.h:107
math::Vector3R getEmitPosNormal() const
Definition DirectEnergyPdfQuery.h:125
Output for DirectEnergyPdfQuery.
Definition DirectEnergyPdfQuery.h:65
void setPdf(const lta::PDF &pdf)
Definition DirectEnergyPdfQuery.h:144
real getPdfW() const
Definition DirectEnergyPdfQuery.h:149
const lta::PDF & getPdf() const
Definition DirectEnergyPdfQuery.h:154
Information for the probability of generating a specific sample for direct energy estimation.
Definition DirectEnergyPdfQuery.h:81
Output outputs
Definition DirectEnergyPdfQuery.h:87
Input inputs
Definition DirectEnergyPdfQuery.h:86
uint64 getFaceID() const
Get the face ID associated to the hit.
Definition HitDetail.h:153
const Primitive * getPrimitive() const
Definition HitDetail.h:163
A physical shape in the scene.
Definition Primitive.h:23
General information about a ray-surface intersection event.
Definition SurfaceHit.h:59
math::Vector3R getShadingNormal() const
Definition SurfaceHit.h:191
const HitDetail & getDetail() const
Definition SurfaceHit.h:159
math::Vector3R getPos() const
Definition SurfaceHit.h:186
A sample from a Probability Density Function (PDF).
Definition PDF.h:14
real getPdfW() const
Definition PDF.h:87
The root for all renderer implementations.
Definition EEngineProject.h:6