Pure virtual class for stereo support. More...
#include <Inventor/components/stereo/SoStereoViewer.h>
Public Member Functions | |
virtual | ~SoStereoViewer () |
virtual void | setStereoActive (SbBool activate)=0 |
virtual SbBool | isStereoActive ()=0 |
virtual void | actualRendering ()=0 |
virtual SoCamera * | getViewerCamera ()=0 |
virtual const SbVec2s & | getSize ()=0 |
virtual const SbVec2s & | getTopLeft ()=0 |
virtual const SbVec2s & | getBottomRight ()=0 |
virtual SbBool | isViewerDoubleBuffer ()=0 |
virtual void | setStereoViewType (SoBaseStereo *stereoViewType)=0 |
virtual SoBaseStereo * | getStereoViewType ()=0 |
virtual void | reverseStereoView (SbBool reverse)=0 |
virtual SbBool | isStereoViewReversed ()=0 |
virtual void | setStereoAbsoluteAdjustments (SbBool) |
virtual SbBool | isStereoAbsoluteAdjustments () const |
virtual void | setStereoOffset (float offset)=0 |
virtual float | getStereoOffset ()=0 |
virtual void | setStereoBalance (float balance, SbBool nearFrac=false)=0 |
virtual float | getStereoBalance ()=0 |
virtual SbBool | isStereoBalanceNearFrac ()=0 |
virtual void | setViewport (short left, short bottom, short width, short height)=0 |
virtual void | getViewport (short &left, short &bottom, short &width, short &height)=0 |
virtual SoGLContext * | getViewerContext ()=0 |
virtual SoSceneManager * | getViewerSceneManager ()=0 |
This pure virtual class is the class that should be extended by viewer classes that will do stereo rendering.
Note: because of internal dependant calls between stereo classes and Open Inventor viewer classes, SoStereoViewer and SoBaseStereo (and inheriting classes) cannot be used without using SoWinViewer/SoXtViewer/SoQtViewer inheriting classes.
SoWinViewer, SoXtViewer, SoQtViewer
virtual SoStereoViewer::~SoStereoViewer | ( | ) | [inline, virtual] |
Destructor.
virtual void SoStereoViewer::actualRendering | ( | ) | [pure virtual] |
This method is called automatically when the viewer requests that its SoBaseStereo object perform stereo rendering.
actualRendering() may then be called twice (once for each eye view) and therefore must not take into account any stereo-specific settings. It should behave as if it were a rendering method for a monoscopic view.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual const SbVec2s& SoStereoViewer::getBottomRight | ( | ) | [pure virtual] |
Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).
Returns "Bottom" in the first value of the vector and "Right" in the second value (reverse of the usual X,Y ordering).
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual const SbVec2s& SoStereoViewer::getSize | ( | ) | [pure virtual] |
Returns the size of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual float SoStereoViewer::getStereoBalance | ( | ) | [pure virtual] |
Queries the stereo balance (the position of the zero parallax plane).
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual float SoStereoViewer::getStereoOffset | ( | ) | [pure virtual] |
Queries the stereo offset.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual SoBaseStereo* SoStereoViewer::getStereoViewType | ( | ) | [pure virtual] |
Returns the stereo view type.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual const SbVec2s& SoStereoViewer::getTopLeft | ( | ) | [pure virtual] |
Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).
Returns "Top" in the first value of the vector and "Left" in the second value (reverse of the usual X,Y ordering).
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual SoCamera* SoStereoViewer::getViewerCamera | ( | ) | [pure virtual] |
Returning the camera allows the SoBaseStereo to manipulate it to achieve the stereo effect.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual SoGLContext* SoStereoViewer::getViewerContext | ( | ) | [pure virtual] |
Returns the current SoGLContext to render to.
Must return a valid SoGLContext instance.
virtual SoSceneManager* SoStereoViewer::getViewerSceneManager | ( | ) | [pure virtual] |
Returns the current SoSceneManager to render to.
Must return a valid SoSceneManager instance.
virtual void SoStereoViewer::getViewport | ( | short & | left, | |
short & | bottom, | |||
short & | width, | |||
short & | height | |||
) | [pure virtual] |
Returns viewport region with origin (lower-left corner) and size, given as pixel coordinates.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual SbBool SoStereoViewer::isStereoAbsoluteAdjustments | ( | ) | const [inline, virtual] |
Queries if the stereo adjustments are absolute.
Not virtual pure for compatibity reasons.
Reimplemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual SbBool SoStereoViewer::isStereoActive | ( | ) | [pure virtual] |
Queries stereo activation.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual SbBool SoStereoViewer::isStereoBalanceNearFrac | ( | ) | [pure virtual] |
Returns TRUE when the stereo balance adjustement is defined as a fraction of the camera near distance.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual SbBool SoStereoViewer::isStereoViewReversed | ( | ) | [pure virtual] |
Queries reversal of the left and right views.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual SbBool SoStereoViewer::isViewerDoubleBuffer | ( | ) | [pure virtual] |
Queries if viewer is double buffered.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual void SoStereoViewer::reverseStereoView | ( | SbBool | reverse | ) | [pure virtual] |
Sets reversal of the left and right views.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual void SoStereoViewer::setStereoAbsoluteAdjustments | ( | SbBool | ) | [inline, virtual] |
Specifies if stereo adjustments are absolute.
FALSE by default.
The default non-absolute mode allows the stereo settings to be valid over a range of different view volume settings. If you chose absolute mode, you are responsible for modifying the stereo settings (if necessary) when the view volume changes.
When absolute mode is TRUE, stereo offset and balance are used as follows for the right eye view:
StereoCameraOffset = getStereoAdjustment(); FrustumAsymmetry = getBalanceAdjustment(); glTranslated (-StereoCameraOffset, 0, 0); glFrustum (FrustumLeft + FrustumAsymmetry, FrustumRight + FrustumAsymmetry, FrustumBottom, FrustumTop, NearClipDistance, FarClipDistance);
The left eye view is symmetric.
When absolute mode is FALSE, stereo offset and balance are used as follows for the right eye view:
Xrange is right minus left (i.e., first two arguments of glFrustum) and multiply that difference by the ratio of the distance to the desired plane of zero parallax to the near clipping plane distance.
StereoCameraOffset = Xrange * 0.035 * getStereoAdjustment(); FrustumAsymmetry = -StereoCameraOffset * getBalanceAdjustment(); ZeroParallaxDistance = (NearClipDistance + FarClipDistance)/0.5; FrustumAsymmetry *= NearClipDistance / ZeroParallaxDistance; glTranslated (-StereoCameraOffset, 0, 0); glFrustum (FrustumLeft + FrustumAsymmetry, FrustumRight + FrustumAsymmetry, FrustumBottom, FrustumTop, NearClipDistance, FarClipDistance);
The left eye view is symmetric.
Not virtual pure for compatiblity reasons.
Reimplemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual void SoStereoViewer::setStereoActive | ( | SbBool | activate | ) | [pure virtual] |
Sets stereo activation.
Default is FALSE. The default can be set using the OIV_STEREO_ACTIVE environment variable.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual void SoStereoViewer::setStereoBalance | ( | float | balance, | |
SbBool | nearFrac = false | |||
) | [pure virtual] |
Sets the stereo balance (the position of the zero parallax plane) and specifies whether the balance value is defined as a fraction of the camera near distance.
Note: Since the projection matrix always depends on the camera's near plane, in some cases it may be necessary to detect changes to the camera near plane and adjust by setting a new stereo balance value. Open Inventor will make these adjustments automatically if the nearFrac parameter is set to TRUE. In this case the stereo balance value is defined as a fraction of the camera near distance.
Default balance is 1.0. The default can be set using the OIV_STEREO_BALANCE environment variable. Default nearFrac is FALSE. The default can be set using the OIV_STEREO_BALANCE_NEAR_FRAC environment variable.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual void SoStereoViewer::setStereoOffset | ( | float | offset | ) | [pure virtual] |
Sets the stereo offset (the distance of each eye from the camera position).
The right eye is moved plus offset and the left eye is moved minus offset. Default is 0.7. The default can be set using OIV_STEREO_OFFSET environment variable.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual void SoStereoViewer::setStereoViewType | ( | SoBaseStereo * | stereoViewType | ) | [pure virtual] |
If stereoViewType is NULL, the stereo is inactivated (see setStereoActive).
Default is SoAnaglyphStereo with RED_CYAN color filter. The default can be set using the OIV_STEREO_TYPE environment variable.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.
virtual void SoStereoViewer::setViewport | ( | short | left, | |
short | bottom, | |||
short | width, | |||
short | height | |||
) | [pure virtual] |
Sets viewport region with given origin (lower-left corner) and size, given as pixel coordinates.
Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.