Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SingleFrameRenderSession.h
Go to the documentation of this file.
1#pragma once
2
4#include "Math/TVector2.h"
5#include "SDL/sdl_interface.h"
7
8#include <Common/primitive_type.h>
9
10#include <string>
11
12namespace ph
13{
14
16{
17public:
18 void applyToContext(CoreCookingContext& ctx) const override;
19 std::vector<std::shared_ptr<CoreSdlResource>> gatherResources(const SceneDescription& scene) const override;
20
22
23 const std::string& getVisualizerName() const;
24 const std::string& getObserverName() const;
25 const std::string& getSampleSourceName() const;
27
28private:
29 math::TVector2<uint32> m_frameSizePx;
30 std::string m_visualizerName;
31 std::string m_observerName;
32 std::string m_sampleSourceName;
33 EAccelerator m_topLevelAcceleratorType;
34
35public:
37 {
38 ClassType clazz("single-frame-render-session");
39 clazz.docName("Single Frame Render Session");
40 clazz.description("Information regarding the rendering process of a single frame.");
41 clazz.baseOn<RenderSession>();
42
43 TSdlVector2<OwnerType, uint32> frameSizePx("frame-size", &OwnerType::m_frameSizePx);
44 frameSizePx.description("Width and height of the frame in pixels.");
45 frameSizePx.defaultTo({960, 540});
46 clazz.addField(frameSizePx);
47
48 TSdlString<OwnerType> visualizerName("visualizer", &OwnerType::m_visualizerName);
49 visualizerName.description("Name of the visualizer resource to use.");
50 visualizerName.optional();
51 clazz.addField(visualizerName);
52
53 TSdlString<OwnerType> observerName("observer", &OwnerType::m_observerName);
54 observerName.description("Name of the observer resource to use.");
55 observerName.optional();
56 clazz.addField(observerName);
57
58 TSdlString<OwnerType> sampleSourceName("sample-source", &OwnerType::m_sampleSourceName);
59 sampleSourceName.description("Name of the sample source resource to use.");
60 sampleSourceName.optional();
61 clazz.addField(sampleSourceName);
62
63 TSdlEnumField<OwnerType, EAccelerator> topLevelAcceleratorType("top-level-accelerator", &OwnerType::m_topLevelAcceleratorType);
64 topLevelAcceleratorType.description("Acceleration structure used on the top level geometries.");
65 topLevelAcceleratorType.defaultTo(EAccelerator::BVH);
66 topLevelAcceleratorType.optional();
67 clazz.addField(topLevelAcceleratorType);
68
69 return clazz;
70 }
71};
72
73// In-header Implementations:
74
75inline const std::string& SingleFrameRenderSession::getVisualizerName() const
76{
77 return m_visualizerName;
78}
79
80inline const std::string& SingleFrameRenderSession::getObserverName() const
81{
82 return m_observerName;
83}
84
85inline const std::string& SingleFrameRenderSession::getSampleSourceName() const
86{
87 return m_sampleSourceName;
88}
89
91{
92 m_topLevelAcceleratorType = accelerator;
93}
94
96{
97 return m_topLevelAcceleratorType;
98}
99
100}// end namespace ph
Definition CoreCookingContext.h:15
Definition RenderSession.h:20
Data that describe a scene. Represents the result of running SDL commands.
Definition SceneDescription.h:14
Definition SingleFrameRenderSession.h:16
std::vector< std::shared_ptr< CoreSdlResource > > gatherResources(const SceneDescription &scene) const override
Gather resources for this render session.
Definition SingleFrameRenderSession.cpp:32
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< SingleFrameRenderSession >)
Definition SingleFrameRenderSession.h:36
const std::string & getVisualizerName() const
Definition SingleFrameRenderSession.h:75
EAccelerator getTopLevelAcceleratorType() const
Definition SingleFrameRenderSession.h:95
void applyToContext(CoreCookingContext &ctx) const override
Apply settings to the context.
Definition SingleFrameRenderSession.cpp:15
void setTopLevelAcceleratorType(EAccelerator accelerator)
Definition SingleFrameRenderSession.h:90
const std::string & getSampleSourceName() const
Definition SingleFrameRenderSession.h:85
const std::string & getObserverName() const
Definition SingleFrameRenderSession.h:80
Definition TSdlEnumField.h:23
SDL binding type for a canonical SDL resource class.
Definition TSdlOwnerClass.h:23
Definition TSdlString.h:14
TSdlValue & description(std::string descriptionStr)
Definition TSdlValue.ipp:95
TSdlValue & optional()
Definition TSdlValue.ipp:103
TSdlValue & defaultTo(T defaultValue)
Definition TSdlValue.ipp:71
Definition TSdlVector2.h:20
Represents a 2-D vector.
Definition TVector2.h:19
The root for all renderer implementations.
Definition EEngineProject.h:6
EAccelerator
Definition EAccelerator.h:7