Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::Renderer Class Referenceabstract

#include <Renderer.h>

Inheritance diagram for ph::Renderer:
ph::AttributeRenderer ph::PMRendererBase ph::SamplingRenderer ph::ProbabilisticProgressivePMRenderer ph::ProgressivePMRenderer ph::StochasticProgressivePMRenderer ph::VanillaPMRenderer ph::AdaptiveSamplingRenderer ph::EqualSamplingRenderer

Public Member Functions

 Renderer (Viewport viewport, uint32 numWorkers)
 
virtual ~Renderer ()
 
virtual void doUpdate (const CoreCookedUnit &cooked, const VisualWorld &world)=0
 Perform necessary updates for rendering. No asynchronous operation is allowed during update.
 
virtual void doRender ()=0
 Perform rendering.
 
virtual void retrieveFrame (std::size_t layerIndex, HdrRgbFrame &out_frame)=0
 Get the rendered result.
 
virtual std::size_t asyncPollUpdatedRegions (TSpan< RenderRegionStatus > out_regions)=0
 Get the rendering regions that have been updated. Status of a region will always transition to ERegionStatus::Finished, and this ordering guarantee is valid for one or across multiple calls. Note that if the renderer has multiple workers working on the same region, you may observe a region transition from ERegionStatus::Finished to other status multiple times, but in the end it will eventually be ERegionStatus::Finished.
 
virtual RenderStats asyncQueryRenderStats ()=0
 Get general information of the ongoing rendering process. More information can be provided by the implementation. The meaning of each stat can be obtained via getObservationInfo().
 
virtual RenderProgress asyncQueryRenderProgress ()=0
 Get progress of the ongoing rendering process. Implementation is advised to provide this information as it is vital for the caller to be able to observe the progress of a potentially long-running rendering process.
 
virtual void asyncPeekFrame (std::size_t layerIndex, const Region &region, HdrRgbFrame &out_frame)=0
 Get the intermediate render result. This method is similar to retrieveFrame(), except that correctness is not guaranteed for the returned frame.
 
virtual RenderObservationInfo getObservationInfo () const =0
 Get information about available transient outputs of an ongoing render operation. This information will be determined after each update (constant throughout the following rendering process). The actual data and can be retrieved via async<X>() methods.
 
void update (const CoreCookedUnit &cooked, const VisualWorld &world)
 Start updating.
 
void render ()
 Start rendering.
 
void setNumWorkers (uint32 numWorkers)
 Set number of workers for the renderer.
 
uint32 numWorkers () const
 
uint32 getRenderWidthPx () const
 
uint32 getRenderHeightPx () const
 
math::TAABB2D< int64 > getCropWindowPx () const
 The region to work on. The user may specify a window to confine all operations to this region. Note that this is not necessary the region that will be rendered (see getRenderRegionPx()).
 
math::TAABB2D< int64 > getRenderRegionPx () const
 The region that is going to be rendered. The difference between render region and crop window is that render region will never exceed the area defined by the base render size ([0, 0] to [getRenderWidthPx(), getRenderHeightPx()]).
 
const ViewportgetViewport () const
 Descriptions regarding dimensions for the rendered frame. Viewport is set on ctor and stayed constant during the lifetime of the renderer.
 
bool asyncIsUpdating () const
 
bool asyncIsRendering () const
 
std::size_t asyncPollMergedUpdatedRegions (TSpan< RenderRegionStatus > out_regions, std::size_t mergeSize)
 Get the rendering region that has been updated. This variant polls for combined regions. Note that this variant does not guarantee any status ordering for a region. If a more fine-grained result is desired, use asyncPollUpdatedRegions().
 

Constructor & Destructor Documentation

◆ Renderer()

ph::Renderer::Renderer ( Viewport viewport,
uint32 numWorkers )

◆ ~Renderer()

ph::Renderer::~Renderer ( )
virtualdefault

Member Function Documentation

◆ asyncIsRendering()

bool ph::Renderer::asyncIsRendering ( ) const
inline

◆ asyncIsUpdating()

bool ph::Renderer::asyncIsUpdating ( ) const
inline

◆ asyncPeekFrame()

virtual void ph::Renderer::asyncPeekFrame ( std::size_t layerIndex,
const Region & region,
HdrRgbFrame & out_frame )
pure virtual

Get the intermediate render result. This method is similar to retrieveFrame(), except that correctness is not guaranteed for the returned frame.

Implemented in ph::AdaptiveSamplingRenderer, ph::AttributeRenderer, ph::EqualSamplingRenderer, ph::PMRendererBase, ph::ProbabilisticProgressivePMRenderer, ph::ProgressivePMRenderer, ph::SamplingRenderer, ph::StochasticProgressivePMRenderer, and ph::VanillaPMRenderer.

◆ asyncPollMergedUpdatedRegions()

std::size_t ph::Renderer::asyncPollMergedUpdatedRegions ( TSpan< RenderRegionStatus > out_regions,
std::size_t mergeSize )

Get the rendering region that has been updated. This variant polls for combined regions. Note that this variant does not guarantee any status ordering for a region. If a more fine-grained result is desired, use asyncPollUpdatedRegions().

Parameters
out_regionsOutput buffer for storing the updated regions. The size of the buffer also determines the maximum number of regions that will participate in the merging process.
mergeSizeNumber of regions to merge to a single unit. To obtain a single region, you can specify a number greater or equal to the size of the output buffer.

◆ asyncPollUpdatedRegions()

virtual std::size_t ph::Renderer::asyncPollUpdatedRegions ( TSpan< RenderRegionStatus > out_regions)
pure virtual

Get the rendering regions that have been updated. Status of a region will always transition to ERegionStatus::Finished, and this ordering guarantee is valid for one or across multiple calls. Note that if the renderer has multiple workers working on the same region, you may observe a region transition from ERegionStatus::Finished to other status multiple times, but in the end it will eventually be ERegionStatus::Finished.

Parameters
out_regionsOutput buffer for storing the updated regions.
Returns
Number of regions actually stored in the output buffer.

Implemented in ph::AdaptiveSamplingRenderer, ph::AttributeRenderer, ph::EqualSamplingRenderer, ph::PMRendererBase, and ph::SamplingRenderer.

◆ asyncQueryRenderProgress()

virtual RenderProgress ph::Renderer::asyncQueryRenderProgress ( )
pure virtual

Get progress of the ongoing rendering process. Implementation is advised to provide this information as it is vital for the caller to be able to observe the progress of a potentially long-running rendering process.

Implemented in ph::AdaptiveSamplingRenderer, ph::AttributeRenderer, ph::EqualSamplingRenderer, ph::PMRendererBase, ph::ProbabilisticProgressivePMRenderer, ph::ProgressivePMRenderer, ph::SamplingRenderer, ph::StochasticProgressivePMRenderer, and ph::VanillaPMRenderer.

◆ asyncQueryRenderStats()

virtual RenderStats ph::Renderer::asyncQueryRenderStats ( )
pure virtual

Get general information of the ongoing rendering process. More information can be provided by the implementation. The meaning of each stat can be obtained via getObservationInfo().

Implemented in ph::AdaptiveSamplingRenderer, ph::AttributeRenderer, ph::EqualSamplingRenderer, ph::PMRendererBase, ph::ProbabilisticProgressivePMRenderer, ph::ProgressivePMRenderer, ph::SamplingRenderer, ph::StochasticProgressivePMRenderer, and ph::VanillaPMRenderer.

◆ doRender()

◆ doUpdate()

virtual void ph::Renderer::doUpdate ( const CoreCookedUnit & cooked,
const VisualWorld & world )
pure virtual

Perform necessary updates for rendering. No asynchronous operation is allowed during update.

Implemented in ph::AdaptiveSamplingRenderer, ph::AttributeRenderer, ph::EqualSamplingRenderer, ph::PMRendererBase, and ph::SamplingRenderer.

◆ getCropWindowPx()

math::TAABB2D< int64 > ph::Renderer::getCropWindowPx ( ) const
inline

The region to work on. The user may specify a window to confine all operations to this region. Note that this is not necessary the region that will be rendered (see getRenderRegionPx()).

◆ getObservationInfo()

virtual RenderObservationInfo ph::Renderer::getObservationInfo ( ) const
pure virtual

Get information about available transient outputs of an ongoing render operation. This information will be determined after each update (constant throughout the following rendering process). The actual data and can be retrieved via async<X>() methods.

Implemented in ph::AdaptiveSamplingRenderer, ph::AttributeRenderer, ph::EqualSamplingRenderer, ph::PMRendererBase, ph::ProbabilisticProgressivePMRenderer, ph::ProgressivePMRenderer, ph::SamplingRenderer, ph::StochasticProgressivePMRenderer, and ph::VanillaPMRenderer.

◆ getRenderHeightPx()

uint32 ph::Renderer::getRenderHeightPx ( ) const
inline

◆ getRenderRegionPx()

math::TAABB2D< int64 > ph::Renderer::getRenderRegionPx ( ) const
inline

The region that is going to be rendered. The difference between render region and crop window is that render region will never exceed the area defined by the base render size ([0, 0] to [getRenderWidthPx(), getRenderHeightPx()]).

◆ getRenderWidthPx()

uint32 ph::Renderer::getRenderWidthPx ( ) const
inline

◆ getViewport()

const Viewport & ph::Renderer::getViewport ( ) const
inline

Descriptions regarding dimensions for the rendered frame. Viewport is set on ctor and stayed constant during the lifetime of the renderer.

◆ numWorkers()

uint32 ph::Renderer::numWorkers ( ) const
inline

◆ render()

void ph::Renderer::render ( )

Start rendering.

◆ retrieveFrame()

◆ setNumWorkers()

void ph::Renderer::setNumWorkers ( uint32 numWorkers)

Set number of workers for the renderer.

◆ update()

void ph::Renderer::update ( const CoreCookedUnit & cooked,
const VisualWorld & world )

Start updating.


The documentation for this class was generated from the following files: