Rhino C++ API  8.14
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
CRhRdkRenderPlugIn Class Referenceabstract

#include <RhRdkPlugIn.h>

Inheritance diagram for CRhRdkRenderPlugIn:
CRhRdkPlugIn CRhRdkObject

Classes

class  CRhRdkRenderOutputType
 
class  RENDER_ARCTIC_OPTIONS
 

Public Types

enum  PreviewRenderTypes : int { PreviewRenderTypes::None = 0, PreviewRenderTypes::ThreeSeparateImages = 1, PreviewRenderTypes::SingleImage = 2, PreviewRenderTypes::Progressive = 3 }
 
enum  QuickPreviewReason : unsigned int {
  QuickPreviewReason::ContentChanged = 0, QuickPreviewReason::ViewChanged = 1, QuickPreviewReason::RefreshDisplay = 2, QuickPreviewReason::UpdateBitmap = 3,
  QuickPreviewReason::Other = 99
}
 
- Public Types inherited from CRhRdkPlugIn
enum  ePlugInType { rdkPlugIn = 0, rdkRenderPlugIn = 1, force32bit_pit = 0xFFFFFFFF }
 

Public Member Functions

virtual ~CRhRdkRenderPlugIn ()
 
virtual void AbortRender (void)=0
 
virtual void AddCustomRenderSettingsSections (RhRdkUiModalities m, ON_SimpleArray< IRhinoUiSection * > &aSections) const
 
virtual void AddCustomSunSections (RhRdkUiModalities m, ON_SimpleArray< IRhinoUiSection * > &aSections) const
 
virtual bool AllowChooseContent (const CRhRdkContent &content) const
 
virtual RDK_DEPRECATED HBITMAP CreatePreview (const class CSize &sizeImage, const CRhRdkTexture &texture)
 
virtual RDK_DEPRECATED HBITMAP CreatePreview (const class CSize &sizeImage, eRhRdkRenderQuality quality, const IRhRdkPreviewSceneServer *pSceneServer)
 
virtual bool CreatePreview (const ON_2iSize &sizeImage, const CRhRdkTexture &texture, CRhinoDib &dibOut)
 
virtual bool CreatePreview (const ON_2iSize &sizeImage, RhRdkPreviewQuality qual, const IRhRdkPreviewSceneServer *pSceneServer, IRhRdkPreviewCallbacks *pNotify, CRhinoDib &dibOut)
 
virtual bool CreateQuickPreview (const ON_2iSize &size, const IRhRdkPreviewSceneServer &ss, QuickPreviewReason reason, CRhinoDib &dibOut)
 
virtual_su ON_wString CustomChannelName (const UUID &uuidChan) const
 
virtual const IRhRdkDecalSupportDecalSupport (void) const
 
virtual bool DisableAutoUpdatePreview (void) const
 
virtual bool DisplaysUniversalContent (void) const
 
virtual void * EVF (const wchar_t *wszFunc, void *pvData) override
 
const IRhRdkContentChoosingInfoGetContentChoosingInfo (UINT_PTR uReserved=0) const
 
virtual void GetCustomRenderSaveFileTypes (ON_ClassArray< CRhRdkFileType > &aFileType) const
 
virtual_su ON_UUID InitialChannelToDisplay (void) const
 
virtual bool Initialize (void) override
 
virtual_su bool IsTextureSupported (const CRhRdkTexture &texture) const
 
virtual void OutputTypes (ON_ClassArray< CRhRdkRenderOutputType > &outputTypes) const
 
virtual ePlugInType PlugInType (void) const override
 
virtual bool PreferBasicContent (void) const
 
virtual PreviewRenderTypes PreviewRenderType (void) const
 
virtual CRhinoCommand::result RenderArctic (const CRhinoCommandContext &rrc, const RENDER_ARCTIC_OPTIONS &) const
 
virtual void RenderSettingsSections (OUT ON_SimpleArray< UUID > &aSections) const
 
virtual_su void RenderWindowTabsToRemove (ON_SimpleArray< ON_UUID > &a) const
 
virtual bool SaveCustomRenderFile (const wchar_t *wszFilename, CRhRdkFileType &type, const UUID &uuidRenderSession, bool bSaveAlpha) const
 
virtual_su void SupportedChannels (OUT ON_SimpleArray< UUID > &aChan) const
 
virtual bool SupportsFeature (const UUID &uuidFeature) const
 
virtual void UiContentTypes (OUT ON_SimpleArray< UUID > &aTypes) const
 
- Public Member Functions inherited from CRhRdkPlugIn
virtual ~CRhRdkPlugIn ()
 
virtual RDK_DEPRECATED void AddCustomEditorActions (IRhRdkActions &, const IRhRdkContentEditor &) const
 
virtual RDK_DEPRECATED void AddCustomEditorMenu (IRhRdkMenu &, const IRhRdkContentEditor &) const
 
virtual RDK_DEPRECATED void AddCustomEditorToolButtons (IRhRdkToolbar &, const IRhRdkContentEditor &) const
 
virtual RDK_DEPRECATED bool AddCustomPlugIn (IRhRdkCustomPlugIn *pPlugIn) const
 
virtual_su void AddCustomUISections (IRhRdkExpandableContentUI &ui) const
 
virtual bool AddExtension (CRhRdkExtension *pExtension) const
 
virtual void ChangeContentInstanceId (IRhRdkPlugInUsedContentNotifier &ucn)
 
virtual RDK_DEPRECATED void EnableNonModalWindows (bool) const
 
virtual UUID GetLicenseCode (const UUID &uuidRequestCode) const
 
virtual CRhRdkVariant GetParameter (const wchar_t *wszName) const
 
virtual bool Icon (CRhinoDib &dibOut) const
 
virtual bool OnAssignMaterial (HWND hwndParent, ON_Material &material)
 
virtual bool OnEditMaterial (HWND hwndParent, ON_Material &material)
 
virtual bool OverrideSunViewportDisplay (void) const
 
virtual UUID PlugInId (void) const =0
 
virtual RDK_DEPRECATED void PlugInRdkVersion (int &iMajorVersion, int &iMinorVersion, int &iBetaRelease) const
 
virtual RDK_DEPRECATED void RegisterCompoundContentImplementors (IRhRdkCompoundContentImplementors &ccis) const
 
virtual RDK_DEPRECATED void RegisterContent (IRhRdkContentFactories &) const
 
virtual RDK_DEPRECATED void RegisterContentIOPlugIns (IRhRdkContentIOPlugIns &ciop) const
 
virtual RDK_DEPRECATED void RegisterCustomPlugIns (void) const
 
virtual RDK_DEPRECATED void RegisterCustomRenderMeshProviders (IRhRdkCustomRenderMeshManager &crmm) const
 
virtual void RegisterExtensions (void) const
 
virtual RDK_DEPRECATED void RegisterPostEffectPlugIns (IRhRdkPostEffectPlugInFactories &pepf) const
 
virtual_su bool RemoveExtension (CRhRdkExtension *pExtension) const
 
virtual void ReportUsedContent (IRhRdkPlugInUsedContentNotifier &ucn)
 
virtual CRhinoPlugInRhinoPlugIn (void) const =0
 
virtual bool SetParameter (const wchar_t *wszName, const CRhRdkVariant &vValue)
 
virtual bool SupportsCustomPlugIn (const UUID &uuidInterfaceId) const
 
virtual void Uninitialize (void)
 
virtual RDK_DEPRECATED void UpdateCustomEditorActions (IRhRdkActions &, const IRhRdkContentEditor &) const
 
- Public Member Functions inherited from CRhRdkObject
 CRhRdkObject ()
 
virtual ~CRhRdkObject ()
 
void operator delete (void *buf)
 
void operator delete[] (void *buf)
 
void * operator new (size_t size)
 
void * operator new[] (size_t size)
 

Protected Member Functions

 CRhRdkRenderPlugIn ()
 
virtual void CreateDefaultContent (CRhinoDoc *pDoc=RhinoApp().ObsoleteActiveDoc()) const
 
virtual void EnsureDefaultContent (CRhinoDoc *pDoc=RhinoApp().ObsoleteActiveDoc()) const override
 
- Protected Member Functions inherited from CRhRdkPlugIn
 CRhRdkPlugIn ()
 

Additional Inherited Members

- Static Public Member Functions inherited from CRhRdkPlugIn
static UINT QueryFocusMessageNumber (void)
 
- Static Public Member Functions inherited from CRhRdkObject
static void CheckMemory (void)
 
static void PopulateDebuggingInfo (void)
 

Detailed Description

Use this base class if your RDK plug-in is a Rhino render plug-in. This is the main connection between your renderer and RDK. You must create a subclass and implement the pure virtual functions so that RDK can communicate with your renderer.

Member Enumeration Documentation

◆ PreviewRenderTypes

Preview renderer type.

See also
documentation for PreviewRenderType() below.
Enumerator
None 
ThreeSeparateImages 
SingleImage 
Progressive 

◆ QuickPreviewReason

enum CRhRdkRenderPlugIn::QuickPreviewReason : unsigned int
strong

Used by CreateQuickPreview to specify the reason for the call.

Enumerator
ContentChanged 
ViewChanged 
RefreshDisplay 
UpdateBitmap 
Other 

Constructor & Destructor Documentation

◆ ~CRhRdkRenderPlugIn()

virtual CRhRdkRenderPlugIn::~CRhRdkRenderPlugIn ( )
virtual

◆ CRhRdkRenderPlugIn()

CRhRdkRenderPlugIn::CRhRdkRenderPlugIn ( )
protected

Member Function Documentation

◆ AbortRender()

virtual void CRhRdkRenderPlugIn::AbortRender ( void  )
pure virtual

You must implement this function to abort rendering (if possible).

◆ AddCustomRenderSettingsSections()

virtual void CRhRdkRenderPlugIn::AddCustomRenderSettingsSections ( RhRdkUiModalities  m,
ON_SimpleArray< IRhinoUiSection * > &  aSections 
) const
virtual

You can optionally override this method to add custom sections to the Render Settings dialog. You should add new instances of your sections to the array as follows:

AFX_MANAGE_STATE(AfxGetStaticModuleState());
aSections.Append(new CMySection(m));
Note
The Render Settings dialog can be shown in a modeless or modal context.
Parameters
mis the modality of the Render Settings dialog. See note above.
aSectionsis the array to append your custom dialogs to.
Note
You must call the base class after adding your sections.

◆ AddCustomSunSections()

virtual void CRhRdkRenderPlugIn::AddCustomSunSections ( RhRdkUiModalities  m,
ON_SimpleArray< IRhinoUiSection * > &  aSections 
) const
virtual

You can optionally override this method to add custom sections to the Sun dialog. You should add new instances of your sections to the array as follows:

AFX_MANAGE_STATE(AfxGetStaticModuleState());
aSections.Append(new CMySection(m));
Note
The Sun dialog can be shown in a modeless, semi-modal or modal context.
Parameters
mis the modality of the Sun dialog. See note above.
aSectionsis the array to append your custom dialogs to.
Note
You must call the base class after adding your sections.

◆ AllowChooseContent()

virtual bool CRhRdkRenderPlugIn::AllowChooseContent ( const CRhRdkContent content) const
virtual

Override this function and return false if you don't want to allow a certain content type to be picked from the content browser by the user during, for example, 'Create New...', etc. while your render engine is current.

Returns
true to allow picking, else false.

◆ CreateDefaultContent()

virtual void CRhRdkRenderPlugIn::CreateDefaultContent ( CRhinoDoc pDoc = RhinoApp().ObsoleteActiveDoc()) const
protectedvirtual

You can optionally override this method to create extra default content for your renderer in addition to any content in the default content folder. If you override this method, please be sure to call the base class.

◆ CreatePreview() [1/4]

virtual RDK_DEPRECATED HBITMAP CRhRdkRenderPlugIn::CreatePreview ( const class CSize &  sizeImage,
const CRhRdkTexture texture 
)
virtual

This method is deprecated in favor of the one below.

◆ CreatePreview() [2/4]

virtual RDK_DEPRECATED HBITMAP CRhRdkRenderPlugIn::CreatePreview ( const class CSize &  sizeImage,
eRhRdkRenderQuality  quality,
const IRhRdkPreviewSceneServer pSceneServer 
)
virtual

This method is deprecated in favor of the one below.

◆ CreatePreview() [3/4]

virtual bool CRhRdkRenderPlugIn::CreatePreview ( const ON_2iSize sizeImage,
const CRhRdkTexture texture,
CRhinoDib dibOut 
)
virtual

Implement this method to create the preview bitmap that will appear in the content editor's thumbnail display when previewing textures.

Parameters
dibOutaccepts the new bitmap if the function returns true.
Returns
true if successful, else false.

◆ CreatePreview() [4/4]

virtual bool CRhRdkRenderPlugIn::CreatePreview ( const ON_2iSize sizeImage,
RhRdkPreviewQuality  qual,
const IRhRdkPreviewSceneServer pSceneServer,
IRhRdkPreviewCallbacks pNotify,
CRhinoDib dibOut 
)
virtual

Implement this method to create the preview image that will appear in the content editor's thumbnail display when previewing materials and environments.

Note
This preview is the 'renderer preview' and is called 3 times with varying levels of quality. If you don't want to implement this kind of preview, and are satisfied with the 'quick preview' generated by CreateQuickPreview(), just return false. If you don't support progressive refinement, return false from the first two quality levels.
Parameters
pNotifypoints to an interface for updating the preview midway through a progressive rendering. The implementer gets to decide how many intermediate images to deliver. The final image should still be returned when the function returns. This parameter is only valid when PreviewRenderType() returns 'Progressive'. Otherwise it will be null.
sizeImageis the size of the image to create, in pixels.
qualis the required preview quality.
Note
The 'Quick' option is not supported by this method.
Parameters
pSceneServeris a pointer to an object describing the scene to show in the preview. Note that this pointer might be null in exceptional circumstances and you must check for null before using it.
dibOutaccepts the preview image if the function returns true.
Returns
true if successful, else false.

◆ CreateQuickPreview()

virtual bool CRhRdkRenderPlugIn::CreateQuickPreview ( const ON_2iSize size,
const IRhRdkPreviewSceneServer ss,
QuickPreviewReason  reason,
CRhinoDib dibOut 
)
virtual

Optionally implement this method to change the way quick content previews are generated. By default, this is handled by the internal RDK OpenGL renderer and is based on the simulation of the content. If you want to implement an instant render based on the actual content parameters, or if you just think you can do a better job, override this method.

Parameters
sizeis the size of the required preview, in pixels.
ssis the scene server that defines the preview scene.
reasonis the reason for the call.
See also
QuickPreviewReason
Parameters
dibOutaccepts the preview imagery if the method returns true.
Returns
true if successful, else false.

◆ CustomChannelName()

virtual_su ON_wString CRhRdkRenderPlugIn::CustomChannelName ( const UUID &  uuidChan) const

Helper function. Calls EVF(L"CustomChannelName"). Override EVF() to implement this. Return the localized name of your custom channel.

◆ DecalSupport()

virtual const IRhRdkDecalSupport* CRhRdkRenderPlugIn::DecalSupport ( void  ) const
virtual

You can optionally override this method to return a pointer to an implementation of IRhRdkDecalSupport. The default returns nullptr (not implemented).

◆ DisableAutoUpdatePreview()

virtual bool CRhRdkRenderPlugIn::DisableAutoUpdatePreview ( void  ) const
virtual

Override this method and return true to prevent RDK from automatically updating thumbnail previews.

◆ DisplaysUniversalContent()

virtual bool CRhRdkRenderPlugIn::DisplaysUniversalContent ( void  ) const
virtual
Returns
true if this render plug-in displays 'universal' content, else false.

◆ EnsureDefaultContent()

virtual void CRhRdkRenderPlugIn::EnsureDefaultContent ( CRhinoDoc pDoc = RhinoApp().ObsoleteActiveDoc()) const
overrideprotectedvirtual

Reimplemented from CRhRdkPlugIn.

◆ EVF()

virtual void* CRhRdkRenderPlugIn::EVF ( const wchar_t *  wszFunc,
void *  pvData 
)
overridevirtual

Emergency virtual function for future expansion.

Reimplemented from CRhRdkPlugIn.

◆ GetContentChoosingInfo()

const IRhRdkContentChoosingInfo* CRhRdkRenderPlugIn::GetContentChoosingInfo ( UINT_PTR  uReserved = 0) const

Get extra information about content choosing. Can be called from AllowChooseContent() to determine, for example, if content is being chosen as top-level or as a child.

Returns
a pointer to IRhRdkContentChoosingInfo if successful or nullptr if content choosing info is not available. Currently, content choosing info is only available during execution of AllowChooseContent().

◆ GetCustomRenderSaveFileTypes()

virtual void CRhRdkRenderPlugIn::GetCustomRenderSaveFileTypes ( ON_ClassArray< CRhRdkFileType > &  aFileType) const
virtual

You can optionally override this method to add custom 'render save' file types to an array. These file types are used by the render window when the user chooses Save As. They will then be provided as additional file types after the default types such as BMP and JPEG.

Parameters
aFileTypeis the array to which you should add your custom file types.
See also
SaveCustomRenderFile()

◆ InitialChannelToDisplay()

virtual_su ON_UUID CRhRdkRenderPlugIn::InitialChannelToDisplay ( void  ) const

Helper function. Calls EVF(L"InitialChannelToDisplay"). Override EVF() to implement this. Return the initial channel to display in the render window. By default, IRhRdkRenderWíndow::chanRGBA. (pvData = UUID*)

◆ Initialize()

virtual bool CRhRdkRenderPlugIn::Initialize ( void  )
overridevirtual

Initializes the plug-in. Override this method to perform additional initialization. please be sure to call the base class.

Returns
true if the plug-in initialized correctly, false if not - this will usually happen if the RDK the plug-in was built against is older than the RDK that is running and there have been breaking SDK changes in between.

Reimplemented from CRhRdkPlugIn.

◆ IsTextureSupported()

virtual_su bool CRhRdkRenderPlugIn::IsTextureSupported ( const CRhRdkTexture texture) const

Helper function. Calls EVF(L"IsTextureSupported"). Override EVF() to implement this. Returns true if this renderer can render the texture natively without needing it to be baked into a bitmap, false otherwise. By default, returns false for all textures.

◆ OutputTypes()

virtual void CRhRdkRenderPlugIn::OutputTypes ( ON_ClassArray< CRhRdkRenderOutputType > &  outputTypes) const
virtual

Implement this function to return a list of output types which your renderer can write. The default implementation returns the list supported by CRhinoDib - bmp, jpg, png, tif, tga.

See also
CRhRdkRenderOutputType

◆ PlugInType()

virtual ePlugInType CRhRdkRenderPlugIn::PlugInType ( void  ) const
inlineoverridevirtual
Returns
plug-in type.

Reimplemented from CRhRdkPlugIn.

◆ PreferBasicContent()

virtual bool CRhRdkRenderPlugIn::PreferBasicContent ( void  ) const
virtual
Returns
true if you would like RDK to quickly create a basic content in response to 'Create New' commands. Return false if you would prefer RDK to display the content chooser dialog.

◆ PreviewRenderType()

virtual PreviewRenderTypes CRhRdkRenderPlugIn::PreviewRenderType ( void  ) const
virtual

Override this method to specify a different type of preview rendering. The default is ThreeSeparateImages, and this will work for most cases, including no preview support if you follow the comments for CreatePreview() below. This function is really meant to give a hint to the framework, and may be used to facilitate different preview systems later on. If you don't know what to return here, just don't override the method.

◆ RenderArctic()

virtual CRhinoCommand::result CRhRdkRenderPlugIn::RenderArctic ( const CRhinoCommandContext rrc,
const RENDER_ARCTIC_OPTIONS  
) const
virtual

Override this function to implement a custom version of RenderArctic for your engine.

Returns
a valid command result. Default implementation forces render settings to all-white and calls RunScript(L"_Render");

◆ RenderSettingsSections()

virtual void CRhRdkRenderPlugIn::RenderSettingsSections ( OUT ON_SimpleArray< UUID > &  aSections) const
virtual

Override this method to provide the UUIDs of all sections that should be displayed in the Render Settings tab when this is the current renderer. The default implementation adds all the RDK's built-in Render Settings sections. These UUIDs start with the prefix 'uuidRenderSettingsSection'. They can be found in RhRdkUuids.h

Parameters
aSectionsaccepts the UUIDs of the desired render settings sections.
Note
uuidRenderSettingsSection_CurrentRenderer is added by the RDK and cannot be removed.

◆ RenderWindowTabsToRemove()

virtual_su void CRhRdkRenderPlugIn::RenderWindowTabsToRemove ( ON_SimpleArray< ON_UUID > &  a) const

Implement this method to specify other tabs that you would like to remove from view. You can remove any of the three built-in post effect tabs. If you don't want to remove any tabs, just implement this method as a no-op stub. If you want to remove all other built-in tabs, add ON_nil_uuid to the array.

See also
uuidTabPostEffect_Early, uuidTabPostEffect_ToneMapping, uuidTabPostEffect_Late

◆ SaveCustomRenderFile()

virtual bool CRhRdkRenderPlugIn::SaveCustomRenderFile ( const wchar_t *  wszFilename,
CRhRdkFileType type,
const UUID &  uuidRenderSession,
bool  bSaveAlpha 
) const
virtual

You can optionally override this method to save your custom 'render save' file types. This method is called when the user does Save As from a render window and chooses one of the custom file types that was added by GetCustomRenderSaveFileTypes().

Parameters
wszFilenameis the full path to the file to save to.
typeis the file type of the file being saved.
uuidRenderSessionis the render session id of the render window.
bSaveAlphais true if the 'Save alpha channel' check box is checked on the save file dialog.
See also
GetCustomRenderSaveFileTypes()

◆ SupportedChannels()

virtual_su void CRhRdkRenderPlugIn::SupportedChannels ( OUT ON_SimpleArray< UUID > &  aChan) const

Helper function. Calls EVF(L"SupportedChannels"). Override EVF() to implement this. Return a list of channels your renderer supports. Custom channels are allowed.

◆ SupportsFeature()

virtual bool CRhRdkRenderPlugIn::SupportsFeature ( const UUID &  uuidFeature) const
virtual
Returns
true if you support this feature as part of RDK.
See also
The uuidFeature... definitions in RhRdkUuids.h

◆ UiContentTypes()

virtual void CRhRdkRenderPlugIn::UiContentTypes ( OUT ON_SimpleArray< UUID > &  aTypes) const
virtual

Override this method to provide the UUIDs of all content types that should be presented to the user in the types combo box or the [+] button types menu when this is the current renderer. The default implementation adds only RDK's built-in types. RDK automatically adds types in the most efficient way to minimize list length. If you override this method, you may call the base class first to add the built-in types, then add a separator followed by your own types. Or you may omit the base class call and add only chosen types yourself, followed by a separator and your own types. A 'More Types...' item is automatically added when needed by the RDK. Specify a separator by adding uuidUiContentType_Separator.

Note
You should add all types you would want to appear in any context, regardless of their content kind. The RDK ensures that only types that make sense will actually be presented to the user in a given context.
Parameters
aTypesaccepts the types (optionally including uuidUiContentType_Separator).
See also
CRhRdkContentFactory::IsElevated