Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
PMRendererBase.h
Go to the documentation of this file.
1#pragma once
2
9
10#include <Common/logging.h>
11
12#include <memory>
13#include <atomic>
14
15namespace ph
16{
17
18class Receiver;
19
21
23{
24public:
26 PMCommonParams commonParams,
27 Viewport viewport,
28 SampleFilter filter,
29 uint32 numWorkers);
30
31 void doRender() override = 0;
32 void retrieveFrame(std::size_t layerIndex, HdrRgbFrame& out_frame) override = 0;
33
36
38 std::size_t layerIndex,
39 const Region& region,
40 HdrRgbFrame& out_frame) override = 0;
41
43
46 void doUpdate(const CoreCookedUnit& cooked, const VisualWorld& world) override;
47
50 std::size_t asyncPollUpdatedRegions(TSpan<RenderRegionStatus> out_regions) override;
51
52 const SampleFilter& getFilter() const;
53 const PMCommonParams& getCommonParams() const;
54 const Scene* getScene() const;
55 const Receiver* getReceiver() const;
57 TSynchronized<HdrRgbFilm>& getPrimaryFilm();
59 void asyncDevelopPrimaryFilm(const Region& region, HdrRgbFrame& out_frame);
60 void asyncMergeToPrimaryFilm(const HdrRgbFilm& srcFilm);
61 void asyncReplacePrimaryFilm(const HdrRgbFilm& srcFilm);
62
63private:
64 SampleFilter m_filter;
65 PMCommonParams m_commonParams;
66
67 const Scene* m_scene;
68 const Receiver* m_receiver;
69 const SampleGenerator* m_sampleGenerator;
70
71 TSynchronized<HdrRgbFilm> m_primaryFilm;
72 PMAtomicStatistics m_statistics;
73 std::atomic_flag m_isPrimaryFilmUpdated;
74};
75
77{
78 return m_filter;
79}
80
82{
83 return m_commonParams;
84}
85
86inline const Scene* PMRendererBase::getScene() const
87{
88 return m_scene;
89}
90
92{
93 return m_receiver;
94}
95
97{
98 return m_sampleGenerator;
99}
100
101inline TSynchronized<HdrRgbFilm>& PMRendererBase::getPrimaryFilm()
102{
103 return m_primaryFilm;
104}
105
107{
108 return m_statistics;
109}
110
111}// end namespace ph
Definition CoreCookedUnit.h:19
A film that records RGB values internally. Although film samples are added as spectral values,...
Definition HdrRgbFilm.h:21
Thread safe statictics tracking utilities.
Definition PMAtomicStatistics.h:13
Common parameters of photon mapping.
Definition PMCommonParams.h:13
Definition PMRendererBase.h:23
RenderObservationInfo getObservationInfo() const =0
Get information about available transient outputs of an ongoing render operation. This information wi...
void asyncDevelopPrimaryFilm(const Region &region, HdrRgbFrame &out_frame)
Definition PMRendererBase.cpp:69
void asyncReplacePrimaryFilm(const HdrRgbFilm &srcFilm)
Definition PMRendererBase.cpp:84
void doUpdate(const CoreCookedUnit &cooked, const VisualWorld &world) override
Gather cooked data. Perform any required initialization before render.
Definition PMRendererBase.cpp:35
const Receiver * getReceiver() const
Definition PMRendererBase.h:91
const SampleGenerator * getSampleGenerator() const
Definition PMRendererBase.h:96
PMAtomicStatistics & getStatistics()
Definition PMRendererBase.h:106
void doRender() override=0
Perform rendering.
TSynchronized< HdrRgbFilm > & getPrimaryFilm()
Definition PMRendererBase.h:101
RenderProgress asyncQueryRenderProgress() override=0
Get progress of the ongoing rendering process. Implementation is advised to provide this information ...
PMRendererBase(PMCommonParams commonParams, Viewport viewport, SampleFilter filter, uint32 numWorkers)
Definition PMRendererBase.cpp:15
std::size_t asyncPollUpdatedRegions(TSpan< RenderRegionStatus > out_regions) override
Get updated regions based on the state of primary film.
Definition PMRendererBase.cpp:46
void asyncPeekFrame(std::size_t layerIndex, const Region &region, HdrRgbFrame &out_frame) override=0
Get the intermediate render result. This method is similar to retrieveFrame(), except that correctnes...
void asyncMergeToPrimaryFilm(const HdrRgbFilm &srcFilm)
Definition PMRendererBase.cpp:76
const Scene * getScene() const
Definition PMRendererBase.h:86
const PMCommonParams & getCommonParams() const
Definition PMRendererBase.h:81
void retrieveFrame(std::size_t layerIndex, HdrRgbFrame &out_frame) override=0
Get the rendered result.
RenderStats asyncQueryRenderStats() override=0
Get general information of the ongoing rendering process. More information can be provided by the imp...
const SampleFilter & getFilter() const
Definition PMRendererBase.h:76
A target that can receive any physical quantity, typically electromagnetic energy....
Definition Receiver.h:22
Meta information for data related to ongoing render operation.
Definition RenderObservationInfo.h:15
Definition RenderProgress.h:12
Definition RenderStats.h:12
Definition Renderer.h:39
uint32 numWorkers() const
Definition Renderer.h:155
An image reconstruction kernel.
Definition SampleFilter.h:17
Generates samples in [0, 1]. Generators of different types produces samples with different properties...
Definition SampleGenerator.h:35
A unified interface for accessing cooked content in a visual world.
Definition Scene.h:27
Definition Viewport.h:16
A virtual world for image synthesis.
Definition VisualWorld.h:34
The root for all renderer implementations.
Definition EEngineProject.h:6
PH_DECLARE_LOG_GROUP(ActorCooking)
std::span< T, EXTENT > TSpan
A contiguous sequence of objects of type T. Effectively the same as std::span.
Definition TSpan.h:12