Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoStereoCamera Class Reference

Stereo camera node. More...

#include <Inventor/nodes/SoStereoCamera.h>

+ Inheritance diagram for SoStereoCamera:

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoStereoCamera ()
 Creates a stereo camera node with default settings.
 
Deprecated
virtual SoDEPRECATED void setStereoAdjustment (float adjustment)
 
virtual SoDEPRECATED void setStereoAbsoluteAdjustments (SbBool absolute)
 
virtual SoDEPRECATED void setBalanceAdjustment (float adjustment, SbBool nearFrac=false)
 
virtual SoDEPRECATED void allowStereo (SbBool allowed)
 Allows the camera to render in stereo.
 
- Public Member Functions inherited from SoPerspectiveCamera
 SoPerspectiveCamera ()
 Creates a perspective camera node with default settings.
 
virtual void scaleHeight (float scaleFactor)
 Scales the height of the camera, in this case, the heightAngle field.
 
virtual SbViewVolume getViewVolume (float useAspectRatio=0.0) const
 Fills in a view volume structure, based on the camera.
 
virtual SbViewVolume getViewVolume (float useAspectRatio, float nearDist, float farDist, SbVec3f position, SbRotation orientation) const
 Returns a view volume object, based on the camera's viewing parameters.
 
- Public Member Functions inherited from SoCamera
void pointAt (const SbVec3f &targetPoint)
 Sets the orientation of the camera so that it points toward the given target point while keeping the "up" direction of the camera parallel to the positive y-axis.
 
void viewAll (SoNode *sceneRoot, const SbViewportRegion &vpRegion, float slack=1.0)
 Sets the camera to view the scene rooted by the given node.
 
void viewAll (SoPath *path, const SbViewportRegion &vpRegion, float slack=1.0)
 Sets the camera to view the scene defined by the given path.
 
void viewAll (const SbBox3f &bbox, const SbViewportRegion &vpRegion)
 Sets the camera to view the region defined by the given bounding box.
 
SbViewportRegion getViewportBounds (const SbViewportRegion &region) const
 Returns the viewport region this camera would use to render into the given viewport region, accounting for cropping.
 
void setStereoMode (StereoMode mode)
 Sets the stereo mode.
 
StereoMode getStereoMode () const
 Queries the stereo mode.
 
SoDEPRECATED float getStereoAdjustment () const
 Queries the stereo offset.
 
SoDEPRECATED SbBool getStereoAbsoluteAdjustment () const
 Queries the stereo absolute adjustment state.
 
SoDEPRECATED float getBalanceAdjustment () const
 Queries the parallax balance.
 
SoDEPRECATED SbBool isBalanceAdjustmentNearFrac () const
 Returns TRUE if the stereo balance adjustement is defined as a fraction of the camera near distance.
 
- Public Member Functions inherited from SoNode
virtual void setOverride (const SbBool state)
 Turns the override flag on or off.
 
virtual SbBool isOverride () const
 Returns the state of the override flag.
 
virtual SoNodecopy (SbBool copyConnections=FALSE) const
 Creates and returns an exact copy of the node.
 
virtual SbBool affectsState () const
 Returns TRUE if a node has an effect on the state during traversal.
 
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoPerspectiveCamera
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoCamera
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoNode
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoNodegetByName (const SbName &name)
 A node's name can be set using SoBase::setName().
 
static int getByName (const SbName &name, SoNodeList &list)
 A node's name can be set using SoBase::setName().
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Public Attributes

SoSFFloat offset
 The stereo offset (the distance of each eye from the camera position).
 
SoSFFloat balance
 The stereo balance (the position of the zero parallax plane).
 
SoSFBool balanceNearFrac
 Specifies whether the balance value is defined as a fraction of the camera near distance.
 
SoSFBool absoluteAdjustments
 Specifies if stereo adjustments are absolute.
 
- Public Attributes inherited from SoPerspectiveCamera
SoSFFloat heightAngle
 Vertical angle of the viewing volume.
 
- Public Attributes inherited from SoCamera
SoSFEnum viewportMapping
 Defines how to map the rendered image into the current viewport, when the aspect ratio of the camera differs from that of the viewport.
 
SoSFVec3f position
 The location of the camera viewpoint.
 
SoSFRotation orientation
 The orientation of the camera viewpoint, defined as a rotation of the viewing direction from its default (0,0,-1) vector.
 
SoSFFloat aspectRatio
 The ratio of camera viewing width to height.
 
SoSFFloat nearDistance
 The distance from the camera viewpoint to the near clipping plane.
 
SoSFFloat farDistance
 The distance from the camera viewpoint to the far clipping plane.
 
SoSFFloat focalDistance
 The distance from the viewpoint to the point of focus.
 

Additional Inherited Members

- Public Types inherited from SoCamera
enum  ViewportMapping {
  CROP_VIEWPORT_FILL_FRAME = 0 ,
  CROP_VIEWPORT_LINE_FRAME = 1 ,
  CROP_VIEWPORT_NO_FRAME = 2 ,
  ADJUST_CAMERA = 3 ,
  LEAVE_ALONE = 4
}
 Viewport mapping. More...
 
enum  StereoMode {
  MONOSCOPIC ,
  LEFT_VIEW ,
  RIGHT_VIEW
}
 Stereo mode. More...
 

Detailed Description

Stereo camera node.

A stereo camera defines a specific perspective camera for stereo support.

This class defines fields to store the stereo settings related to the camera:

  • Stereo offset: the distance of each eye from the camera position.
  • Stereo balance: the position of the zero parallax plane.

See the base class SoPerspectiveCamera for more information about the inherited fields.

FILE FORMAT/DEFAULT

    StereoCamera {
    offset 0.7
    balance 1.0
    balanceNearFrac FALSE
    absoluteAdjustments FALSE
    }

ACTION BEHAVIOR

SEE ALSO

SbViewVolume, SoPerspectiveCamera, SoCameraInteractor

Definition at line 62 of file SoStereoCamera.h.

Constructor & Destructor Documentation

◆ SoStereoCamera()

SoStereoCamera::SoStereoCamera ( )

Creates a stereo camera node with default settings.

Member Function Documentation

◆ allowStereo()

virtual SoDEPRECATED void SoStereoCamera::allowStereo ( SbBool  allowed)
virtual

Allows the camera to render in stereo.

Do nothing here as this camera is always allowed to render in stereo.

Reimplemented from SoCamera.

◆ getClassTypeId()

static SoType SoStereoCamera::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getTypeId()

virtual SoType SoStereoCamera::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoPerspectiveCamera.

◆ setBalanceAdjustment()

virtual SoDEPRECATED void SoStereoCamera::setBalanceAdjustment ( float  adjustment,
SbBool  nearFrac = false 
)
virtual

Reimplemented from SoCamera.

◆ setStereoAbsoluteAdjustments()

virtual SoDEPRECATED void SoStereoCamera::setStereoAbsoluteAdjustments ( SbBool  absolute)
virtual

Reimplemented from SoCamera.

◆ setStereoAdjustment()

virtual SoDEPRECATED void SoStereoCamera::setStereoAdjustment ( float  adjustment)
virtual

Reimplemented from SoCamera.

Member Data Documentation

◆ absoluteAdjustments

SoSFBool SoStereoCamera::absoluteAdjustments

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 shown in the following pseudo-code for the right eye view:

StereoCameraOffset = offset.getValue();
FrustumAsymmetry = balance.getValue();
glTranslated (-StereoCameraOffset, 0, 0);
glFrustum (FrustumLeft + FrustumAsymmetry, FrustumRight + FrustumAsymmetry,
FrustumBottom, FrustumTop, NearClipDistance, FarClipDistance);
float getValue() const
Returns this field's value.
Definition SoSFFloat.h:81
SoSFFloat offset
The stereo offset (the distance of each eye from the camera position).
SoSFFloat balance
The stereo balance (the position of the zero parallax plane).

The left eye view is symmetric.

When absolute mode is FALSE, stereo offset and balance are used as shown in the following pseudo-code 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 * offset.getValue();
FrustumAsymmetry = -StereoCameraOffset * balance.getValue();
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.

Definition at line 133 of file SoStereoCamera.h.

◆ balance

SoSFFloat SoStereoCamera::balance

The stereo balance (the position of the zero parallax plane).

Default balance is 1.0.

Definition at line 79 of file SoStereoCamera.h.

◆ balanceNearFrac

SoSFBool SoStereoCamera::balanceNearFrac

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 balanceNearFrac field is set to TRUE. In this case the stereo balance value is defined as a fraction of the camera near distance.

Default nearFrac is FALSE.

Definition at line 93 of file SoStereoCamera.h.

◆ offset

SoSFFloat SoStereoCamera::offset

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.

Definition at line 73 of file SoStereoCamera.h.


The documentation for this class was generated from the following file: