Rhino C++ API  8.6
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
IRhRdkPostEffectPipeline Class Referenceabstract

#include <RhRdkNewPostEffectPlugIn.h>

Classes

class  IChannel
 

Public Types

enum  : int {
  CreationFlags_None = 0x00, CreationFlags_DisableEarlyPostEffects = 0x01, CreationFlags_DisableToneMappingPostEffects = 0x02, CreationFlags_DisableLatePostEffects = 0x04,
  CreationFlags_DisableGamma = 0x08, CreationFlags_DisableAllPostEffects
}
 
enum  ExecuteContexts {
  ExecuteContexts::ProductionRendering = 0, ExecuteContexts::RealtimeRendering = 1, ExecuteContexts::ViewportDisplay = 2, ExecuteContexts::ThumbnailCreation = 3,
  ExecuteContexts::ConvertingToHDR = 4
}
 
enum  Histograms {
  eHistogram_None = 0x00, eHistogram_BeforeEarlyEffects = 0x01, eHistogram_BeforeToneMapping = 0x02, eHistogram_AfterToneMapping = 0x04,
  eHistogram_AfterLateEffects = 0x08, eHistogram_All = eHistogram_BeforeEarlyEffects | eHistogram_BeforeToneMapping | eHistogram_AfterToneMapping | eHistogram_AfterLateEffects, eHistogram_ToneMappingDisplay = eHistogram_BeforeToneMapping | eHistogram_AfterToneMapping, eHistogram_AfterEarlyEffects = eHistogram_BeforeToneMapping,
  eHistogram_BeforeLateEffects = eHistogram_AfterToneMapping
}
 

Public Member Functions

virtual ~IRhRdkPostEffectPipeline ()
 
virtual bool AllowGPU (void) const =0
 
virtual ON_2iSize Dimensions (void) const =0
 
virtual void * EVF (const wchar_t *wszFunc, void *pvData)=0
 
virtual bool Execute (const ON_4iRect &rect, bool bRenderingIsInProgress, ExecuteContexts uc, Histograms flagsHistogramsToUpdate, unsigned int reserved=0, void *pReserved=nullptr)=0
 
virtual IRhRdkPostEffectFindPostEffect (const UUID &uuidPostEffect) const =0
 
virtual const IChannelGetChannelForRead (const UUID &uuidChannel, unsigned int flags) const =0
 
virtual IChannelGetChannelForWrite (const UUID &uuidChannel, unsigned int flags)=0
 
virtual ON__UINT64 GetEndTimeInMilliseconds (void) const =0
 
virtual float GetMaxLuminance (void) const =0
 
virtual void GetPostEffects (OUT ON_SimpleArray< ON_UUID > &uuidPostEffects) const =0
 
virtual ON__UINT64 GetStartTimeInMilliseconds (void) const =0
 
virtual bool IsRendering (void) const =0
 
virtual UUID RenderingId (void) const =0
 
virtual bool ReportProgress (int rowsCompleted)=0
 
virtual void SetStartTimeInMilliseconds (ON__UINT64 ms)=0
 
virtual class IRhRdkPostEffectThreadEngineThreadEngine (void) const =0
 

Static Public Member Functions

static IRhRdkPostEffectPipelineNew (IRhRdkRenderWindow &rw, const UUID &uuidShowingChannel, int creationFlags)
 

Detailed Description

This object provides a way for post effects to access the frame buffer channels from a rendering and create new channels containing post-processed information which can be passed to the next post effect in the chain.

Consider a simple post effect that just modifies the red component of a rendering. It will call GetChannelForRead() to get the RGBA channel as its input, and it will call GetChannelForWrite() to get a new RGBA channel for its output. It will then read the input channel, do calculations and write to the output channel. When finished, it will call IChannel::Commit() passing on the output channel. Because both channels have the same identifier, this will replace the old channel with the new one so that subsequent post effects in the chain will use the new channel instead of the original. Note that this will only replace the channel used by the pipeline. The original channel will still exist in the frame buffer. This system allows any post effect to access any number of channels for reading and create any number of new channels which may or may not replace existing channels depending on the channel id. The final stage (convert to 8-bit) operates on the channels left in the pipeline by the post effect chain to produce the final 32-bit RGBA image.

It is also possible for a post effect to create and use any number of 'scratch' channels. If a post effect needs a temporary pixel buffer for some intermediate results, it can call GetChannelForWrite() with a custom (random) id. Once it is finished with this scratch channel, it will automatically be discarded by the pipeline.

See also
IRhRdkPostEffect

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : int
Enumerator
CreationFlags_None 
CreationFlags_DisableEarlyPostEffects 
CreationFlags_DisableToneMappingPostEffects 
CreationFlags_DisableLatePostEffects 
CreationFlags_DisableGamma 
CreationFlags_DisableAllPostEffects 

◆ ExecuteContexts

Enumerator
ProductionRendering 
RealtimeRendering 
ViewportDisplay 
ThumbnailCreation 
ConvertingToHDR 

◆ Histograms

Enumerator
eHistogram_None 
eHistogram_BeforeEarlyEffects 
eHistogram_BeforeToneMapping 
eHistogram_AfterToneMapping 
eHistogram_AfterLateEffects 
eHistogram_All 
eHistogram_ToneMappingDisplay 
eHistogram_AfterEarlyEffects 
eHistogram_BeforeLateEffects 

Constructor & Destructor Documentation

◆ ~IRhRdkPostEffectPipeline()

virtual IRhRdkPostEffectPipeline::~IRhRdkPostEffectPipeline ( )
inlinevirtual

Member Function Documentation

◆ AllowGPU()

virtual bool IRhRdkPostEffectPipeline::AllowGPU ( void  ) const
pure virtual
Returns
true if the pipeline is allowed to use the GPU, else false. post effect authors should check that GPU use is allowed before using the GPU in a post effect.

◆ Dimensions()

virtual ON_2iSize IRhRdkPostEffectPipeline::Dimensions ( void  ) const
pure virtual

Get the dimensions of the frame buffer. All channels in the frame buffer have the same dimensions.

◆ EVF()

virtual void* IRhRdkPostEffectPipeline::EVF ( const wchar_t *  wszFunc,
void *  pvData 
)
pure virtual

◆ Execute()

virtual bool IRhRdkPostEffectPipeline::Execute ( const ON_4iRect rect,
bool  bRenderingIsInProgress,
ExecuteContexts  uc,
Histograms  flagsHistogramsToUpdate,
unsigned int  reserved = 0,
void *  pReserved = nullptr 
)
pure virtual

Execute the pipeline. This executes all the post effects in order.

Parameters
rectis a rectangle within the frame buffer. Only this rectangle needs be modified by the post effects.
bRenderingIsInProgressis true if rendering is in progress (i.e., not yet completed).
ucprovides the context that this pipeline is running in.
flagsHistogramsToUpdateis a set of flags specifying when to update the frame buffer's histograms.
Returns
true if successful, else false.

◆ FindPostEffect()

virtual IRhRdkPostEffect* IRhRdkPostEffectPipeline::FindPostEffect ( const UUID &  uuidPostEffect) const
pure virtual
Returns
a pointer to the specified post effect or null if not found.

◆ GetChannelForRead()

virtual const IChannel* IRhRdkPostEffectPipeline::GetChannelForRead ( const UUID &  uuidChannel,
unsigned int  flags 
) const
pure virtual

Get a channel for reading. A post effect will use this to get channel data as input to its process. Output will be written to new channel(s).

See also
GetChannelForWrite() This method returns the current state of the channel at this stage in the pipeline. If the first post effect calls this, it will get the actual frame buffer channel. Subsequent post effects will get the data left behind by the previous post effect. A post effect calls GetChannelForRead() to get its input and GetChannelForWrite() to get the object to which it will write its output. Even when the same channel id is specified, these are separate, unconnected objects.
Parameters
uuidChannelis the channel identifier.
flagsis for future use; you should pass zero.
Returns
A pointer to the channel or null if the channel is not available.

◆ GetChannelForWrite()

virtual IChannel* IRhRdkPostEffectPipeline::GetChannelForWrite ( const UUID &  uuidChannel,
unsigned int  flags 
)
pure virtual

Get a channel for writing. A post effect will use this to get channel(s) to write the output of its processing to. Input will usually come from existing channels, although a post effect is free to read its own output channels if needed.

See also
GetChannelForRead()
Parameters
uuidChannelis the channel identifier.
flagsis for future use; you should pass zero.
Returns
A pointer to the new channel or null if the channel could not be created.
Note
You are allowed to create one new channel with the same identifier as an existing channel, in which case IChannel::Commit() will replace the existing channel with the new one in the pipeline.

◆ GetEndTimeInMilliseconds()

virtual ON__UINT64 IRhRdkPostEffectPipeline::GetEndTimeInMilliseconds ( void  ) const
pure virtual

Get the end time of the rendering expressed in milliseconds since some unspecified epoch. Do not make assumptions about what the epoch is; it might be different on different platforms.

◆ GetMaxLuminance()

virtual float IRhRdkPostEffectPipeline::GetMaxLuminance ( void  ) const
pure virtual

Get the max luminance in the rendering.

◆ GetPostEffects()

virtual void IRhRdkPostEffectPipeline::GetPostEffects ( OUT ON_SimpleArray< ON_UUID > &  uuidPostEffects) const
pure virtual

Get a list of the post effects to be executed by this pipeline in order.

◆ GetStartTimeInMilliseconds()

virtual ON__UINT64 IRhRdkPostEffectPipeline::GetStartTimeInMilliseconds ( void  ) const
pure virtual

Get the start time of the rendering expressed in milliseconds since some unspecified epoch. Do not make assumptions about what the epoch is; it might be different on different platforms.

◆ IsRendering()

virtual bool IRhRdkPostEffectPipeline::IsRendering ( void  ) const
pure virtual
Returns
true if rendering is active, else false.

◆ New()

static IRhRdkPostEffectPipeline* IRhRdkPostEffectPipeline::New ( IRhRdkRenderWindow rw,
const UUID &  uuidShowingChannel,
int  creationFlags 
)
static

◆ RenderingId()

virtual UUID IRhRdkPostEffectPipeline::RenderingId ( void  ) const
pure virtual
Returns
a UUID that uniquely identifies the rendering being processed.

◆ ReportProgress()

virtual bool IRhRdkPostEffectPipeline::ReportProgress ( int  rowsCompleted)
pure virtual

Post effects should call this during execution to report progress. A good strategy is to call this once per pixel row (or several rows). If the function returns false, your post effect should exit its pixel loop as the user has requested that the operation be canceled.

Returns
true if the process should continue, else false.

◆ SetStartTimeInMilliseconds()

virtual void IRhRdkPostEffectPipeline::SetStartTimeInMilliseconds ( ON__UINT64  ms)
pure virtual

Set the start time of the rendering in milliseconds since some unspecified epoch.

◆ ThreadEngine()

virtual class IRhRdkPostEffectThreadEngine& IRhRdkPostEffectPipeline::ThreadEngine ( void  ) const
pure virtual

Provides access to a thread engine that allows post effects to run off of the main thread.

See also
IRhRdkPostEffectThreadEngine