Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
AGeometricLight.h
Go to the documentation of this file.
1#pragma once
2
7#include "Utility/TSpan.h"
8#include "SDL/sdl_interface.h"
9
10#include <memory>
11
12namespace ph
13{
14
15class Primitive;
16
17class AGeometricLight : public ALight
18{
19public:
24 virtual std::shared_ptr<Geometry> getGeometry(const CookingContext& ctx) const = 0;
25
29 virtual const Emitter* buildEmitter(
30 const CookingContext& ctx,
31 TSpanView<const Primitive*> lightPrimitives) const = 0;
32
37 virtual std::shared_ptr<Material> getMaterial(const CookingContext& ctx) const;
38
39 PreCookReport preCook(const CookingContext& ctx) const override;
40 TransientVisualElement cook(const CookingContext& ctx, const PreCookReport& report) const override;
41
47 static std::shared_ptr<Geometry> getSanifiedGeometry(
48 const std::shared_ptr<Geometry>& srcGeometry,
49 const TransformInfo& srcLocalToWorld,
50 math::TDecomposedTransform<real>* out_remainingLocalToWorld = nullptr);
51
52protected:
57
62
63public:
65 {
66 ClassType clazz("geometric-light");
67 clazz.docName("Geometric Light Actor");
68 clazz.description(
69 "Energy emitters that come with a physical geometry. Please be aware that changing "
70 "sampling techniques to non-default values may cause the rendered image to lose energy. "
71 "For example, disabling BSDF sampling may cause some/all caustics to disappear on "
72 "specular surfaces.");
73 clazz.baseOn<ALight>();
74
75 TSdlBool<OwnerType> directlyVisible("directly-visible", &OwnerType::m_isDirectlyVisible);
76 directlyVisible.description(
77 "Whether the light is directly visible. For example, you can see a bright sphere "
78 "for a directly visible spherical area light.");
79 directlyVisible.defaultTo(true);
80 directlyVisible.optional();
81 clazz.addField(directlyVisible);
82
83 TSdlBool<OwnerType> bsdfSample("bsdf-sample", &OwnerType::m_useBsdfSample);
84 bsdfSample.description(
85 "Whether to use BSDF sampling technique for rendering the light, i.e., choosing a "
86 "direction based on BSDF and relying on randomly hitting a light.");
87 bsdfSample.defaultTo(true);
88 bsdfSample.optional();
89 clazz.addField(bsdfSample);
90
91 TSdlBool<OwnerType> directSample("direct-sample", &OwnerType::m_useDirectSample);
92 directSample.description(
93 "Whether to use direct sampling technique for rendering the light, i.e., directly "
94 "establish a connection from a light to the illuminated location.");
95 directSample.defaultTo(true);
96 directSample.optional();
97 clazz.addField(directSample);
98
99 TSdlBool<OwnerType> emissionSample("emission-sample", &OwnerType::m_useEmissionSample);
100 emissionSample.description(
101 "Whether to use emission sampling technique for rendering the light, i.e., start "
102 "rendering the light from the light source itself.");
103 emissionSample.defaultTo(true);
104 emissionSample.optional();
105 clazz.addField(emissionSample);
106
107 return clazz;
108 }
109};
110
111}// end namespace ph
Definition AGeometricLight.h:18
virtual std::shared_ptr< Material > getMaterial(const CookingContext &ctx) const
Definition AGeometricLight.cpp:24
bool m_isDirectlyVisible
Definition AGeometricLight.h:58
virtual const Emitter * buildEmitter(const CookingContext &ctx, TSpanView< const Primitive * > lightPrimitives) const =0
bool m_useEmissionSample
Definition AGeometricLight.h:61
static std::shared_ptr< Geometry > getSanifiedGeometry(const std::shared_ptr< Geometry > &srcGeometry, const TransformInfo &srcLocalToWorld, math::TDecomposedTransform< real > *out_remainingLocalToWorld=nullptr)
Definition AGeometricLight.cpp:188
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< AGeometricLight >)
Definition AGeometricLight.h:64
PreCookReport preCook(const CookingContext &ctx) const override
Cooking supplemental data before cook(). This method allows user to specify additional configurations...
Definition AGeometricLight.cpp:29
bool m_useDirectSample
Definition AGeometricLight.h:60
bool m_useBsdfSample
Definition AGeometricLight.h:59
virtual EmitterFeatureSet getEmitterFeatureSet() const
Definition AGeometricLight.cpp:157
virtual std::shared_ptr< Geometry > getGeometry(const CookingContext &ctx) const =0
TransientVisualElement cook(const CookingContext &ctx, const PreCookReport &report) const override
Definition AGeometricLight.cpp:51
Definition ALight.h:10
Information about the world being cooked.
Definition CookingContext.h:24
An electromagnetic energy emitting source. The emitted energy can be captured by a Receiver.
Definition Emitter.h:68
Definition PreCookReport.h:13
Manipulate a value type where each bit is a binary flag.
Definition TBitFlags.h:17
A field class that binds a bool member variable.
Definition TSdlBool.h:21
SDL binding type for a canonical SDL resource class.
Definition TSdlOwnerClass.h:23
TSdlValue & description(std::string descriptionStr)
Definition TSdlValue.ipp:95
TSdlValue & optional()
Definition TSdlValue.ipp:103
TSdlValue & defaultTo(T defaultValue)
Definition TSdlValue.ipp:71
Definition TransformInfo.h:17
A group of cooked data that represent the visible part of the scene at a specific time....
Definition TransientVisualElement.h:19
Perform affine transformations in decomposed form.
Definition TDecomposedTransform.h:24
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