Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Film.h
Go to the documentation of this file.
1#pragma once
2
4#include "Math/TVector2.h"
5#include "Frame/frame_fwd.h"
6#include "Utility/IMoveOnly.h"
7
8#include <Common/assertion.h>
9#include <Common/primitive_type.h>
10
11namespace ph
12{
13
16class Film : private IMoveOnly
17{
18public:
19 Film();
20
21 Film(
22 int64 actualWidthPx,
23 int64 actualHeightPx);
24
25 Film(
26 int64 actualWidthPx,
27 int64 actualHeightPx,
28 const math::TAABB2D<int64>& effectiveWindowPx);
29
30 Film(Film&& other) = default;
31 Film& operator = (Film&& other) = default;
32
33 virtual ~Film() = default;
34
37 virtual void clear() = 0;
38
43 virtual void setActualResPx(const math::TVector2<int64>& actualResPx);
44
49 virtual void setEffectiveWindowPx(const math::TAABB2D<int64>& effectiveWindow);
50
51 void develop(HdrRgbFrame& out_frame) const;
52 void develop(HdrRgbFrame& out_frame, const math::TAABB2D<int64>& regionPx) const;
53
57
58private:
59 virtual void developRegion(HdrRgbFrame& out_frame, const math::TAABB2D<int64>& regionPx) const = 0;
60
61 math::TVector2<int64> m_actualResPx;
62 math::TAABB2D<int64> m_effectiveWindowPx;
63};
64
65// In-header Implementations:
66
67inline void Film::setActualResPx(const math::TVector2<int64>& actualResPx)
68{
69 PH_ASSERT_GE(actualResPx.x(), 0);
70 PH_ASSERT_GE(actualResPx.y(), 0);
71
72 m_actualResPx = actualResPx;
73}
74
75inline void Film::setEffectiveWindowPx(const math::TAABB2D<int64>& effectiveWindow)
76{
77 PH_ASSERT(!effectiveWindow.isEmpty());
78
79 m_effectiveWindowPx = effectiveWindow;
80}
81
83{
84 return m_actualResPx;
85}
86
88{
89 return {m_effectiveWindowPx.getWidth(), m_effectiveWindowPx.getHeight()};
90}
91
92inline auto Film::getEffectiveWindowPx() const
93 -> const math::TAABB2D<int64>&
94{
95 return m_effectiveWindowPx;
96}
97
98}// end namespace ph
A camera film that receives any quantity.
Definition Film.h:17
virtual void setEffectiveWindowPx(const math::TAABB2D< int64 > &effectiveWindow)
Set the region where the film will be used. Implementation is advised to take advantage of this and o...
Definition Film.h:75
const math::TVector2< int64 > & getActualResPx() const
Definition Film.h:82
math::TVector2< int64 > getEffectiveResPx() const
Definition Film.h:87
virtual void clear()=0
Set all pixel data to its initial state.
Film()
Definition Film.cpp:8
Film & operator=(Film &&other)=default
virtual ~Film()=default
Film(Film &&other)=default
void develop(HdrRgbFrame &out_frame) const
Definition Film.cpp:36
virtual void setActualResPx(const math::TVector2< int64 > &actualResPx)
Set the apparent size of the film. If only a sub-region of the film is going to be used,...
Definition Film.h:67
const math::TAABB2D< int64 > & getEffectiveWindowPx() const
Definition Film.h:92
Marks the derived class as move only.
Definition IMoveOnly.h:23
A 2-D Axis-Aligned Bounding Box (AABB).
Definition TAABB2D.h:26
T getHeight() const
Definition TAABB2D.ipp:144
T getWidth() const
Definition TAABB2D.ipp:138
bool isEmpty() const
Definition TAABB2D.ipp:193
Represents a 2-D vector.
Definition TVector2.h:19
T & x()
Definition TVector2.ipp:38
T & y()
Definition TVector2.ipp:44
The root for all renderer implementations.
Definition EEngineProject.h:6