Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
EqualSamplingRenderer.h
Go to the documentation of this file.
1#pragma once
2
10#include "Math/Color/Spectrum.h"
11#include "Math/TVector2.h"
13
14#include <vector>
15#include <memory>
16#include <atomic>
17#include <functional>
18
19namespace ph
20{
21
22class Scene;
23class Receiver;
24class SampleGenerator;
25
27{
28public:
30 std::unique_ptr<IRayEnergyEstimator> estimator,
31 Viewport viewport,
32 SampleFilter filter,
33 uint32 numWorkers,
34 EScheduler scheduler);
35
36 void doUpdate(const CoreCookedUnit& cooked, const VisualWorld& world) override;
37 void doRender() override;
38 void retrieveFrame(std::size_t layerIndex, HdrRgbFrame& out_frame) override;
39
40 std::size_t asyncPollUpdatedRegions(TSpan<RenderRegionStatus> out_regions) override;
43
44 void asyncPeekFrame(
45 std::size_t layerIndex,
46 const Region& region,
47 HdrRgbFrame& out_frame) override;
48
50
51private:
53
54 void asyncAddUpdatedRegion(const Region& region, bool isUpdating);
55 void initScheduler(std::size_t numSamplesPerPixel);
56
57 const Scene* m_scene;
58 const Receiver* m_receiver;
59 SampleGenerator* m_sampleGenerator;
60 HdrRgbFilm m_mainFilm;
61
62 std::unique_ptr<WorkScheduler> m_scheduler;
63 EScheduler m_schedulerType;
64 math::Vector2S m_blockSize;
65 TAtomicQuasiQueue<RenderRegionStatus> m_updatedRegionQueue;
66
67 std::vector<ReceiverSamplingWork> m_renderWorks;
68 std::vector<FilmEstimator> m_filmEstimators;
69 std::vector<MetaRecordingProcessor> m_metaRecorders;
70
71 std::mutex m_rendererMutex;
72 std::atomic_uint64_t m_totalPaths;
73 std::atomic_uint64_t m_totalElapsedMs;
74 std::atomic_uint32_t m_suppliedFractionBits;
75 std::atomic_uint32_t m_submittedFractionBits;
76};
77
78}// end namespace ph
Definition CoreCookedUnit.h:19
Definition EqualSamplingRenderer.h:27
RenderObservationInfo getObservationInfo() const override
Get information about available transient outputs of an ongoing render operation. This information wi...
Definition EqualSamplingRenderer.cpp:313
void asyncPeekFrame(std::size_t layerIndex, const Region &region, HdrRgbFrame &out_frame) override
Get the intermediate render result. This method is similar to retrieveFrame(), except that correctnes...
Definition EqualSamplingRenderer.cpp:215
void doUpdate(const CoreCookedUnit &cooked, const VisualWorld &world) override
Perform necessary updates for rendering. No asynchronous operation is allowed during update.
Definition EqualSamplingRenderer.cpp:75
RenderProgress asyncQueryRenderProgress() override
Get progress of the ongoing rendering process. Implementation is advised to provide this information ...
Definition EqualSamplingRenderer.cpp:282
std::size_t asyncPollUpdatedRegions(TSpan< RenderRegionStatus > out_regions) override
Get the rendering regions that have been updated. Status of a region will always transition to ERegio...
Definition EqualSamplingRenderer.cpp:205
void doRender() override
Perform rendering.
Definition EqualSamplingRenderer.cpp:119
RenderStats asyncQueryRenderStats() override
Get general information of the ongoing rendering process. More information can be provided by the imp...
Definition EqualSamplingRenderer.cpp:258
EqualSamplingRenderer(std::unique_ptr< IRayEnergyEstimator > estimator, Viewport viewport, SampleFilter filter, uint32 numWorkers, EScheduler scheduler)
Definition EqualSamplingRenderer.cpp:41
void retrieveFrame(std::size_t layerIndex, HdrRgbFrame &out_frame) override
Get the rendered result.
Definition EqualSamplingRenderer.cpp:234
A film that records RGB values internally. Although film samples are added as spectral values,...
Definition HdrRgbFilm.h:21
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
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
Definition SamplingRenderer.h:13
A unified interface for accessing cooked content in a visual world.
Definition Scene.h:27
A multi-producer, multi-consumer, lock-free concurrent queue-like structure. For single-thread uses,...
Definition TAtomicQuasiQueue.h:24
Definition TReceiverMeasurementEstimator.h:23
Definition Viewport.h:16
A virtual world for image synthesis.
Definition VisualWorld.h:34
The root for all renderer implementations.
Definition EEngineProject.h:6
std::span< T, EXTENT > TSpan
A contiguous sequence of objects of type T. Effectively the same as std::span.
Definition TSpan.h:12
EScheduler
Definition EScheduler.h:7