Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Vector3Film.h
Go to the documentation of this file.
1#pragma once
2
5#include "Math/TVector3.h"
7
8#include <Common/primitive_type.h>
9
10#include <vector>
11
12namespace ph
13{
14
17class Vector3Film : public TSamplingFilm<math::Vector3R>
18{
19public:
21 int64 actualWidthPx,
22 int64 actualHeightPx,
23 const SampleFilter& filter);
24
26 int64 actualWidthPx,
27 int64 actualHeightPx,
28 const math::TAABB2D<int64>& effectiveWindowPx,
29 const SampleFilter& filter);
30
31 void addSample(float64 xPx, float64 yPx, const math::Vector3R& sample) override;
32 void setPixel(float64 xPx, float64 yPx, const math::Vector3R& sample) override;
33 void clear() override;
34 void setEffectiveWindowPx(const math::TAABB2D<int64>& effectiveWindow) override;
35
36private:
37 void developRegion(HdrRgbFrame& out_frame, const math::TAABB2D<int64>& regionPx) const override;
38
39 HdrRgbFilm m_film;
40};
41
42// In-header Implementations:
43
45 const int64 actualWidthPx,
46 const int64 actualHeightPx,
47 const SampleFilter& filter)
48
49 : TSamplingFilm(actualWidthPx, actualHeightPx, filter)
50
51 , m_film(actualWidthPx, actualHeightPx, filter)
52{}
53
55 const int64 actualWidthPx,
56 const int64 actualHeightPx,
57 const math::TAABB2D<int64>& effectiveWindowPx,
58 const SampleFilter& filter)
59
60 : TSamplingFilm(actualWidthPx, actualHeightPx, effectiveWindowPx, filter)
61
62 , m_film(actualWidthPx, actualHeightPx, effectiveWindowPx, filter)
63{}
64
65inline void Vector3Film::addSample(const float64 xPx, const float64 yPx, const math::Vector3R& sample)
66{
67 m_film.addRgbSample(xPx, yPx, sample);
68}
69
70inline void Vector3Film::setPixel(const float64 xPx, const float64 yPx, const math::Vector3R& sample)
71{
72 m_film.setRgbPixel(xPx, yPx, sample);
73}
74
75inline void Vector3Film::clear()
76{
77 m_film.clear();
78}
79
80//inline std::unique_ptr<TSamplingFilm<Vector3R>> Vector3Film::genSamplingChild(const TAABB2D<int64>& effectiveWindowPx)
81//{
82// auto childFilm = std::make_unique<Vector3Film>(
83// getActualResPx().x, getActualResPx().y,
84// effectiveWindowPx,
85// getFilter());
86//
87// Vector3Film* child = childFilm.getReference();
88// Vector3Film* parent = this;
89// childFilm->setMerger([=]()
90// {
91// PH_ASSERT(child && parent);
92//
93// parent->m_film.mergeWith(child->m_film);
94// });
95//
96// return childFilm;
97//}
98
100{
102
103 m_film.setEffectiveWindowPx(effectiveWindow);
104}
105
106inline void Vector3Film::developRegion(HdrRgbFrame& out_frame, const math::TAABB2D<int64>& regionPx) const
107{
108 m_film.develop(out_frame, regionPx);
109}
110
111}// end namespace ph
void develop(HdrRgbFrame &out_frame) const
Definition Film.cpp:36
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
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
An image reconstruction kernel.
Definition SampleFilter.h:17
A camera film that receives any quantity, for sampling-based rendering techniques.
Definition TSamplingFilm.h:22
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 TSamplingFilm.ipp:55
A film that records 3-D vectors.
Definition Vector3Film.h:18
void setPixel(float64 xPx, float64 yPx, const math::Vector3R &sample) override
Let the pixel developes to the specified sample value. An interface for using the film as an ordinary...
Definition Vector3Film.h:70
void clear() override
Set all pixel data to its initial state.
Definition Vector3Film.h:75
Vector3Film(int64 actualWidthPx, int64 actualHeightPx, const SampleFilter &filter)
Definition Vector3Film.h:44
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 Vector3Film.h:99
void addSample(float64 xPx, float64 yPx, const math::Vector3R &sample) override
Applies filter to sample value and add to the film. Generally, this method can produce higher quality...
Definition Vector3Film.h:65
A 2-D Axis-Aligned Bounding Box (AABB).
Definition TAABB2D.h:26
The root for all renderer implementations.
Definition EEngineProject.h:6