Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
RenderSession.h
Go to the documentation of this file.
1#pragma once
2
3#include "SDL/Option.h"
5#include "SDL/sdl_interface.h"
6
7#include <Common/primitive_type.h>
8
9#include <string>
10#include <memory>
11#include <vector>
12
13namespace ph { class CoreCookingContext; }
14namespace ph { class SceneDescription; }
15
16namespace ph
17{
18
19class RenderSession : public Option
20{
21public:
27 virtual void applyToContext(CoreCookingContext& ctx) const = 0;
28
34 // TODO: should we take a context obj?
35 virtual std::vector<std::shared_ptr<CoreSdlResource>> gatherResources(const SceneDescription& scene) const = 0;
36
37 uint32 numWorkers() const;
38
39private:
40 std::string m_sessionName;
41 uint32 m_numWorkers;
42
43public:
45 {
46 ClassType clazz("render-session");
47 clazz.docName("Render Session");
48 clazz.description("Settings for how to perform a render operation.");
49 clazz.baseOn<Option>();
50
51 TSdlString<OwnerType> sessionName("session-name", &OwnerType::m_sessionName);
52 sessionName.description("Name of this render session.");
53 sessionName.defaultTo("Render Session");
54 sessionName.optional();
55 clazz.addField(sessionName);
56
57 TSdlUInt32<OwnerType> numWorkers("num-workers", &OwnerType::m_numWorkers);
58 numWorkers.description("Number of worker threads for the rendering operation.");
59 numWorkers.defaultTo(1);
60 numWorkers.optional();
61 clazz.addField(numWorkers);
62
63 return clazz;
64 }
65};
66
67// In-header Implementation:
68
69inline uint32 RenderSession::numWorkers() const
70{
71 return m_numWorkers;
72}
73
74}// end namespace ph
Definition CoreCookingContext.h:15
Definition Option.h:12
Definition RenderSession.h:20
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< RenderSession >)
Definition RenderSession.h:44
virtual void applyToContext(CoreCookingContext &ctx) const =0
Apply settings to the context.
Definition RenderSession.cpp:7
virtual std::vector< std::shared_ptr< CoreSdlResource > > gatherResources(const SceneDescription &scene) const =0
Gather resources for this render session.
Definition RenderSession.cpp:12
uint32 numWorkers() const
Definition RenderSession.h:69
Data that describe a scene. Represents the result of running SDL commands.
Definition SceneDescription.h:14
A field class that binds a integral member variable.
Definition TSdlInteger.h:21
SDL binding type for a canonical SDL resource class.
Definition TSdlOwnerClass.h:23
Definition TSdlString.h:14
The root for all renderer implementations.
Definition EEngineProject.h:6