Rhino C++ API  8.13
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
RhRdk::Realtime::DisplayMode Class Referenceabstract

#include <RhRdk_RDP_DisplayPipeline.h>

Inheritance diagram for RhRdk::Realtime::DisplayMode:
CRhinoMouseCallback RhRdk::Realtime::ISignalUpdate

Classes

class  Factories
 
class  Factory
 
struct  FRAME_BUFFER_INFO_INPUTS
 
struct  FRAME_BUFFER_INFO_OUTPUTS
 
class  IHUDCallbacks
 
class  IHUDCallbacks3
 
class  IHUDFunctionality
 

Public Types

enum  StatusBarComponent : int {
  StatusBarComponent::All, StatusBarComponent::Play, StatusBarComponent::Pause, StatusBarComponent::Stop,
  StatusBarComponent::Lock, StatusBarComponent::Unlock, StatusBarComponent::ProductName, StatusBarComponent::StatusText,
  StatusBarComponent::Time, StatusBarComponent::PassAmount, StatusBarComponent::PostEffectsOn, StatusBarComponent::PostEffectsOff
}
 
- Public Types inherited from CRhinoMouseCallback
enum  mouse_button {
  no_mouse_button = 0, left_mouse_button = 1, right_mouse_button = 2, middle_mouse_button = 3,
  x_mouse_button = 4
}
 

Public Member Functions

 DisplayMode (const CRhinoDisplayPipeline &pipeline)
 
virtual ~DisplayMode ()
 
virtual const UUID & ClassId (void) const =0
 
virtual std::shared_ptr< DisplayModeClone (const CRhinoDisplayPipeline &pipeline) const
 
virtual void CreateWorld (const CRhinoDoc &doc, const ON_3dmView &view, const CDisplayPipelineAttributes &attributes)=0
 
virtual bool DrawOrLockRendererFrameBuffer (const FRAME_BUFFER_INFO_INPUTS &input, FRAME_BUFFER_INFO_OUTPUTS &outputs)=0
 
void DrawShadedMesh (const CRhinoDisplayPipeline &pipeline, const ON_Mesh &mesh, const CDisplayPipelineMaterial *pMat)
 
virtual void * EVF (const wchar_t *, void *) override
 
virtual bool ExecConduit (CRhinoDisplayPipeline &pipeline, UINT channel, bool &terminate)
 
virtual const IHUDCallbacksHUDCallbacks () const
 
virtual bool IsCompleted (void) const =0
 
virtual bool IsFrameBufferAvailable (const ON_3dmView &vp) const =0
 
virtual bool IsRendererStarted (void) const =0
 
virtual int LastRenderedPass (void) const =0
 
virtual void OnDisplayPipelineSettingsChanged (const CDisplayPipelineAttributes &)
 
virtual void OnMaxPassesChanged (int)
 
void OnMouseLeave ()
 
virtual bool OnRenderSizeChanged (const ON_2iSize &newFrameSize)=0
 
virtual void OnStatusBarComponentPressed (StatusBarComponent)
 
const DisplayModeParent (void) const
 
unsigned int PipelineRuntimeSerialNumber (void) const
 
virtual double Progress (void) const =0
 
virtual void PushDynamicMeshes (void)
 
virtual bool RendererIsAvailable (void) const =0
 
ON_2iSize RenderSize (void) const
 
virtual_su IRhRdkRenderWindowRenderWindow (void)
 
virtual bool ShowCaptureProgress (void) const =0
 
virtual void ShutdownRenderer ()=0
 
virtual void SignalUpdate (void) override
 
virtual bool StartRenderer (const ON_2iSize &frameSize, const CRhinoDoc &doc, const ON_3dmView &view, const ON_Viewport &vp, const DisplayMode *pParent)=0
 
virtual void UnlockRendererFrameBuffer ()=0
 
virtual void UpdateDynamicMesh (const ON_Mesh &, const ON_Material &)
 
virtual bool UseFastDraw ()=0
 
unsigned int ViewRuntimeSerialNumber (void) const
 
- Public Member Functions inherited from CRhinoMouseCallback
 CRhinoMouseCallback ()=default
 
virtual ~CRhinoMouseCallback ()
 
void Enable (bool enabled)
 
bool IsEnabled () const
 Returns TRUE if the mouse callback is enabled. More...
 
virtual void OnBeginMouseMove (unsigned int viewSerialNumber, UINT flags, const ON_2iPoint &point, bool &executeDefaultHandler)
 Called at the beginning of CRhinoView processing a mouse move event. More...
 
- Public Member Functions inherited from RhRdk::Realtime::ISignalUpdate
virtual ~ISignalUpdate ()
 

Static Public Member Functions

static ON__UINT32 ComputeViewportCRC (const ON_Viewport &vp)
 
static bool DrawOrLockRendererFrameBufferImpl (const DisplayMode &dm, IRhRdkRenderWindow &rw, const FRAME_BUFFER_INFO_INPUTS &input, FRAME_BUFFER_INFO_OUTPUTS &outputs)
 
static std::shared_ptr< DisplayModeFromPipeline (const CRhinoDisplayPipeline &pipe)
 
static void UnlockRendererFrameBufferImpl (const DisplayMode &dm, IRhRdkRenderWindow &rw)
 

Protected Member Functions

virtual void InternalShutdown (void)
 
virtual bool InternalStartRenderer (const CRhinoDisplayPipeline &pipe)
 
virtual void OnBeginMouseDown (unsigned int viewSerialNumber, mouse_button button, UINT flags, const ON_2iPoint &point, bool &defaultHandlerExecuted) override
 Called at the beginning of CRhinoView processing a mouse down event. More...
 
virtual void OnBeginMouseUp (unsigned int viewSerialNumber, mouse_button button, UINT flags, const ON_2iPoint &point, bool &executeDefaultHandler) override
 Called at the beginning of CRhinoView processing a mouse up event. More...
 
virtual void OnInitFrameBuffer (CRhinoDisplayPipeline &pipeline)
 
virtual BOOL32 OnMouseDblClk (CRhinoView &view, CRhinoMouseCallback::mouse_button, UINT flags, const ON_2iPoint &pt) override
 
virtual void OnMouseDown (unsigned int viewSerialNumber, mouse_button button, UINT flags, const ON_2iPoint &point, bool defaultHandlerExecuted) override
 Called at the end of CRhinoView processing a mouse down event. More...
 
virtual void OnMouseMove (unsigned int viewSerialNumber, UINT flags, const ON_2iPoint &point, bool defaultHandlerExecuted) override
 Called at the end of CRhinoView processing a mouse move event. More...
 
virtual void OnMouseUp (unsigned int viewSerialNumber, mouse_button button, UINT flags, const ON_2iPoint &point, bool defaultHandlerExecuted) override
 Called at the end of CRhinoView processing a mouse up event. More...
 
virtual void OnPostDrawObjects (CRhinoDisplayPipeline &pipeline)
 
virtual void OnPreDrawObjects (CRhinoDisplayPipeline &pipeline)
 
virtual bool PrepareRenderer (const CRhinoDisplayPipeline &pipe)
 
virtual bool SetupSceneServer (const CRhinoDisplayPipeline &pipe)
 

Friends

class Impl
 

Additional Inherited Members

- Protected Attributes inherited from CRhinoMouseCallback
class CRhMouseCallbackManager * m_cbm = nullptr
 

Detailed Description

RhRdk::Realtime::DisplayMode provides a way to integrate a new rendering method in the Rhino viewport.

See also
https://github.com/mcneel/rhino-developer-samples/tree/6/cpp/SampleRealtimeRenderer

Member Enumeration Documentation

◆ StatusBarComponent

Enumerator
All 
Play 
Pause 
Stop 
Lock 
Unlock 
ProductName 
StatusText 
Time 
PassAmount 
PostEffectsOn 
PostEffectsOff 

Constructor & Destructor Documentation

◆ DisplayMode()

RhRdk::Realtime::DisplayMode::DisplayMode ( const CRhinoDisplayPipeline pipeline)

Constructor.

◆ ~DisplayMode()

virtual RhRdk::Realtime::DisplayMode::~DisplayMode ( )
virtual

Virtual deconstructor.

Member Function Documentation

◆ ClassId()

virtual const UUID& RhRdk::Realtime::DisplayMode::ClassId ( void  ) const
pure virtual

You must override this with a generated UUID - and the one in your factory must match it.

◆ Clone()

virtual std::shared_ptr<DisplayMode> RhRdk::Realtime::DisplayMode::Clone ( const CRhinoDisplayPipeline pipeline) const
virtual

Default behaviour is to return nullptr if the view dimensions are the same, or construct a new one if not. Relies on "RenderSize" to determine if something has changed.

◆ ComputeViewportCRC()

static ON__UINT32 RhRdk::Realtime::DisplayMode::ComputeViewportCRC ( const ON_Viewport vp)
static

Calculate the CRC of ON_Viewport. Does not include properties that have no effect on the views appearance like the viewport ID .

◆ CreateWorld()

virtual void RhRdk::Realtime::DisplayMode::CreateWorld ( const CRhinoDoc doc,
const ON_3dmView view,
const CDisplayPipelineAttributes attributes 
)
pure virtual

Create the world for this display mode instance. This sets up the changequeue.

◆ DrawOrLockRendererFrameBuffer()

virtual bool RhRdk::Realtime::DisplayMode::DrawOrLockRendererFrameBuffer ( const FRAME_BUFFER_INFO_INPUTS input,
FRAME_BUFFER_INFO_OUTPUTS outputs 
)
pure virtual

Return true if you have drawn the frame into the current OpenGL view, or you have supplied one of the other methods for drawing in outputs. Return false if the frame was not available, and the framework should wait. If you're using IRhRdkRenderWindow as your framebuffer (which is recommended), you can implement DrawOrLockRendererFrameBuffer simply by calling DrawOrLockRendererFrameBufferImpl.

◆ DrawOrLockRendererFrameBufferImpl()

static bool RhRdk::Realtime::DisplayMode::DrawOrLockRendererFrameBufferImpl ( const DisplayMode dm,
IRhRdkRenderWindow rw,
const FRAME_BUFFER_INFO_INPUTS input,
FRAME_BUFFER_INFO_OUTPUTS outputs 
)
static

See comment for DrawOrLockRendererFrameBuffer.

◆ DrawShadedMesh()

void RhRdk::Realtime::DisplayMode::DrawShadedMesh ( const CRhinoDisplayPipeline pipeline,
const ON_Mesh mesh,
const CDisplayPipelineMaterial pMat 
)

◆ EVF()

virtual void* RhRdk::Realtime::DisplayMode::EVF ( const wchar_t *  ,
void *   
)
overridevirtual

◆ ExecConduit()

virtual bool RhRdk::Realtime::DisplayMode::ExecConduit ( CRhinoDisplayPipeline pipeline,
UINT  channel,
bool &  terminate 
)
virtual

◆ FromPipeline()

static std::shared_ptr<DisplayMode> RhRdk::Realtime::DisplayMode::FromPipeline ( const CRhinoDisplayPipeline pipe)
static

Returns the display mode associated with a particular display pipline.

◆ HUDCallbacks()

virtual const IHUDCallbacks* RhRdk::Realtime::DisplayMode::HUDCallbacks ( ) const
virtual

Default implementation stops built in HUD from being displayed. Implementation may optionally return IHUDFunctionality or IHUDCallbacks3 - dynamic cast to access that functionality.

◆ InternalShutdown()

virtual void RhRdk::Realtime::DisplayMode::InternalShutdown ( void  )
protectedvirtual

◆ InternalStartRenderer()

virtual bool RhRdk::Realtime::DisplayMode::InternalStartRenderer ( const CRhinoDisplayPipeline pipe)
protectedvirtual

◆ IsCompleted()

virtual bool RhRdk::Realtime::DisplayMode::IsCompleted ( void  ) const
pure virtual

Return true if the renderer is done.

◆ IsFrameBufferAvailable()

virtual bool RhRdk::Realtime::DisplayMode::IsFrameBufferAvailable ( const ON_3dmView vp) const
pure virtual

Called during the frame draw to decide whether there is relevant data when "LockRendererFrameBuffer" is called. Return false if the image is still being rendered.

◆ IsRendererStarted()

virtual bool RhRdk::Realtime::DisplayMode::IsRendererStarted ( void  ) const
pure virtual

We have started the renderer and set it up successfully.

◆ LastRenderedPass()

virtual int RhRdk::Realtime::DisplayMode::LastRenderedPass ( void  ) const
pure virtual

Used to pass information about which pass to render to for cloned (view capture) renderers.

◆ OnBeginMouseDown()

virtual void RhRdk::Realtime::DisplayMode::OnBeginMouseDown ( unsigned int  viewSerialNumber,
mouse_button  button,
UINT  flags,
const ON_2iPoint point,
bool &  executeDefaultHandler 
)
overrideprotectedvirtual

Called at the beginning of CRhinoView processing a mouse down event.

Reimplemented from CRhinoMouseCallback.

◆ OnBeginMouseUp()

virtual void RhRdk::Realtime::DisplayMode::OnBeginMouseUp ( unsigned int  viewSerialNumber,
mouse_button  button,
UINT  flags,
const ON_2iPoint point,
bool &  executeDefaultHandler 
)
overrideprotectedvirtual

Called at the beginning of CRhinoView processing a mouse up event.

Reimplemented from CRhinoMouseCallback.

◆ OnDisplayPipelineSettingsChanged()

virtual void RhRdk::Realtime::DisplayMode::OnDisplayPipelineSettingsChanged ( const CDisplayPipelineAttributes )
virtual

triggered when display pipeline attributes have changed.

◆ OnInitFrameBuffer()

virtual void RhRdk::Realtime::DisplayMode::OnInitFrameBuffer ( CRhinoDisplayPipeline pipeline)
protectedvirtual

Triggered when OnInitFrameBuffer conduit stage is invoked.

◆ OnMaxPassesChanged()

virtual void RhRdk::Realtime::DisplayMode::OnMaxPassesChanged ( int  )
virtual

Triggered when the user has changed the maximum passes count in the HUD.

◆ OnMouseDblClk()

virtual BOOL32 RhRdk::Realtime::DisplayMode::OnMouseDblClk ( CRhinoView ,
CRhinoMouseCallback::mouse_button  ,
UINT  ,
const ON_2iPoint  
)
overrideprotectedvirtual

Override if you want to handle mouse double click events. If you return TRUE, the default handler is not called. If you return FALSE, the default OnMouseDblClick() handler is called.

Reimplemented from CRhinoMouseCallback.

◆ OnMouseDown()

virtual void RhRdk::Realtime::DisplayMode::OnMouseDown ( unsigned int  viewSerialNumber,
mouse_button  button,
UINT  flags,
const ON_2iPoint point,
bool  defaultHandlerExecuted 
)
overrideprotectedvirtual

Called at the end of CRhinoView processing a mouse down event.

Reimplemented from CRhinoMouseCallback.

◆ OnMouseLeave()

void RhRdk::Realtime::DisplayMode::OnMouseLeave ( )

◆ OnMouseMove()

virtual void RhRdk::Realtime::DisplayMode::OnMouseMove ( unsigned int  viewSerialNumber,
UINT  flags,
const ON_2iPoint point,
bool  defaultHandlerExecuted 
)
overrideprotectedvirtual

Called at the end of CRhinoView processing a mouse move event.

Reimplemented from CRhinoMouseCallback.

◆ OnMouseUp()

virtual void RhRdk::Realtime::DisplayMode::OnMouseUp ( unsigned int  viewSerialNumber,
mouse_button  button,
UINT  flags,
const ON_2iPoint point,
bool  defaultHandlerExecuted 
)
overrideprotectedvirtual

Called at the end of CRhinoView processing a mouse up event.

Reimplemented from CRhinoMouseCallback.

◆ OnPostDrawObjects()

virtual void RhRdk::Realtime::DisplayMode::OnPostDrawObjects ( CRhinoDisplayPipeline pipeline)
protectedvirtual

Triggered when OnPostDrawObjects conduit stage is invoked.

◆ OnPreDrawObjects()

virtual void RhRdk::Realtime::DisplayMode::OnPreDrawObjects ( CRhinoDisplayPipeline pipeline)
protectedvirtual

Triggered when OnPreDrawObjects conduit stage is invoked.

◆ OnRenderSizeChanged()

virtual bool RhRdk::Realtime::DisplayMode::OnRenderSizeChanged ( const ON_2iSize newFrameSize)
pure virtual

Scene has changed, don't start from scratch, just get changes and continue.

◆ OnStatusBarComponentPressed()

virtual void RhRdk::Realtime::DisplayMode::OnStatusBarComponentPressed ( StatusBarComponent  )
virtual

Triggered when a component on the HUD has been pressed. Deprecated - use IHUDCallbacks3::OnStatusBarMouseEvent

◆ Parent()

const DisplayMode* RhRdk::Realtime::DisplayMode::Parent ( void  ) const

If this display mode has a parent, then it is an offline capture started from another pipeline. Either a view capture or a print.

◆ PipelineRuntimeSerialNumber()

unsigned int RhRdk::Realtime::DisplayMode::PipelineRuntimeSerialNumber ( void  ) const

Returns the runtime serial number of the CRhinoDisplayPipeline that is associated with this display mode.

◆ PrepareRenderer()

virtual bool RhRdk::Realtime::DisplayMode::PrepareRenderer ( const CRhinoDisplayPipeline pipe)
protectedvirtual

◆ Progress()

virtual double RhRdk::Realtime::DisplayMode::Progress ( void  ) const
pure virtual

Return the progress of an ongoing capture.

◆ PushDynamicMeshes()

virtual void RhRdk::Realtime::DisplayMode::PushDynamicMeshes ( void  )
virtual

◆ RendererIsAvailable()

virtual bool RhRdk::Realtime::DisplayMode::RendererIsAvailable ( void  ) const
pure virtual

The system's best guess as to whether StartRenderer will succeed. If your renderer is available return true, if it isn't ready yet return false.

◆ RenderSize()

ON_2iSize RhRdk::Realtime::DisplayMode::RenderSize ( void  ) const

Returns the size of the viewport or renderframe related to the running session.

◆ RenderWindow()

virtual_su IRhRdkRenderWindow* RhRdk::Realtime::DisplayMode::RenderWindow ( void  )

◆ SetupSceneServer()

virtual bool RhRdk::Realtime::DisplayMode::SetupSceneServer ( const CRhinoDisplayPipeline pipe)
protectedvirtual

◆ ShowCaptureProgress()

virtual bool RhRdk::Realtime::DisplayMode::ShowCaptureProgress ( void  ) const
pure virtual

Return true if custom display mode supports for the built-in view capture progress dialog .

◆ ShutdownRenderer()

virtual void RhRdk::Realtime::DisplayMode::ShutdownRenderer ( )
pure virtual

The display mode is switched out, you need to clean up your display mode integration.

◆ SignalUpdate()

virtual void RhRdk::Realtime::DisplayMode::SignalUpdate ( void  )
overridevirtual

Allows render engines to signal when they want the display pipeline to redraw.

Implements RhRdk::Realtime::ISignalUpdate.

◆ StartRenderer()

virtual bool RhRdk::Realtime::DisplayMode::StartRenderer ( const ON_2iSize frameSize,
const CRhinoDoc doc,
const ON_3dmView view,
const ON_Viewport vp,
const DisplayMode pParent 
)
pure virtual

The display pipeline has successfully requested a lock on the renderer and we can use this to render the viewport. pParent points to the original engine if this rendering is being used for capture (render an existing view at a new size)

◆ UnlockRendererFrameBuffer()

virtual void RhRdk::Realtime::DisplayMode::UnlockRendererFrameBuffer ( )
pure virtual

If you're calling DrawOrLockRendererFrameBufferImpl, you should call UnlockRendererFrameBufferImpl in your override of this function.

◆ UnlockRendererFrameBufferImpl()

static void RhRdk::Realtime::DisplayMode::UnlockRendererFrameBufferImpl ( const DisplayMode dm,
IRhRdkRenderWindow rw 
)
static

See comment for UnlockRendererFrameBuffer.

◆ UpdateDynamicMesh()

virtual void RhRdk::Realtime::DisplayMode::UpdateDynamicMesh ( const ON_Mesh ,
const ON_Material  
)
virtual

◆ UseFastDraw()

virtual bool RhRdk::Realtime::DisplayMode::UseFastDraw ( )
pure virtual

Return true for fast draw mechanism. Default is old behavior where the pipeline would wait for a short period on several occasions for the implementor to get a framebuffer ready. This function is called just before StartRenderer();

◆ ViewRuntimeSerialNumber()

unsigned int RhRdk::Realtime::DisplayMode::ViewRuntimeSerialNumber ( void  ) const

Returns the runtime serial number of the CRhinoView that is associated with this display mode.

Friends And Related Function Documentation

◆ Impl

friend class Impl
friend