Rhino C++ API  8.14
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
CRhinoStereoDisplayConduit Class Referenceabstract

#include <RhinoSdkDisplayConduit.h>

Inheritance diagram for CRhinoStereoDisplayConduit:
CRhinoDisplayConduit

Public Types

enum  StereoDisplayChannel { SDC_INIT_FRAME, SDC_SETUP_FRUSTUM, SDC_DRAW_BACKGROUND, SDC_DRAW_FRAME }
 

Public Member Functions

 CRhinoStereoDisplayConduit (bool bRequiresHardwareShutterGlasses=false)
 
virtual ~CRhinoStereoDisplayConduit ()
 
void Disable ()
 
void Enable ()
 
virtual void FinalizeFrame (CRhinoDisplayPipeline &pipeline)
 
virtual bool ProcessLeftEye (CRhinoDisplayPipeline &pipeline, StereoDisplayChannel nChannel)=0
 Intefrace. More...
 
virtual bool ProcessRightEye (CRhinoDisplayPipeline &pipeline, StereoDisplayChannel nChannel)=0
 
bool UsesHardwareShutterGlasses () const
 Attributes. More...
 
- Public Member Functions inherited from CRhinoDisplayConduit
 CRhinoDisplayConduit (CSupportChannels channel_mask)
 
 CRhinoDisplayConduit (CSupportChannels channel_mask, bool enable)
 
virtual ~CRhinoDisplayConduit ()
 
bool Bind (const CRhinoDisplayPipeline &pipeline)
 Binding methods... More...
 
bool Bind (const CRhinoView &view)
 See: bool CRhinoDisplayConduit::Bind(const CRhinoDisplayPipeline& pipeline);. More...
 
bool Bind (const CRhinoViewport &viewport)
 See: bool CRhinoDisplayConduit::Bind(const CRhinoDisplayPipeline& pipeline);. More...
 
bool Bind (const ON_Viewport &viewport)
 See: bool CRhinoDisplayConduit::Bind(const CRhinoDisplayPipeline& pipeline);. More...
 
int BindingCount () const
 
bool BindingsExist () const
 
bool ChannelSupported (UINT channel) const
 Attributes... More...
 
bool ConstantBinding () const
 
void Disable ()
 
class CRhinoDocDocument () const
 
unsigned int DocumentSerialNumber () const
 
void Enable ()
 
void Enable (unsigned int docSerialNumber)
 
void EnableConstantBinding (bool enable=true)
 
unsigned int GetGeometryFilter () const
 
ON_UuidList GetObjectFilter () const
 
void GetSelectedFilter (bool &on, bool &checkSubObjects) const
 
bool InterestedInObject (const CRhinoObject *) const
 
bool IsBound (const CRhinoDisplayPipeline &pipeline, bool ignore_state=false) const
 
bool IsBound (const CRhinoView &view, bool ignore_state=false) const
 See: CRhinoDisplayConduit::IsBound( const CRhinoDisplayPipeline& pipeline, bool ignore_state = false) const;. More...
 
bool IsBound (const CRhinoViewport &viewport, bool ignore_state=false) const
 See: CRhinoDisplayConduit::IsBound( const CRhinoDisplayPipeline& pipeline, bool ignore_state = false) const;. More...
 
bool IsBound (const ON_Viewport &viewport, bool ignore_state=false) const
 See: CRhinoDisplayConduit::IsBound( const CRhinoDisplayPipeline& pipeline, bool ignore_state = false) const;. More...
 
bool IsEnabled () const
 
bool IsEnabled (unsigned int docSerialNumber) const
 
virtual void NotifyConduit (EConduitNotifiers notification_event, CRhinoDisplayPipeline &pipeline)
 Notifications... More...
 
class CRhinoPageViewPageView () const
 
unsigned int PageViewSerialNumber () const
 
bool ReplaceBinding (const CRhinoDisplayPipeline &old_pipeline, const CRhinoDisplayPipeline &new_pipeline)
 
bool ReplaceBinding (const CRhinoView &old_view, const CRhinoView &new_view)
 See: bool CRhinoDisplayConduit::ReplaceBinding(const CRhinoDisplayPipeline& old_pipeline, const CRhinoDisplayPipeline& new_pipeline);. More...
 
bool ReplaceBinding (const CRhinoViewport &old_viewport, const CRhinoViewport &new_viewport)
 See: bool CRhinoDisplayConduit::ReplaceBinding(const CRhinoDisplayPipeline& old_pipeline, const CRhinoDisplayPipeline& new_pipeline);. More...
 
bool ReplaceBinding (const ON_Viewport &old_viewport, const ON_Viewport &new_viewport)
 See: bool CRhinoDisplayConduit::ReplaceBinding(const CRhinoDisplayPipeline& old_pipeline, const CRhinoDisplayPipeline& new_pipeline);. More...
 
void SetGeometryFilter (unsigned int geometry_filter)
 
void SetObjectFilter (const ON_SimpleArray< ON_UUID > &objectIds)
 
void SetObjectFilter (ON_UUID objectId)
 
void SetSelectedFilter (bool on, bool checkSubObjects)
 
bool ToggleBinding (const CRhinoDisplayPipeline &pipeline)
 
bool ToggleBinding (const CRhinoView &view)
 See: bool CRhinoDisplayConduit::ToggleBinding(const CRhinoDisplayPipeline& pipeline);. More...
 
bool ToggleBinding (const CRhinoViewport &viewport)
 See: bool CRhinoDisplayConduit::ToggleBinding(const CRhinoDisplayPipeline& pipeline);. More...
 
bool ToggleBinding (const ON_Viewport &viewport)
 See: bool CRhinoDisplayConduit::ToggleBinding(const CRhinoDisplayPipeline& pipeline);. More...
 
bool Unbind (const CRhinoDisplayPipeline &pipeline)
 
bool Unbind (const CRhinoView &view)
 See: bool CRhinoDisplayConduit::Unbind(const CRhinoDisplayPipeline& pipeline);. More...
 
bool Unbind (const CRhinoViewport &viewport)
 See: bool CRhinoDisplayConduit::Unbind(const CRhinoDisplayPipeline& pipeline);. More...
 
bool Unbind (const ON_Viewport &viewport)
 See: bool CRhinoDisplayConduit::Unbind(const CRhinoDisplayPipeline& pipeline);. More...
 
void UnbindAll ()
 
class CRhinoViewView () const
 
class CRhinoViewportViewport () const
 
unsigned int ViewportSerialNumber () const
 
unsigned int ViewSerialNumber () const
 

Static Public Member Functions

static bool HardwareShutterGlassesConduitExists ()
 
- Static Public Member Functions inherited from CRhinoDisplayConduit
static CRhinoDisplayConduitFromRuntimeSerialNumber (unsigned int display_conduit_sn)
 
static bool IsValidDisplayConduitPointer (const void *display_conduit)
 
static bool IsValidDisplayConduitReference (const CRhinoDisplayConduit &display_conduit)
 
static unsigned int RuntimeSerialNumber (const CRhinoDisplayConduit *conduit)
 

Protected Member Functions

ON_3dVector CameraDirection () const
 
ON_3dPoint CameraLocation () const
 
ON_3dVector CameraUp () const
 
double FrustBottom () const
 
double FrustFar () const
 
double FrustLeft () const
 Frustum helper methods... More...
 
double FrustNear () const
 
double FrustRight () const
 
double FrustTop () const
 
void SetFrustLeft (double)
 
void SetFrustRight (double)
 

Friends

class CRhinoDisplayConduit
 

Additional Inherited Members

- Protected Attributes inherited from CRhinoDisplayConduit
const CSupportChannels m_Channels
 The channels that this class was constructed with. More...
 
class CChannelAttributesm_pChannelAttrs = nullptr
 
CDisplayPipelineAttributesm_pDisplayAttrs = nullptr
 
unsigned int m_rhino_doc_sn = 0
 
unsigned int m_rhino_view_sn = 0
 
unsigned int m_rhino_viewport_sn = 0
 

Detailed Description

Specialized abstract conduit class that provides very high level support for setting up and managing 3D Stereo viewports.

There are basically two types of stereo modes supported in Rhino: 1) Hardware shutter glasses 2) Some kind of software generated stereo view, (i.e. Anaglyph red/blue glasses)

You cannot support both types in one conduit. When you construct your stereo conduit you must specify what type you plan on supporting and all the appropriate setup and framework initialization will be done for you automatically.

Each "stereo phase" is broken into 3 primary parts (or channels): 1) Frame buffer initialization 2) Frustum setup and initialization 3) Frame buffer drawing

...each of those phases is called for each eye and are handled in the abstract routines:

   ProcessLeftEye(...)
   ProcessRightEye(...)

For obvious reasons, you should process all left eye calculations and left eye drawing inside "ProcessLeftEye", and all right eye calculations
and right eye drawing inside "ProcessRightEye". Doing any other kind of calculations inside either of these routines will have unknown behavior.

Each processing routine is passed an identifying channel ID so that you can determine where you are in the pipeline and what needs to be done.

For example: The following overridden routine is used to process left eye stereo frames...(you will need to do similar things inside ProcessRightEye as well)

bool CSomeStereoViewConduit::ProcessLeftEye(CRhinoDisplayPipeline& dp, StereoDisplayChannel nChannel) { bool bProcessed = false;

switch ( nChannel ) { case SDC_INIT_FRAME: { ///< clear the left eye frame buffer... bProcessed = true; break; }

case SDC_SETUP_FRUSTUM: { ///< Setup left eye frustum... bProcessed = true; break; }

case SDC_DRAW_FRAME: { ///< Draw left eye frame... bProcessed = true; break; } } return bProcessed; }

Note: If you process a given channel then you should return true from your routines, if you don't process a given channel, then returning false will cause Rhino to process that channel using its default mechanism.

For example: If you don't plan on doing anything for frame buffer initialization, then returning false will cause Rhino to clear the frame buffer using the standard default mechanism (which is based on whatever the current display mode is using).

Member Enumeration Documentation

◆ StereoDisplayChannel

The primary channels acted on for stereo viewing. These get passed to your Process Eye methods so that you can determine which channel Rhino is currently working on.

Enumerator
SDC_INIT_FRAME 
SDC_SETUP_FRUSTUM 
SDC_DRAW_BACKGROUND 
SDC_DRAW_FRAME 

Constructor & Destructor Documentation

◆ CRhinoStereoDisplayConduit()

CRhinoStereoDisplayConduit::CRhinoStereoDisplayConduit ( bool  bRequiresHardwareShutterGlasses = false)

If you wish to support hardware 3d stereo modes (i.e. Shutter glasses), then construct your conduit passing true to this base class constructor, otherwise your stereo implementation is entirely left up to you.

Note: Constructing a stereo conduit does NOT automatically set the viewport into hardware stereo mode. You MUST manually configure a Rhino display mode to use hardware 3D shutter glasses, and then manually set the viewport to use that display mode. Due to OS restrictions and limitations, binding all of this to a conduit construction is not possible within current architecture. If you construct your conduit and bind it to a view that is not using a 3d shutter glasses display mode, then none of your eye processing methods will be called... However, setting a view to use a 3d shutter glasses mode after condstruction should then cause your methods to get called without any further actions by your code.

◆ ~CRhinoStereoDisplayConduit()

virtual CRhinoStereoDisplayConduit::~CRhinoStereoDisplayConduit ( )
virtual

Member Function Documentation

◆ CameraDirection()

ON_3dVector CRhinoStereoDisplayConduit::CameraDirection ( ) const
inlineprotected

◆ CameraLocation()

ON_3dPoint CRhinoStereoDisplayConduit::CameraLocation ( ) const
inlineprotected

◆ CameraUp()

ON_3dVector CRhinoStereoDisplayConduit::CameraUp ( ) const
inlineprotected

◆ Disable()

void CRhinoStereoDisplayConduit::Disable ( )

Description: Turn this conduit off. When a conduit is disabled, it will not participate in any custom drawing activity.

◆ Enable()

void CRhinoStereoDisplayConduit::Enable ( )

Description: Turn this conduit on. When a conduit is enabled, it's ExecConduit function is called for each viewport that this conduit pays attention to.

◆ FinalizeFrame()

virtual void CRhinoStereoDisplayConduit::FinalizeFrame ( CRhinoDisplayPipeline pipeline)
virtual

Since some stereo modes don't require any sort of post processing of the frame buffer, then the standard pipeline mechanism for displaying the final frame buffer will suffice and therefore this is not a required interface for stereo view conduits...Nevertheless, this routine is always called once, when ALL left and right eye processing has completed.

Parameters: pipeline: [in] the pipeline your conduit is executing in

◆ FrustBottom()

double CRhinoStereoDisplayConduit::FrustBottom ( ) const
inlineprotected

◆ FrustFar()

double CRhinoStereoDisplayConduit::FrustFar ( ) const
inlineprotected

◆ FrustLeft()

double CRhinoStereoDisplayConduit::FrustLeft ( ) const
inlineprotected

Frustum helper methods...

All camera and frustum values are ONLY valid when processing left and right eyes within the SDC_SETUP_FRUSTUM channel. Accessing any of these values before, after, or outside that channel will have unknown behavior.

◆ FrustNear()

double CRhinoStereoDisplayConduit::FrustNear ( ) const
inlineprotected

◆ FrustRight()

double CRhinoStereoDisplayConduit::FrustRight ( ) const
inlineprotected

◆ FrustTop()

double CRhinoStereoDisplayConduit::FrustTop ( ) const
inlineprotected

◆ HardwareShutterGlassesConduitExists()

static bool CRhinoStereoDisplayConduit::HardwareShutterGlassesConduitExists ( )
static

◆ ProcessLeftEye()

virtual bool CRhinoStereoDisplayConduit::ProcessLeftEye ( CRhinoDisplayPipeline pipeline,
StereoDisplayChannel  nChannel 
)
pure virtual

Intefrace.

You MUST implement to following methods and act on them accordingly based on the passed in channel type... As mentioned above, each one of these is called automatically by the framework once your conduit is constructed and bound to a view. What you do in these routines is entirely up to your implementation.

Parameters: pipeline: [in] the pipeline your conduit is executing in nChannel: [in] the current stereo phase the pipeline is running Returns: true: if you processed the specified channel and you do not want Rhino to process it. false: if you did NOT process the specified channel and you want Rhino to process it using the standard default mechanism.

◆ ProcessRightEye()

virtual bool CRhinoStereoDisplayConduit::ProcessRightEye ( CRhinoDisplayPipeline pipeline,
StereoDisplayChannel  nChannel 
)
pure virtual

◆ SetFrustLeft()

void CRhinoStereoDisplayConduit::SetFrustLeft ( double  )
protected

◆ SetFrustRight()

void CRhinoStereoDisplayConduit::SetFrustRight ( double  )
protected

◆ UsesHardwareShutterGlasses()

bool CRhinoStereoDisplayConduit::UsesHardwareShutterGlasses ( ) const
inline

Attributes.

Friends And Related Function Documentation

◆ CRhinoDisplayConduit

friend class CRhinoDisplayConduit
friend