Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
DirectEnergySampleQuery.h
Go to the documentation of this file.
1#pragma once
2
3#include "Math/TVector3.h"
4#include "Core/Ray.h"
6#include "Core/SurfaceHit.h"
7#include "Core/LTA/PDF.h"
9
10#include <Common/assertion.h>
11
12namespace ph
13{
14
15class Primitive;
16
20{
21public:
22 void set(const SurfaceHit& X);
23
27 const SurfaceHit& getX() const;
28
33
34private:
35 SurfaceHit m_X;
36#if PH_DEBUG
37 bool m_hasSet{false};
38#endif
39};
40
44{
45public:
46 void setEmitPos(const math::Vector3R& emitPos);
47 void setEmittedEnergy(const math::Spectrum& emittedEnergy);
48 void setPdf(const lta::PDF& pdf);
49 void setSrcPrimitive(const Primitive* srcPrimitive);
50 void setObservationRay(const Ray& observationRay);
51
55 const math::Vector3R& getEmitPos() const;
56
59 const math::Spectrum& getEmittedEnergy() const;
60
61 real getPdfW() const;
62 const lta::PDF& getPdf() const;
63 const Primitive& getSrcPrimitive() const;
64
70 const Ray& getObservationRay() const;
71
76 operator bool () const;
77
78private:
79 math::Vector3R m_emitPos{0};
80 math::Spectrum m_emittedEnergy{0};
81 lta::PDF m_pdf{};
82 const Primitive* m_srcPrimitive{nullptr};
83 Ray m_observationRay{};
84};
85
102
104{
105 m_X = X;
106
107#if PH_DEBUG
108 m_hasSet = true;
109#endif
110}
111
113{
114 PH_ASSERT(m_hasSet);
115 return m_X;
116}
117
119{
120 return getX().getPos();
121}
122
124{
125 m_emitPos = emitPos;
126}
127
129{
130 m_emittedEnergy = emittedEnergy;
131}
132
134{
135 m_pdf = pdf;
136}
137
139{
140 m_srcPrimitive = srcPrimitive;
141}
142
143inline void DirectEnergySampleOutput::setObservationRay(const Ray& observationRay)
144{
145 m_observationRay = observationRay;
146}
147
149{
150 PH_ASSERT(*this);
151 return m_emitPos;
152}
153
155{
156 PH_ASSERT(*this);
157 return m_emittedEnergy;
158}
159
161{
162 PH_ASSERT(*this);
163 return m_pdf.getPdfW();
164}
165
167{
168 PH_ASSERT(*this);
169 return m_pdf;
170}
171
173{
174 PH_ASSERT(*this);
175 PH_ASSERT(m_srcPrimitive);
176 return *m_srcPrimitive;
177}
178
180{
181 PH_ASSERT(*this);
182 return m_observationRay;
183}
184
185inline DirectEnergySampleOutput::operator bool () const
186{
187 return m_pdf;
188}
189
194
199
200}// end namespace ph
Input for DirectEnergySampleQuery.
Definition DirectEnergySampleQuery.h:20
const SurfaceHit & getX() const
Definition DirectEnergySampleQuery.h:112
void set(const SurfaceHit &X)
Definition DirectEnergySampleQuery.h:103
math::Vector3R getTargetPos() const
Definition DirectEnergySampleQuery.h:118
Output for DirectEnergySampleQuery.
Definition DirectEnergySampleQuery.h:44
void setPdf(const lta::PDF &pdf)
Definition DirectEnergySampleQuery.h:133
void setSrcPrimitive(const Primitive *srcPrimitive)
Definition DirectEnergySampleQuery.h:138
const math::Spectrum & getEmittedEnergy() const
The sampled emitted energy of. Does not contain any path weighting.
Definition DirectEnergySampleQuery.h:154
const Ray & getObservationRay() const
Get the ray from target position to sampled emitting position. If target position or emitting positio...
Definition DirectEnergySampleQuery.h:179
void setEmittedEnergy(const math::Spectrum &emittedEnergy)
Definition DirectEnergySampleQuery.h:128
void setObservationRay(const Ray &observationRay)
Definition DirectEnergySampleQuery.h:143
void setEmitPos(const math::Vector3R &emitPos)
Definition DirectEnergySampleQuery.h:123
const math::Vector3R & getEmitPos() const
Definition DirectEnergySampleQuery.h:148
const Primitive & getSrcPrimitive() const
Definition DirectEnergySampleQuery.h:172
real getPdfW() const
Definition DirectEnergySampleQuery.h:160
const lta::PDF & getPdf() const
Definition DirectEnergySampleQuery.h:166
Information for generating a sample for direct energy estimation.
Definition DirectEnergySampleQuery.h:89
math::Vector3R getTargetToEmit() const
Definition DirectEnergySampleQuery.h:190
Output outputs
Definition DirectEnergySampleQuery.h:95
math::Vector3R getEmitToTarget() const
Definition DirectEnergySampleQuery.h:195
Input inputs
Definition DirectEnergySampleQuery.h:94
A physical shape in the scene.
Definition Primitive.h:23
Represents a ray in space.
Definition Ray.h:21
General information about a ray-surface intersection event.
Definition SurfaceHit.h:59
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
Definition TTristimulusSpectrum.h:11
The root for all renderer implementations.
Definition EEngineProject.h:6