Rhino C++ API  8.7
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
IRhRdkRenderWindow Class Referenceabstract

#include <IRhRdkRenderWindow.h>

Classes

class  IChannel
 
class  IChannelEx
 
class  IEventWatcher
 
class  IGPUChannel
 
class  IOpenGLChannel
 

Public Types

enum  FileResult : unsigned int {
  FileResult::Success, FileResult::OpenReadFail, FileResult::OpenWriteFail, FileResult::ReadFail,
  FileResult::WriteFail, FileResult::ReadException, FileResult::WriteException, FileResult::WrongRenderer
}
 
enum  RenderResult : unsigned int { RenderResult::Completed, RenderResult::Failed }
 

Public Member Functions

virtual ~IRhRdkRenderWindow ()
 
virtual bool AddChannel (const UUID &uuidChannel, UINT uPixelSize)=0
 
virtual bool AddWireframeChannel (CRhinoDoc &doc, const ON_3dmView &view, const ON_2iSize &size, const ON_4iRect &region)=0
 
virtual CRhRdkImageAdjust Adjust (void) const =0
 
virtual void ApplyUserInterfaceUpdates (bool)=0
 
virtual ON_wString ChannelDescription (const UUID &) const =0
 
virtual void ClearChannels (void)=0
 
void ClearEndTime (void)
 
virtual void ClearRendering (void)=0
 
virtual bool DeleteDib (void)=0
 
virtual RDK_DEPRECATED void EndAsyncRender (eRenderSuccessCode rsc)
 
virtual void EndAsyncRender (RenderResult res)=0
 
virtual bool EnsureDib (void)=0
 
virtual void * EVF (const wchar_t *, void *)=0
 
bool GetRenderChannels (OUT ON_SimpleArray< UUID > &aChan) const
 
virtual void Invalidate (void)=0
 
virtual void InvalidateArea (const ON_4iRect &rect)=0
 
virtual bool IsChannelAvailable (const UUID &uuidChannel) const =0
 
virtual bool IsChannelShown (const UUID &uuidChannel) const =0
 
virtual bool IsInPlace (void) const =0
 
virtual CRhinoDibLockDib (void) const =0
 
virtual IChannelNewClientChannel (const UUID &uuidChannel, bool bAllowMultipleAccess) const =0
 
bool OnClose (void) const
 
virtual void OnSynchronousRenderFinished (bool)=0
 
virtual void OnTimer (void)=0
 
virtual IChannelOpenChannel (const UUID &uuidChannel)=0
 
virtual class CRhRdkPostEffectPlugInManagerPEPManager (void) const =0
 
virtual bool PreAllocateChannel (const UUID &uuidChannel)=0
 
virtual FileResult ReadFrameBufferFile (const wchar_t *wszFilename, CRhRdkRenderingInfo &infoOut)=0
 
void RegisterEventWatcher (IEventWatcher &ew)
 
virtual IRhRdkRenderSessionRenderSession (void) const =0
 
virtual UUID RenderSessionId (void) const
 
virtual FileResult SaveRenderImageAs (const wchar_t *wszFilename, const UUID &uuidRenderEngine, bool bSaveAlpha) const =0
 
virtual class CRhRdkSdkRenderSdkRender (void) const =0
 
virtual bool SetAdjust (const class IRhRdkImageAdjust &)=0
 
virtual bool SetDib (const CRhinoDib &)=0
 
void SetIsRendering (bool b)
 
virtual void SetProgress (const ON_wString &sText, int iPercent)=0
 
virtual bool SetSize (const ON_2iSize &size)=0
 
virtual void SetUI (IRhRdkRenderUI *)=0
 
virtual void SetView (const ON_3dmView &view)=0
 
void SetWatermarkText (const wchar_t *wsz)
 
virtual bool ShowChannel (const UUID &uuidChannel)=0
 
virtual UUID ShowingChannel (void) const =0
 
virtual ON_2iSize Size (void) const =0
 
virtual IRhRdkRenderUI * UI (void) const =0
 
virtual void UnlockDib (void) const =0
 
void UnregisterEventWatcher (IEventWatcher &ew)
 
virtual void UseInPlaceView (const CRhinoDoc &doc, const ON_4iRect &rect, CRhinoView &view)=0
 
virtual ON_3dmView View (void) const =0
 
virtual FileResult WriteFrameBufferFile (const wchar_t *wszFilename) const =0
 

Static Public Member Functions

static IRhRdkRenderWindowNew (const CRhinoDoc &doc)
 
static IRhRdkRenderWindowNew (const CRhinoDoc &doc, const ON_3dmView &view)
 
static IRhRdkRenderWindowNew (void)
 
static bool PreAllocateChannel (IRhRdkRenderWindow &rw, const UUID &uuidChannel)
 

Static Public Attributes

static const UUID chanAlbedoBlue
 
static const UUID chanAlbedoGreen
 
static const UUID chanAlbedoRed
 
static const UUID chanAlbedoRGB
 
static const UUID chanAlpha
 
static const UUID chanBackgroundLuminanceBlue
 
static const UUID chanBackgroundLuminanceGreen
 
static const UUID chanBackgroundLuminanceRed
 
static const UUID chanBlue
 
static const UUID chanDistanceFromCamera
 
static const UUID chanGreen
 
static const UUID chanLuminanceBlue
 
static const UUID chanLuminanceGreen
 
static const UUID chanLuminanceRed
 
static const UUID chanMaterialIds
 
static const UUID chanNormalX
 
static const UUID chanNormalXYZ
 
static const UUID chanNormalY
 
static const UUID chanNormalZ
 
static const UUID chanObjectIds
 
static const UUID chanRed
 
static const UUID chanRGB
 
static const UUID chanRGBA
 
static const UUID chanWireframe
 
static const UUID chanWireframeAnnotationsRGBA
 
static const UUID chanWireframeCurvesRGBA
 
static const UUID chanWireframeIsocurvesRGBA
 
static const UUID chanWireframePointsRGBA
 
static const UUID chanWireframeRGBA
 

Detailed Description

This is the interface to the render window and frame buffer system used in the RDK render pipeline.

Note
This interface is implemented in RDK in a thread-safe manner so that you can call the methods from any thread your renderer happens to be running in.

To the client, this interface represents the window into which rendered pixels are written. It is associated with a render session and also usually with a render frame. The render session manages the render window object (including its smart frame buffer, frame buffer and channels), and in the case of asynchronous rendering, an async render context. The SdkRender stack object creates the session with a unique identifier. Anyone with the identifier can find the render session and therefore also the associated render window and optional async render context.

See also
CRhRdkRenderSession
CRhRdkSdkRenderImpl
IRhRdkAsyncRenderContext
IRhRdkRenderSession
IRhRdkRenderUI
RhRdkFindRenderSession
RhRdkFindRenderWindow

Member Enumeration Documentation

◆ FileResult

enum IRhRdkRenderWindow::FileResult : unsigned int
strong
Enumerator
Success 
OpenReadFail 
OpenWriteFail 
ReadFail 
WriteFail 
ReadException 
WriteException 
WrongRenderer 

◆ RenderResult

enum IRhRdkRenderWindow::RenderResult : unsigned int
strong
Enumerator
Completed 
Failed 

Constructor & Destructor Documentation

◆ ~IRhRdkRenderWindow()

virtual IRhRdkRenderWindow::~IRhRdkRenderWindow ( )
inlinevirtual

Member Function Documentation

◆ AddChannel()

virtual bool IRhRdkRenderWindow::AddChannel ( const UUID &  uuidChannel,
UINT  uPixelSize 
)
pure virtual

Add a channel to the frame buffer in addition to the fixed Red, Green, Blue and Alpha channels.

Parameters
uuidChannelis the channel identifier. This can be one of the standard RDK channel UUIDs (see below) or a custom-defined UUID. Standard RDK channels appear on the toolbar and menu. Custom ones do not, but are still available for use by software that knows how to use them (e.g., a custom post-effect plug-in).
uPixelSizeis the number of bytes required to store channel data for a single pixel. In the case of the standard RDK channels, this value must be sizeof(float) because these channels store a single float for each pixel. In the case of custom channels, this value can be anything you like since RDK does not understand or use it.
Note
You can use the compound channel identifiers chanNormalXYZ etc, to automatically add the individual underlying channels. In this case, the uPixelSize parameter is ignored.
Returns
true if the channel was added successfully, else false.

◆ AddWireframeChannel()

virtual bool IRhRdkRenderWindow::AddWireframeChannel ( CRhinoDoc doc,
const ON_3dmView view,
const ON_2iSize size,
const ON_4iRect region 
)
pure virtual

Use this utility method to automatically add wireframe channels to the rendered image. This method sets the frame buffer size and adds all the necessary wireframe channels automatically. It also creates the wireframe channel data automatically so that your renderer doesn't have to. You typically call this method only when your renderer does not support wireframe rendering itself. If you call this method, then you should not add any wireframe channels returned by GetRenderChannels(). If your renderer is capable of rendering the wireframe channels itself, you should not call this method. Instead, you must make sure you add the wireframe channels if GetRenderChannels() requests them.

See also
IRhRdkRenderWindow::GetRenderChannels(). After the wires are rendered, the wireframe post effects will composite them into the final rendered image.
Parameters
docis the document to display.
viewis the view to display.
sizeis the size of the image without clipping (i.e., if you have a region, it is the size of the image before you cut the region out.
regionis the area of the rendering you want to display. This is usually a rect which is from (0, 0) to the width and height in the 'size' parameter, but it's different during RenderWindow and RenderInWindow where it is the region selected by the user in the viewport. This should match the size of the render window itself (i.e., the size set using SetSize).
Returns
true if all of the wireframe channels were added successfully.
Note
This method should really be called AddWireframeChannels(). [SDK_UNFREEZE]

+------------------—+ | | | +----—+ | | | | <--— 'region' is the area being rendered. It's different to the full rendering area | | | | during RenderWindow and RenderInWindow | +----—+ | | | +------------------—+ <— 'size' is the size of the unclipped rendering

◆ Adjust()

virtual CRhRdkImageAdjust IRhRdkRenderWindow::Adjust ( void  ) const
pure virtual

OBSOLETE – not implemented

CRhRdkImageAdjust is no longer used and is not implemented. To access the settings that this used to provide, you will need access to the document being rendered.

  • For dithering settings, please use doc.Properties().RenderSettings().Dithering().
  • For gamma settings, please use doc.Properties().RenderSettings().LinearWorkflow().
  • For tone mapping settings, please use doc.Properties().RenderSettings().PostEffects().

◆ ApplyUserInterfaceUpdates()

virtual void IRhRdkRenderWindow::ApplyUserInterfaceUpdates ( bool  )
pure virtual

◆ ChannelDescription()

virtual ON_wString IRhRdkRenderWindow::ChannelDescription ( const UUID &  ) const
pure virtual

◆ ClearChannels()

virtual void IRhRdkRenderWindow::ClearChannels ( void  )
pure virtual

Remove all channels except Red, Green, Blue and Alpha. Prepares the system for calling AddChannel().

◆ ClearEndTime()

void IRhRdkRenderWindow::ClearEndTime ( void  )

Call this to clear the end time. Used when extending a rendering (e.g., in Cycles).

◆ ClearRendering()

virtual void IRhRdkRenderWindow::ClearRendering ( void  )
pure virtual

◆ DeleteDib()

virtual bool IRhRdkRenderWindow::DeleteDib ( void  )
pure virtual

◆ EndAsyncRender() [1/2]

virtual RDK_DEPRECATED void IRhRdkRenderWindow::EndAsyncRender ( eRenderSuccessCode  rsc)
virtual

This method is deprecated in favor of the one below.

◆ EndAsyncRender() [2/2]

virtual void IRhRdkRenderWindow::EndAsyncRender ( RenderResult  res)
pure virtual

This function must be called when an asynchronous render process has ended. Failing to do so will result in crashes when render window junk is cleared (either on EndCommand or exit of program).

Parameters
resis rsc_completed for a successful render or canceled render, or rsc_failed for a render with errors.

◆ EnsureDib()

virtual bool IRhRdkRenderWindow::EnsureDib ( void  )
pure virtual

◆ EVF()

virtual void* IRhRdkRenderWindow::EVF ( const wchar_t *  ,
void *   
)
pure virtual

Emergency virtual function for future expansion. Currently uses: "SetWatermarkText" - pvData is pointer to wide string. "ClearEndTime" "SetIsRendering" - pvData is pointer to bool.

◆ GetRenderChannels()

bool IRhRdkRenderWindow::GetRenderChannels ( OUT ON_SimpleArray< UUID > &  aChan) const

Renderers that support the feature uuidFeatureRenderChannels can call this to get the channels to render. The render settings has a user option for 'automatic' or 'custom'. When set to automatic, this returns the channels required by the current set of post effects. When set to custom, this returns the user's choice of channels.

Note
The returned channels are not added to the render window by this method. This just reports which channels the RDK recommends you add based on the user's settings and which post effects are in use.

◆ Invalidate()

virtual void IRhRdkRenderWindow::Invalidate ( void  )
pure virtual

Invalidate the entire view window so that the pixels get painted.

◆ InvalidateArea()

virtual void IRhRdkRenderWindow::InvalidateArea ( const ON_4iRect rect)
pure virtual

Invalidate an area of the view window so that the pixels get painted.

◆ IsChannelAvailable()

virtual bool IRhRdkRenderWindow::IsChannelAvailable ( const UUID &  uuidChannel) const
pure virtual

Query if a channel is available.

Returns
true if the channel is available, else false.

◆ IsChannelShown()

virtual bool IRhRdkRenderWindow::IsChannelShown ( const UUID &  uuidChannel) const
pure virtual

Query if a channel is being shown.

Returns
true if the channel is being shown, else false.

◆ IsInPlace()

virtual bool IRhRdkRenderWindow::IsInPlace ( void  ) const
pure virtual

◆ LockDib()

virtual CRhinoDib* IRhRdkRenderWindow::LockDib ( void  ) const
pure virtual

Lock the dib for exclusive access. You must call UnlockDib() later even if this returns null.

◆ New() [1/3]

static IRhRdkRenderWindow* IRhRdkRenderWindow::New ( const CRhinoDoc doc)
static

◆ New() [2/3]

static IRhRdkRenderWindow* IRhRdkRenderWindow::New ( const CRhinoDoc doc,
const ON_3dmView view 
)
static

◆ New() [3/3]

static IRhRdkRenderWindow* IRhRdkRenderWindow::New ( void  )
static

Each of these methods creates a render window which is not associated with an actual window or render session but is otherwise fully functional. You can use it to write to channels, create DIBs, run post effects, tone-mapping, gamma, etc.

Returns
a pointer to a standalone render window. The caller shall delete the returned object after use.
Note
If you want to do actual rendering using the render pipeline without a physical window on the screen, you should not use these methods. Instead, you should call RhRdkNewRenderSession().

◆ NewClientChannel()

virtual IChannel* IRhRdkRenderWindow::NewClientChannel ( const UUID &  uuidChannel,
bool  bAllowMultipleAccess 
) const
pure virtual

◆ OnClose()

bool IRhRdkRenderWindow::OnClose ( void  ) const

◆ OnSynchronousRenderFinished()

virtual void IRhRdkRenderWindow::OnSynchronousRenderFinished ( bool  )
pure virtual

◆ OnTimer()

virtual void IRhRdkRenderWindow::OnTimer ( void  )
pure virtual

◆ OpenChannel()

virtual IChannel* IRhRdkRenderWindow::OpenChannel ( const UUID &  uuidChannel)
pure virtual

Open a channel. If the channel is already open, the function will fail and return null. If successful, an IChannel interface will be returned and you must call Close() on this interface after use. The returned interface allows direct access to the underlying channel (or, in the case of chanRGB, chanRGBA, chanAlbedoRGB and NormalXYZ, collective channels). It is the responsibility of the caller to exercise caution when calling IChannel::GetValue() and IChannel::SetValue() since no range checking or other validation is performed by these methods.

Warning
Incorrect use of the IChannel interface may crash Rhino.
Parameters
uuidChannelis the channel identifier.
Note
IChannel* is returned but this can be cast to IChannelEx* if needed.
Returns
A pointer to the channel interface if the channel was opened successfully, else null.

◆ PEPManager()

virtual class CRhRdkPostEffectPlugInManager* IRhRdkRenderWindow::PEPManager ( void  ) const
pure virtual

◆ PreAllocateChannel() [1/2]

virtual bool IRhRdkRenderWindow::PreAllocateChannel ( const UUID &  uuidChannel)
pure virtual

Allocate all memory associated with a channel in advance. If your application will access channels on multiple threads during the rendering process, you are strongly advised to call this function first for each channel you will access on the main thread. Ensure that SetSize has been called on the IRhRdkRenderWindow object first.

Returns
true if successful or false if the channel cannot be opened.

◆ PreAllocateChannel() [2/2]

static bool IRhRdkRenderWindow::PreAllocateChannel ( IRhRdkRenderWindow rw,
const UUID &  uuidChannel 
)
static

Allocate all memory associated with a channel in advance. If your application will access channels on multiple threads during the rendering process, you are strongly advised to call this function first for each channel you will access on the main thread. Ensure that SetSize() has been called on the IRhRdkRenderWindow object first.

Returns
true if successful or false if the channel cannot be opened.

◆ ReadFrameBufferFile()

virtual FileResult IRhRdkRenderWindow::ReadFrameBufferFile ( const wchar_t *  wszFilename,
CRhRdkRenderingInfo &  infoOut 
)
pure virtual

◆ RegisterEventWatcher()

void IRhRdkRenderWindow::RegisterEventWatcher ( IEventWatcher ew)

Call this to register an event watcher. This enables the watcher to find out when data in the render window has changed. virtual

◆ RenderSession()

virtual IRhRdkRenderSession* IRhRdkRenderWindow::RenderSession ( void  ) const
pure virtual
Returns
The render session associated with this render window.

◆ RenderSessionId()

virtual UUID IRhRdkRenderWindow::RenderSessionId ( void  ) const
virtual
Returns
The render session id of the associated render session.

◆ SaveRenderImageAs()

virtual FileResult IRhRdkRenderWindow::SaveRenderImageAs ( const wchar_t *  wszFilename,
const UUID &  uuidRenderEngine,
bool  bSaveAlpha 
) const
pure virtual

◆ SdkRender()

virtual class CRhRdkSdkRender* IRhRdkRenderWindow::SdkRender ( void  ) const
pure virtual
Returns
The SDK Render stack object associated with this render window.
Note
For async renderers, this method may return null because the SDK Render object goes off the stack right after rendering begins. It is not safe to call this method from your async rendering thread because the object may go off the stack and get deleted after the thread gets a pointer to it.

◆ SetAdjust()

virtual bool IRhRdkRenderWindow::SetAdjust ( const class IRhRdkImageAdjust )
pure virtual

◆ SetDib()

virtual bool IRhRdkRenderWindow::SetDib ( const CRhinoDib )
pure virtual

◆ SetIsRendering()

void IRhRdkRenderWindow::SetIsRendering ( bool  b)

This function is here to support raytraced mode.

◆ SetProgress()

virtual void IRhRdkRenderWindow::SetProgress ( const ON_wString sText,
int  iPercent 
)
pure virtual

Set progress text and optional percentage.

Parameters
sTextis the text to display in the progress area.
iPercentis the amount of progress as a percentage. If this parameter is set to -1 it will be ignored.

◆ SetSize()

virtual bool IRhRdkRenderWindow::SetSize ( const ON_2iSize size)
pure virtual

Set the pixel size of the frame buffer.

Returns
true if successful, else false.

◆ SetUI()

virtual void IRhRdkRenderWindow::SetUI ( IRhRdkRenderUI *  )
pure virtual

◆ SetView()

virtual void IRhRdkRenderWindow::SetView ( const ON_3dmView view)
pure virtual

◆ SetWatermarkText()

void IRhRdkRenderWindow::SetWatermarkText ( const wchar_t *  wsz)

Call this to set a watermark string which will be displayed in the rendering as a post effect.

Parameters
wszis the string to set.

◆ ShowChannel()

virtual bool IRhRdkRenderWindow::ShowChannel ( const UUID &  uuidChannel)
pure virtual

Show a channel.

Parameters
uuidChannelis the identifier of the channel to show.
Returns
true if the channel was shown, else false.

◆ ShowingChannel()

virtual UUID IRhRdkRenderWindow::ShowingChannel ( void  ) const
pure virtual

Get the channel that is being shown.

◆ Size()

virtual ON_2iSize IRhRdkRenderWindow::Size ( void  ) const
pure virtual
Returns
The pixel size of the frame buffer.

◆ UI()

virtual IRhRdkRenderUI* IRhRdkRenderWindow::UI ( void  ) const
pure virtual

◆ UnlockDib()

virtual void IRhRdkRenderWindow::UnlockDib ( void  ) const
pure virtual

Unlock the dib. Must be called after any call to LockDib().

◆ UnregisterEventWatcher()

void IRhRdkRenderWindow::UnregisterEventWatcher ( IEventWatcher ew)

Call this to unregister an event watcher. virtual

◆ UseInPlaceView()

virtual void IRhRdkRenderWindow::UseInPlaceView ( const CRhinoDoc doc,
const ON_4iRect rect,
CRhinoView view 
)
pure virtual

◆ View()

virtual ON_3dmView IRhRdkRenderWindow::View ( void  ) const
pure virtual

◆ WriteFrameBufferFile()

virtual FileResult IRhRdkRenderWindow::WriteFrameBufferFile ( const wchar_t *  wszFilename) const
pure virtual

Member Data Documentation

◆ chanAlbedoBlue

const UUID IRhRdkRenderWindow::chanAlbedoBlue
static

◆ chanAlbedoGreen

const UUID IRhRdkRenderWindow::chanAlbedoGreen
static

◆ chanAlbedoRed

const UUID IRhRdkRenderWindow::chanAlbedoRed
static

◆ chanAlbedoRGB

const UUID IRhRdkRenderWindow::chanAlbedoRGB
static

◆ chanAlpha

const UUID IRhRdkRenderWindow::chanAlpha
static

◆ chanBackgroundLuminanceBlue

const UUID IRhRdkRenderWindow::chanBackgroundLuminanceBlue
static

◆ chanBackgroundLuminanceGreen

const UUID IRhRdkRenderWindow::chanBackgroundLuminanceGreen
static

◆ chanBackgroundLuminanceRed

const UUID IRhRdkRenderWindow::chanBackgroundLuminanceRed
static

◆ chanBlue

const UUID IRhRdkRenderWindow::chanBlue
static

◆ chanDistanceFromCamera

const UUID IRhRdkRenderWindow::chanDistanceFromCamera
static

◆ chanGreen

const UUID IRhRdkRenderWindow::chanGreen
static

◆ chanLuminanceBlue

const UUID IRhRdkRenderWindow::chanLuminanceBlue
static

◆ chanLuminanceGreen

const UUID IRhRdkRenderWindow::chanLuminanceGreen
static

◆ chanLuminanceRed

const UUID IRhRdkRenderWindow::chanLuminanceRed
static

◆ chanMaterialIds

const UUID IRhRdkRenderWindow::chanMaterialIds
static

◆ chanNormalX

const UUID IRhRdkRenderWindow::chanNormalX
static

◆ chanNormalXYZ

const UUID IRhRdkRenderWindow::chanNormalXYZ
static

◆ chanNormalY

const UUID IRhRdkRenderWindow::chanNormalY
static

◆ chanNormalZ

const UUID IRhRdkRenderWindow::chanNormalZ
static

◆ chanObjectIds

const UUID IRhRdkRenderWindow::chanObjectIds
static

◆ chanRed

const UUID IRhRdkRenderWindow::chanRed
static

◆ chanRGB

const UUID IRhRdkRenderWindow::chanRGB
static

◆ chanRGBA

const UUID IRhRdkRenderWindow::chanRGBA
static

◆ chanWireframe

const UUID IRhRdkRenderWindow::chanWireframe
static

◆ chanWireframeAnnotationsRGBA

const UUID IRhRdkRenderWindow::chanWireframeAnnotationsRGBA
static

◆ chanWireframeCurvesRGBA

const UUID IRhRdkRenderWindow::chanWireframeCurvesRGBA
static

◆ chanWireframeIsocurvesRGBA

const UUID IRhRdkRenderWindow::chanWireframeIsocurvesRGBA
static

◆ chanWireframePointsRGBA

const UUID IRhRdkRenderWindow::chanWireframePointsRGBA
static

◆ chanWireframeRGBA

const UUID IRhRdkRenderWindow::chanWireframeRGBA
static