Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SurfaceOptics.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <string>
7#include <array>
8
9namespace ph
10{
11
12class SampleFlow;
13
17{
18 // FIXME: sort-of hacked, should clarify the need of this in the future
19 friend class LerpedSurfaceOptics;
20
21public:
23 virtual ~SurfaceOptics() = default;
24
29
33 void calcBsdf(BsdfEvalQuery& eval) const;
34
38 void genBsdfSample(BsdfSampleQuery& sample, SampleFlow& sampleFlow) const;
39
43 void calcBsdfPdf(BsdfPdfQuery& pdfQuery) const;
44
50
55
56 virtual std::string toString() const;
57
58protected:
61
62private:
67 virtual void calcBsdf(
68 const BsdfQueryContext& ctx,
69 const BsdfEvalInput& in,
70 BsdfEvalOutput& out) const = 0;
71
76 virtual void genBsdfSample(
77 const BsdfQueryContext& ctx,
78 const BsdfSampleInput& in,
79 SampleFlow& sampleFlow,
80 BsdfSampleOutput& out) const = 0;
81
86 virtual void calcBsdfPdf(
87 const BsdfQueryContext& ctx,
88 const BsdfPdfInput& in,
89 BsdfPdfOutput& out) const = 0;
90};
91
92// In-header Implementations:
93
98
103
104inline std::string SurfaceOptics::toString() const
105{
106 return std::to_string(m_numElementals) + " elementals";
107}
108
109}// end namespace ph
Input for BsdfEvalQuery.
Definition BsdfEvalQuery.h:20
Output for BsdfEvalQuery.
Definition BsdfEvalQuery.h:47
Information for obtaining a sample value from BSDF.
Definition BsdfEvalQuery.h:90
Input for BsdfPdfQuery.
Definition BsdfPdfQuery.h:19
Output for BsdfPdfQuery.
Definition BsdfPdfQuery.h:46
Information for the probability of generating a specific BSDF sample.
Definition BsdfPdfQuery.h:66
The environment a BSDF query is performed under.
Definition BsdfQueryContext.h:13
Input for BsdfSampleQuery.
Definition BsdfSampleQuery.h:21
Output for BsdfSampleQuery.
Definition BsdfSampleQuery.h:45
Information for generating a BSDF sample.
Definition BsdfSampleQuery.h:141
Linearly interpolate between two surface optics.
Definition LerpedSurfaceOptics.h:19
A sample with arbitrary dimensions with fine-grained sampling control.
Definition SampleFlow.h:19
Describes how light interacts with a surface.
Definition SurfaceOptics.h:17
void calcBsdf(BsdfEvalQuery &eval) const
Executes a BSDF evaluation query. Respects sidedness policy.
Definition SurfaceOptics.cpp:17
virtual ESurfacePhenomenon getPhenomenonOf(SurfaceElemental elemental) const =0
Get the phenomenon of a surface component. One can also setup query for a specific elemental....
SurfaceElemental numElementals() const
Get number of components this surface contains.
Definition SurfaceOptics.h:99
SurfaceOptics()
Definition SurfaceOptics.cpp:12
void genBsdfSample(BsdfSampleQuery &sample, SampleFlow &sampleFlow) const
Executes a BSDF sample query. Respects sidedness policy.
Definition SurfaceOptics.cpp:32
SurfaceElemental m_numElementals
Definition SurfaceOptics.h:60
virtual std::string toString() const
Definition SurfaceOptics.h:104
void calcBsdfPdf(BsdfPdfQuery &pdfQuery) const
Executes a BSDF sample PDF query. Respects sidedness policy.
Definition SurfaceOptics.cpp:54
virtual ~SurfaceOptics()=default
SurfacePhenomena getAllPhenomena() const
Get all phenomena that exist in this surface.
Definition SurfaceOptics.h:94
SurfacePhenomena m_phenomena
Definition SurfaceOptics.h:59
Manipulate a value type where each bit is a binary flag.
Definition TBitFlags.h:17
The root for all renderer implementations.
Definition EEngineProject.h:6
ESurfacePhenomenon
Available surface phenomena.
Definition surface_optics_fwd.h:16
int SurfaceElemental
Definition surface_optics_fwd.h:30