Rhino C++ API
8.17
|
#include <RhinoSdkDisplayConduit.h>
Public Types | |
enum | StereoDisplayChannel { SDC_INIT_FRAME, SDC_SETUP_FRUSTUM, SDC_DRAW_BACKGROUND, SDC_DRAW_FRAME } |
Static Public Member Functions | |
static bool | HardwareShutterGlassesConduitExists () |
![]() | |
static CRhinoDisplayConduit * | FromRuntimeSerialNumber (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 | |
![]() | |
const CSupportChannels | m_Channels |
The channels that this class was constructed with. More... | |
class CChannelAttributes * | m_pChannelAttrs = nullptr |
CDisplayPipelineAttributes * | m_pDisplayAttrs = nullptr |
unsigned int | m_rhino_doc_sn = 0 |
unsigned int | m_rhino_view_sn = 0 |
unsigned int | m_rhino_viewport_sn = 0 |
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).
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.
|
virtual |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
void CRhinoStereoDisplayConduit::Disable | ( | ) |
Description: Turn this conduit off. When a conduit is disabled, it will not participate in any custom drawing activity.
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.
|
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
|
inlineprotected |
|
inlineprotected |
|
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.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
static |
|
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.
|
pure virtual |
|
protected |
|
protected |
|
inline |
Attributes.
|
friend |