Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
GroupedDiffuseSurfaceEmitter.h
Go to the documentation of this file.
1#pragma once
2
6#include "Utility/TSpan.h"
7
8#include <Common/assertion.h>
9
10#include <cstddef>
11#include <vector>
12#include <memory>
13
14namespace ph
15{
16
17class Primitive;
18
23{
24public:
27 const std::shared_ptr<TTexture<math::Spectrum>>& emittedEnergy,
29
30 void evalEmittedEnergy(const SurfaceHit& Xe, math::Spectrum* out_energy) const override;
31
32 void genDirectSample(
34 SampleFlow& sampleFlow,
35 HitProbe& probe) const override;
36
37 void calcDirectPdf(DirectEnergyPdfQuery& query) const override;
38
39 void emitRay(
41 SampleFlow& sampleFlow,
42 HitProbe& probe) const override;
43
44 real calcRadiantFluxApprox() const override;
45
49 std::size_t numSurfaces() const;
50
53 const Primitive& getSurface(std::size_t surfaceIdx) const;
54
56
57private:
58 std::vector<const Primitive*> m_surfaces;
59 std::shared_ptr<TTexture<math::Spectrum>> m_emittedEnergy;
60};
61
63{
64 return m_surfaces.size();
65}
66
68 const std::size_t surfaceIdx) const
69{
70 PH_ASSERT_LT(surfaceIdx, m_surfaces.size());
71 return *m_surfaces[surfaceIdx];
72}
73
75{
76 PH_ASSERT(m_emittedEnergy);
77 return *m_emittedEnergy;
78}
79
80}// end namespace ph
Base for diffusive surface emitters.
Definition DiffuseSurfaceEmitterBase.h:15
Information for the probability of generating a specific sample for direct energy estimation.
Definition DirectEnergyPdfQuery.h:81
Information for generating a sample for direct energy estimation.
Definition DirectEnergySampleQuery.h:89
static constexpr auto defaultFeatureSet
Definition Emitter.h:70
Information for generating a sample for energy emission.
Definition EnergyEmissionSampleQuery.h:63
Diffusive surface emitter comprised of multiple surface fragments. All surface fragments use the same...
Definition GroupedDiffuseSurfaceEmitter.h:23
const Primitive & getSurface(std::size_t surfaceIdx) const
Get a surface fragment by index.
Definition GroupedDiffuseSurfaceEmitter.h:67
void genDirectSample(DirectEnergySampleQuery &query, SampleFlow &sampleFlow, HitProbe &probe) const override
Sample direct lighting for a target position.
Definition GroupedDiffuseSurfaceEmitter.cpp:58
const TTexture< math::Spectrum > & getEmittedEnergy() const
Definition GroupedDiffuseSurfaceEmitter.h:74
real calcRadiantFluxApprox() const override
Definition GroupedDiffuseSurfaceEmitter.cpp:110
void evalEmittedEnergy(const SurfaceHit &Xe, math::Spectrum *out_energy) const override
Evaluate emitted energy from a point on the surface.
Definition GroupedDiffuseSurfaceEmitter.cpp:53
GroupedDiffuseSurfaceEmitter(TSpanView< const Primitive * > surfaces, const std::shared_ptr< TTexture< math::Spectrum > > &emittedEnergy, EmitterFeatureSet featureSet=defaultFeatureSet)
Definition GroupedDiffuseSurfaceEmitter.cpp:18
void calcDirectPdf(DirectEnergyPdfQuery &query) const override
Calculate the PDF of direct lighting for a target position.
Definition GroupedDiffuseSurfaceEmitter.cpp:80
std::size_t numSurfaces() const
Definition GroupedDiffuseSurfaceEmitter.h:62
void emitRay(EnergyEmissionSampleQuery &query, SampleFlow &sampleFlow, HitProbe &probe) const override
Emit a ray that carries some amount of energy from this emitter.
Definition GroupedDiffuseSurfaceEmitter.cpp:86
Lightweight ray intersection testing and reporting object. If an intersection is found,...
Definition HitProbe.h:27
A physical shape in the scene.
Definition Primitive.h:23
A sample with arbitrary dimensions with fine-grained sampling control.
Definition SampleFlow.h:19
General information about a ray-surface intersection event.
Definition SurfaceHit.h:59
Manipulate a value type where each bit is a binary flag.
Definition TBitFlags.h:17
Definition TTexture.h:12
Definition TTristimulusSpectrum.h:11
The root for all renderer implementations.
Definition EEngineProject.h:6
std::span< const T, EXTENT > TSpanView
Same as TSpan, except that the objects are const-qualified. Note that for pointer types,...
Definition TSpan.h:19