Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
AModelLight.h
Go to the documentation of this file.
1#pragma once
2
4#include "Actor/Image/Image.h"
5#include "SDL/sdl_interface.h"
6
7namespace ph
8{
9
11{
12public:
13 std::shared_ptr<Geometry> getGeometry(const CookingContext& ctx) const override;
14 std::shared_ptr<Material> getMaterial(const CookingContext& ctx) const override;
15
16 const Emitter* buildEmitter(
17 const CookingContext& ctx,
18 TSpanView<const Primitive*> lightPrimitives) const override;
19
20 void setGeometry(const std::shared_ptr<Geometry>& geometry);
21 void setMaterial(const std::shared_ptr<Material>& material);
22 void setBackFaceEmit(bool isBackFaceEmit);
23
24private:
25 std::shared_ptr<Geometry> m_geometry;
26 std::shared_ptr<Material> m_material;
27 std::shared_ptr<Image> m_emittedEnergy;
28 bool m_isBackFaceEmit;
29
30public:
32 {
33 ClassType clazz("model-light");
34 clazz.docName("Model Light Actor");
35 clazz.description(
36 "A light source that emits energy from the surface of a geometry. A surface material model "
37 "can also be given to describe its surface appearance.");
38 clazz.baseOn<AGeometricLight>();
39
40 TSdlReference<Geometry, OwnerType> geometry("geometry", &OwnerType::m_geometry);
41 geometry.description("A geometry that defines the surface energy is going to emit from.");
42 geometry.required();
43 clazz.addField(geometry);
44
45 TSdlReference<Material, OwnerType> material("material", &OwnerType::m_material);
46 material.description("A material that describes this source's surface appearance.");
47 material.optional();
48 clazz.addField(material);
49
50 TSdlReference<Image, OwnerType> emittedEnergy("emitted-energy", &OwnerType::m_emittedEnergy);
51 emittedEnergy.description(
52 "An image that describes the emitted energy (e.g., radiance) across the surface.");
53 emittedEnergy.optional();
54 clazz.addField(emittedEnergy);
55
56 TSdlBool<OwnerType> isBackFaceEmit("back-face-emit", &OwnerType::m_isBackFaceEmit);
57 isBackFaceEmit.description("Whether the energy should emit from the back face of the geometry.");
58 isBackFaceEmit.defaultTo(false);
59 isBackFaceEmit.optional();
60 clazz.addField(isBackFaceEmit);
61
62 return clazz;
63 }
64};
65
66}// end namespace ph
Definition AGeometricLight.h:18
Definition AModelLight.h:11
std::shared_ptr< Material > getMaterial(const CookingContext &ctx) const override
Definition AModelLight.cpp:22
void setBackFaceEmit(bool isBackFaceEmit)
Definition AModelLight.cpp:92
const Emitter * buildEmitter(const CookingContext &ctx, TSpanView< const Primitive * > lightPrimitives) const override
Definition AModelLight.cpp:27
std::shared_ptr< Geometry > getGeometry(const CookingContext &ctx) const override
Definition AModelLight.cpp:17
void setGeometry(const std::shared_ptr< Geometry > &geometry)
Definition AModelLight.cpp:80
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< AModelLight >)
Definition AModelLight.h:31
void setMaterial(const std::shared_ptr< Material > &material)
Definition AModelLight.cpp:86
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
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
A value that points to a SDL resource.
Definition TSdlReference.h:21
TSdlReference & optional()
Definition TSdlReference.ipp:214
TSdlReference & description(std::string descriptionStr)
Definition TSdlReference.ipp:206
TSdlValue & description(std::string descriptionStr)
Definition TSdlValue.ipp:95
TSdlValue & optional()
Definition TSdlValue.ipp:103
TSdlValue & defaultTo(T defaultValue)
Definition TSdlValue.ipp:71
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