Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
AAreaLight.h
Go to the documentation of this file.
1#pragma once
2
5#include "SDL/sdl_interface.h"
7
8#include <Common/primitive_type.h>
9
10namespace ph
11{
12
14{
15public:
19 virtual std::shared_ptr<Geometry> getArea(const CookingContext& ctx) const = 0;
20
21 std::shared_ptr<Geometry> getGeometry(const CookingContext& ctx) const override;
22 std::shared_ptr<Material> getMaterial(const CookingContext& ctx) const override;
23
24 const Emitter* buildEmitter(
25 const CookingContext& ctx,
26 TSpanView<const Primitive*> lightPrimitives) const override;
27
28private:
29 math::Spectrum m_color;
30 real m_numWatts;
31
32public:
34 {
35 ClassType clazz("area-light");
36 clazz.docName("Area Light Actor");
37 clazz.description(
38 "This type of light source has a finite area, with various simplifications on the "
39 "characteristics of the emission profile. Energy is allowed to emit diffusively and "
40 "uniformally within the area. By default, the energy emitting surface absorbs all "
41 "incoming energy (which is effectively a pure absorber).");
42 clazz.baseOn<AGeometricLight>();
43
44 TSdlSpectrum<OwnerType> color("color", math::EColorUsage::EMR, &OwnerType::m_color);
45 color.description("The color of this light source.");
46 color.defaultTo(math::Spectrum().setLinearSRGB({1, 1, 1}, math::EColorUsage::EMR));
47 clazz.addField(color);
48
49 TSdlReal<OwnerType> numWatts("watts", &OwnerType::m_numWatts);
50 numWatts.description("Energy emitted by this light source, in watts.");
51 numWatts.defaultTo(100);
52 clazz.addField(numWatts);
53
54 return clazz;
55 }
56};
57
58}// end namespace ph
Definition AAreaLight.h:14
std::shared_ptr< Material > getMaterial(const CookingContext &ctx) const override
Definition AAreaLight.cpp:28
virtual std::shared_ptr< Geometry > getArea(const CookingContext &ctx) const =0
const Emitter * buildEmitter(const CookingContext &ctx, TSpanView< const Primitive * > lightPrimitives) const override
Definition AAreaLight.cpp:37
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< AAreaLight >)
Definition AAreaLight.h:33
std::shared_ptr< Geometry > getGeometry(const CookingContext &ctx) const override
Definition AAreaLight.cpp:21
Definition AGeometricLight.h:18
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
SDL binding type for a canonical SDL resource class.
Definition TSdlOwnerClass.h:23
A field class that binds a floating point member variable.
Definition TSdlReal.h:21
Definition TSdlSpectrum.h:27
TSdlValue & description(std::string descriptionStr)
Definition TSdlValue.ipp:95
TSdlValue & defaultTo(T defaultValue)
Definition TSdlValue.ipp:71
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