RealtimeDisplayMode
ReferencesBase class for implementing real-time display modes in .NET. Pay special attention that in StartRenderer the RenderWindow.SetSize() function is called if the implementation relies on the RenderWindow to do the drawing to the viewport. If i.e. OpenGL is used to draw render results to the viewport then SetSize() doesn't have to be called, nor should the implementation then access channels on the RenderWindow, as those then don't exist. For OpenGL-based drawing the RenderWindow is used as a container for ViewInfo management, nothing else.
Constructors
RealtimeDisplayMode
#protected RealtimeDisplayMode()
Properties
Returns the LinearWorkflow data for this realtime display mode.
Methods
Override to communicate the progress of a capture.
Returns: A number between 0.0 and 1.0 inclusive. 1.0 means 100%.
Compute viewport CRC for the given ViewInfo
Parameters:
| view (ViewInfo) |
Returns: the CRC for the given view
public virtual void CreateWorld(RhinoDoc doc, ViewInfo viewInfo, DisplayPipelineAttributes displayPipelineAttributes)
Implement if you need to handle the initial CreateWorld call initiated by the display pipeline system. Note that this is not the same as the CreateWorld call in Rhino.Render.ChangeQueue.ChangeQueue, although related.
Parameters:
| doc (RhinoDoc) | Rhino document |
| viewInfo (ViewInfo) | active viewport info |
| displayPipelineAttributes (DisplayPipelineAttributes) | display pipeline attributes |
Retrieve RealtimeDisplayMode instance. If create is set to true then a new instance is created if not found, null is returned for false.
Retrieve RealtimeDisplayMode instance that the IntPtr refers to.
Parameters:
| realtimeViewport (nint) | IntPtr of the instance searched for. If the instance doesn't exist, a new one is created. |
Get the current render resolution for the running render session.
Get ViewInfo that has been registered with this RealtimeDisplayMode instance.
Override to allow maximum pass editing. By default disabled.
Returns: Return true to allow users to edit the maximum pass count.
Override to display status of the render engine.
Returns: Status text to display
Override to communicate the last completed pass. Can be shown in the HUD
Returns: Last completed pass
Override to communicate the maximum passes count currently in use for the render session. Can be shown in the HUD
Returns: Maximum passes
Override to return the name of your product. This will be printed in the HUD.
Returns: Name of the product.
Implement to support locking in the viewport
Returns: Return true if the render engine is locked.
Implement to support pausing and resuming in the viewport
Returns: Return true if the render engine is paused.
Override if you want to hide the HUD. Shown by default
Returns: Return false to hide the HUD.
Show control buttons on the realtime display HUD. By default these are shown, override this function and return false if HUD controls aren't needed.
Override to show status text in HUD. By default disabled.
Returns: Return true to show status text in HUD
Override to show maximum passes in HUD. By default disabled.
Returns: Return true to show maximum passes.
Override to show current pass in HUD. By default disabled.
Returns: Return true to show current pass in HUD.
Implement to tell if your render engine has completed a frame for drawing into the viewport
Implement to tell the render pipeline that a framebuffer is ready
Parameters:
| view (ViewInfo) |
Returns: Return true when a framebuffer is ready. This is generally the case when StartRenderer as returned successfully.
Override to tell the started state of your render engine.
Returns: true if render engine is ready and rendering
Implement to communicate last completed pass to the underlying system.
Returns: the last completed pass
Override to restart your render engine
public virtual void PostConstruct()
Override PostConstruct if you need to initialize where the underlying RealtimeDisplayMode is available. The connection is made right after RealtimeDisplayMode has been instantiated, but just before PostConstruct is called. For instance finding out OpenGL information can be done in PostConstruct.
Find and register classes that derive from RealtimeDisplayMode from the given plug-in. The plug-in is found in the given assembly
Find and register classes that derive from RealtimeDisplayMode from the given plug-in.
Parameters:
| plugin (PlugIn) |
public static void RemoveRealtimeViewport(nint realtimeViewport)
Remove RealtimeDisplayMode instance from internal dictionary.
Parameters:
| realtimeViewport (nint) | IntPtr to the RealtimeDisplayMode instance to remove. |
During run-time change whether to use OpenGL drawing of results or not. For instance offline rendering (viewcapture* with different resolution than viewport) could use RenderWindow instead of direct OpenGL drawing.
Parameters:
| use (bool) | Set to true if OpenGL drawing is wanted, set to false if RenderWindow method is needed. |
Set ViewInfo for this RealtimeDisplayMode instance.
Parameters:
| view (ViewInfo) | The ViewInfo to set for subsequent tests. |
Override if you want to i.e. hide the progress dialog for capture progress.
Returns: Return true to show, false to hide
public abstract void ShutdownRenderer()
Override to shutdown your render engine
public void SignalRedraw()
Use to signal the underlying pipeline a redraw is wanted. This can be used for instance when a renderer has completed a pass which should be updated in the associated viewport.
public abstract bool StartRenderer(int w, int h, RhinoDoc doc, ViewInfo view, ViewportInfo viewportInfo, bool forCapture, RenderWindow renderWindow)
Override to start your render engine. Note that before using the RenderWindow you *must* call SetSize to properly initialize the underlying DIB.
Parameters:
| w (int) | Width of resolution |
| h (int) | Height of resolution |
| doc (RhinoDoc) | Rhino document |
| view (ViewInfo) | active view |
| viewportInfo (ViewportInfo) | active viewport info |
| forCapture (bool) | true if renderer is started for capture purposes (ViewCaptureTo*), false for regular interactive rendering |
| renderWindow (RenderWindow) | RenderWindow to hold render results in. |
Returns: Return true when your render engine started correctly, false when that failed
Parameters:
| plugin (PlugIn) |
Events
obsoleteUse HUDLockButtonLeftClicked instead
Listen tot his event if you want to handle the lock button control
obsoleteUse HUDPauseButtonLeftClicked instead
Listen tot his event if you want to handle the pause button control
obsoleteUse HUDPlayButtonLeftClicked instead
Listen to this event if you want to handle the play button control.
obsoleteUse HUDProductNameLeftClicked instead
Listen tot his event if you want to handle a press on the product name component
obsoleteUse HUDStatusTextLeftClicked instead
Listen tot his event if you want to handle a press on the status text component
obsoleteUse HUDTimeLeftClicked instead
Listen tot his event if you want to handle a press press on the time component
obsoleteUse HUDUnlockButtonLeftClicked instead
Listen tot his event if you want to handle the unlock button control
Listen to this if you want to handle changes in maximum pass count through the HUD.
public event EventHandler<RealtimeDisplayMode.DisplayPipelineSettingsChangedEventArgs> OnDisplayPipelineSettingsChanged