Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Emitter.h
Go to the documentation of this file.
1#pragma once
2
3#include "Math/math_fwd.h"
4#include "Math/math.h"
6#include "Utility/TBitFlags.h"
7
8#include <Common/primitive_type.h>
9
10namespace ph
11{
12
13class SurfaceHit;
14class HitProbe;
15class DirectEnergySampleQuery;
16class DirectEnergyPdfQuery;
17class EnergyEmissionSampleQuery;
18class SampleFlow;
19
20namespace detail
21{
22
23using EmitterFlagIntType = uint8;
24
29
30}// end namespace detail
31
59
61
63
68{
69public:
71
75 explicit Emitter(EmitterFeatureSet featureSet = defaultFeatureSet);
76
77 virtual ~Emitter();
78
82 virtual void evalEmittedEnergy(const SurfaceHit& Xe, math::Spectrum* out_energy) const = 0;
83
89 virtual void genDirectSample(
91 SampleFlow& sampleFlow,
92 HitProbe& probe) const = 0;
93
98 virtual void calcDirectPdf(DirectEnergyPdfQuery& query) const = 0;
99
105 virtual void emitRay(
107 SampleFlow& sampleFlow,
108 HitProbe& probe) const = 0;
109
110 virtual real calcRadiantFluxApprox() const;
111
116
117private:
118 EmitterFeatureSet m_featureSet;
119};
120
121// In-header Implementations:
122
124{
125 // Non-zero to avoid not being sampled
126 return 1.0_r;
127}
128
130{
131 return m_featureSet;
132}
133
134}// end namespace ph
#define PH_DEFINE_INLINE_ENUM_FLAG_OPERATORS(EnumType)
Defines operator | and operator & for EnumType.
Definition TBitFlags.h:146
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
An electromagnetic energy emitting source. The emitted energy can be captured by a Receiver.
Definition Emitter.h:68
virtual ~Emitter()
EmitterFeatureSet getFeatureSet() const
Definition Emitter.h:129
virtual void evalEmittedEnergy(const SurfaceHit &Xe, math::Spectrum *out_energy) const =0
Evaluate emitted energy from a point on the surface.
Emitter(EmitterFeatureSet featureSet=defaultFeatureSet)
Definition Emitter.cpp:7
virtual void genDirectSample(DirectEnergySampleQuery &query, SampleFlow &sampleFlow, HitProbe &probe) const =0
Sample direct lighting for a target position.
virtual real calcRadiantFluxApprox() const
Definition Emitter.h:123
virtual void emitRay(EnergyEmissionSampleQuery &query, SampleFlow &sampleFlow, HitProbe &probe) const =0
Emit a ray that carries some amount of energy from this emitter.
virtual void calcDirectPdf(DirectEnergyPdfQuery &query) const =0
Calculate the PDF of direct lighting for a target position.
static constexpr auto defaultFeatureSet
Definition Emitter.h:70
Information for generating a sample for energy emission.
Definition EnergyEmissionSampleQuery.h:63
Lightweight ray intersection testing and reporting object. If an intersection is found,...
Definition HitProbe.h:27
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 TTristimulusSpectrum.h:11
Miscellaneous math utilities.
constexpr auto efs_direct_sample_bits
Definition Emitter.h:27
constexpr auto efs_emission_sample_bits
Definition Emitter.h:28
uint8 EmitterFlagIntType
Definition Emitter.h:23
constexpr auto efs_bsdf_sample_bits
Definition Emitter.h:26
constexpr auto efs_zero_bounce_sample_bits
Definition Emitter.h:25
consteval UIntType flag_bit()
Definition math.h:537
The root for all renderer implementations.
Definition EEngineProject.h:6
EEmitterFeatureSet
Runtime features of an emitter.
Definition Emitter.h:38
TEnumFlags< EEmitterFeatureSet > EmitterFeatureSet
Definition Emitter.h:62