8#include <Common/assertion.h>
9#include <Common/logging.h>
18template<
typename Sample>
20 const int64 actualWidthPx,
21 const int64 actualHeightPx,
29 math::
TVector2<int64>(actualWidthPx, actualHeightPx)),
33template<
typename Sample>
35 const int64 actualWidthPx,
36 const int64 actualHeightPx,
46 , m_sampleWindowPx(math::
TAABB2D<float64>::makeEmpty())
54template<
typename Sample>
59 updateSampleDimensions();
62template<
typename Sample>
65 PH_ASSERT_IN_RANGE_INCLUSIVE(softness, 0.0f, 1.0f);
66 m_softness = useSoftEdge ? softness : 0.0f;
68 updateSampleDimensions();
71template<
typename Sample>
77template<
typename Sample>
80 return {m_sampleWindowPx.getWidth(), m_sampleWindowPx.getHeight()};
83template<
typename Sample>
85 -> const math::
TAABB2D<float64>&
87 return m_sampleWindowPx;
90template<
typename Sample>
93 return {getActualResPx(), getEffectiveWindowPx(), getSampleWindowPx()};
96template<
typename Sample>
99 return m_softness > 0.0f;
102template<
typename Sample>
106 const auto pxToExpand =
math::Vector2D(m_filter.getHalfSizePx()) * m_softness;
110 math::Vector2D(getEffectiveWindowPx().getMinVertex()).add(0.5).sub(pxToExpand),
111 math::Vector2D(getEffectiveWindowPx().getMaxVertex()).sub(0.5).add(pxToExpand));
113 if(m_sampleWindowPx.isEmpty())
115 PH_DEFAULT_LOG(Warning,
116 "Sampling film has empty sample window (effective window = {}, half filter size = {}, "
117 "softness = {}).", getEffectiveWindowPx().toString(), getFilter().getHalfSizePx(), m_softness);
125 if(m_softness == 0.0f && m_filter.getHalfSizePx().isEqual({0.5, 0.5}))
128 const auto fEffectiveWindowPx = math::TAABB2D<float64>(getEffectiveWindowPx());
129 PH_ASSERT_MSG(m_sampleWindowPx == fEffectiveWindowPx,
130 "sample window = " + m_sampleWindowPx.toString() +
", "
131 "effective window = " + fEffectiveWindowPx.toString());
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
An image reconstruction kernel.
Definition SampleFilter.h:17
A camera film that receives any quantity, for sampling-based rendering techniques.
Definition TSamplingFilm.h:22
const SampleFilter & getFilter() const
Definition TSamplingFilm.ipp:72
void setSoftEdge(bool useSoftEdge, float32 softness=1.0f)
Whether to increase the sampling window converage for prettier boundaries in developed frame....
Definition TSamplingFilm.ipp:63
math::TVector2< float64 > getSampleResPx() const
Definition TSamplingFilm.ipp:78
bool isSoftEdged() const
Definition TSamplingFilm.ipp:97
const math::TAABB2D< float64 > & getSampleWindowPx() const
Definition TSamplingFilm.ipp:84
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
SamplingFilmDimensions getDimensions() const
Definition TSamplingFilm.ipp:91
A 2-D Axis-Aligned Bounding Box (AABB).
Definition TAABB2D.h:26
Represents a 2-D vector.
Definition TVector2.h:19
TVector2< float64 > Vector2D
Definition math_fwd.h:47
The root for all renderer implementations.
Definition EEngineProject.h:6
Definition SamplingFilmDimensions.h:12