Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
HdrRgbFilm.h
Go to the documentation of this file.
1#pragma once
2
3#include "Math/math_fwd.h"
7
8#include <Common/primitive_type.h>
9
10#include <vector>
11#include <algorithm>
12
13namespace ph
14{
15
20class HdrRgbFilm : public TSamplingFilm<math::Spectrum>
21{
22public:
23 HdrRgbFilm() = default;
24
26 int64 actualWidthPx,
27 int64 actualHeightPx,
28 const SampleFilter& filter);
29
31 int64 actualWidthPx,
32 int64 actualHeightPx,
33 const math::TAABB2D<int64>& effectiveWindowPx,
34 const SampleFilter& filter);
35
36 void addSample(float64 xPx, float64 yPx, const math::Spectrum& sample) override;
37 void setPixel(float64 xPx, float64 yPx, const math::Spectrum& sample) override;
38 void clear() override;
39 void setEffectiveWindowPx(const math::TAABB2D<int64>& effectiveWindow) override;
40
47 void addRgbSample(float64 xPx, float64 yPx, const math::Vector3R& rgb);
48 void addRgbSample(float64 xPx, float64 yPx, const math::Vector3D& rgb);
50
61 void setRgbPixel(float64 xPx, float64 yPx, const math::Vector3R& rgb, float64 weight = 1);
62 void setRgbPixel(float64 xPx, float64 yPx, const math::Vector3D& rgb, float64 weight = 1);
64
65 void mergeWith(const HdrRgbFilm& other);
66
67private:
68 void developRegion(HdrRgbFrame& out_frame, const math::TAABB2D<int64>& regionPx) const override;
69
70 void clearRadianceSensors();
71 void resizeRadianceSensorBuffer();
72
73 std::vector<RadianceSensor> m_pixelRadianceSensors;
74};
75
77 const float64 xPx,
78 const float64 yPx,
79 const math::Vector3R& rgb)
80{
81 addRgbSample(xPx, yPx, math::Vector3D(rgb));
82}
83
85 const float64 xPx,
86 const float64 yPx,
87 const math::Vector3R& rgb,
88 const float64 weight)
89{
90 setRgbPixel(xPx, yPx, math::Vector3D(rgb), weight);
91}
92
93inline void HdrRgbFilm::clearRadianceSensors()
94{
95 std::fill(m_pixelRadianceSensors.begin(), m_pixelRadianceSensors.end(), RadianceSensor());
96}
97
98inline void HdrRgbFilm::resizeRadianceSensorBuffer()
99{
100 m_pixelRadianceSensors.resize(getEffectiveWindowPx().getArea());
101}
102
103}// end namespace ph
const math::TAABB2D< int64 > & getEffectiveWindowPx() const
Definition Film.h:92
A film that records RGB values internally. Although film samples are added as spectral values,...
Definition HdrRgbFilm.h:21
void setEffectiveWindowPx(const math::TAABB2D< int64 > &effectiveWindow) override
Set the region where the film will be used. Implementation is advised to take advantage of this and o...
Definition HdrRgbFilm.cpp:241
void setRgbPixel(float64 xPx, float64 yPx, const math::Vector3R &rgb, float64 weight=1)
Set a pixel directly. Filter is not applied when setting a pixel directly (effectively applying a box...
Definition HdrRgbFilm.h:84
HdrRgbFilm()=default
void setPixel(float64 xPx, float64 yPx, const math::Spectrum &sample) override
Let the pixel developes to the specified sample value. An interface for using the film as an ordinary...
Definition HdrRgbFilm.cpp:72
void addSample(float64 xPx, float64 yPx, const math::Spectrum &sample) override
Applies filter to sample value and add to the film. Generally, this method can produce higher quality...
Definition HdrRgbFilm.cpp:62
void clear() override
Set all pixel data to its initial state.
Definition HdrRgbFilm.cpp:209
void addRgbSample(float64 xPx, float64 yPx, const math::Vector3R &rgb)
Add a pixel sample.
Definition HdrRgbFilm.h:76
void mergeWith(const HdrRgbFilm &other)
Definition HdrRgbFilm.cpp:214
Definition RadianceSensor.h:11
An image reconstruction kernel.
Definition SampleFilter.h:17
A camera film that receives any quantity, for sampling-based rendering techniques.
Definition TSamplingFilm.h:22
A 2-D Axis-Aligned Bounding Box (AABB).
Definition TAABB2D.h:26
Definition TTristimulusSpectrum.h:11
The root for all renderer implementations.
Definition EEngineProject.h:6