Skip to content

Commit

Permalink
Hide base pixel renderer parameters from derived classes and fill review
Browse files Browse the repository at this point in the history
  • Loading branch information
oktomus committed Mar 8, 2018
1 parent c69750a commit 97dda7c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace
, m_params(params)
, m_sample_renderer(factory->create(thread_index))
{
if (PixelRendererBase::m_params.m_diagnostics)
if (is_diagnostics_enabled())
{
m_variation_aov_index = frame.create_extra_aov_image("variation");
m_samples_aov_index = frame.create_extra_aov_image("samples");
Expand All @@ -117,7 +117,7 @@ namespace
m_params.m_min_samples,
m_params.m_max_samples,
m_params.m_max_variation,
PixelRendererBase::m_params.m_diagnostics ? "on" : "off");
is_diagnostics_enabled() ? "on" : "off");
}

void release() override
Expand All @@ -142,9 +142,11 @@ namespace
frame.aov_images().size(),
frame.get_filter()));

if (PixelRendererBase::m_params.m_diagnostics)
if (is_diagnostics_enabled())
{
m_diagnostics.reset(new Tile(
tile.get_width(), tile.get_height(), 2, PixelFormatFloat));
}
}

void on_tile_end(
Expand All @@ -154,7 +156,7 @@ namespace
{
PixelRendererBase::on_tile_end(frame, tile, aov_tiles);

if (PixelRendererBase::m_params.m_diagnostics)
if (is_diagnostics_enabled())
{
const size_t width = tile.get_width();
const size_t height = tile.get_height();
Expand Down Expand Up @@ -291,7 +293,7 @@ namespace
}

// Store diagnostics values in the diagnostics tile.
if (PixelRendererBase::m_params.m_diagnostics && tile_bbox.contains(pt))
if (is_diagnostics_enabled() && tile_bbox.contains(pt))
{
Color<float, 2> values;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
#include <cstddef>

// Forward declarations.
namespace founcation { class Dictionary; }
namespace foundation { class Dictionary; }
namespace renderer { class Frame; }
namespace renderer { class ISampleRendererFactory; }

namespace renderer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace
m_params.m_samples,
m_params.m_force_aa ? "on" : "off",
m_params.m_decorrelate ? "on" : "off",
PixelRendererBase::m_params.m_diagnostics ? "on" : "off");
is_diagnostics_enabled() ? "on" : "off");
}

void release() override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

// Forward declarations.
namespace foundation { class Dictionary; }
namespace renderer { class Frame; }
namespace renderer { class ISampleRendererFactory; }

namespace renderer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ PixelRendererBase::PixelRendererBase(
}
}

bool PixelRendererBase::is_diagnostics_enabled() const
{
return m_params.m_diagnostics;
}

void PixelRendererBase::on_tile_begin(
const Frame& frame,
Tile& tile,
Expand Down Expand Up @@ -161,7 +166,7 @@ void PixelRendererBase::on_pixel_end(
}

// Invalid samples diagnostic
if (tile_bbox.contains(pt) && m_params.m_diagnostics)
if (m_params.m_diagnostics && tile_bbox.contains(pt))
{
Color<uint8, 1> sample_state;

Expand Down
6 changes: 3 additions & 3 deletions src/appleseed/renderer/kernel/rendering/pixelrendererbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class PixelRendererBase
const size_t thread_index,
const ParamArray& params);

bool is_diagnostics_enabled() const;

// This method is called before a tile gets rendered.
void on_tile_begin(
const Frame& frame,
Expand Down Expand Up @@ -109,9 +111,7 @@ class PixelRendererBase
size_t m_invalid_pixel_count;
size_t m_invalid_sample_aov_index;
std::unique_ptr<foundation::Tile> m_invalid_sample_diagnostic;

protected:
const Parameters m_params;
const Parameters m_params;
};


Expand Down

0 comments on commit 97dda7c

Please sign in to comment.