Class SoStereoCamera
- java.lang.Object
-
- All Implemented Interfaces:
SafeDisposable
public class SoStereoCamera extends SoPerspectiveCamera
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:
Sets:
SoStereoElement
- See Also:
SbViewVolume
,SoPerspectiveCamera
,SoCameraInteractor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoCamera
SoCamera.StereoModes, SoCamera.ViewportMappings
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoSFBool
absoluteAdjustments
Specifies if stereo adjustments are absolute.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.SoSFFloat
offset
The stereo offset (the distance of each eye from the camera position).-
Fields inherited from class com.openinventor.inventor.nodes.SoPerspectiveCamera
heightAngle
-
Fields inherited from class com.openinventor.inventor.nodes.SoCamera
aspectRatio, farDistance, focalDistance, nearDistance, orientation, position, viewportMapping
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoStereoCamera()
Creates a stereo camera node with default settings.
-
Method Summary
-
Methods inherited from class com.openinventor.inventor.nodes.SoCamera
allowStereo, getBalanceAdjustment, getStereoAbsoluteAdjustment, getStereoAdjustment, getStereoMode, getViewportBounds, getViewVolume, getViewVolume, getViewVolume, isBalanceAdjustmentNearFrac, pointAt, scaleHeight, setBalanceAdjustment, setBalanceAdjustment, setStereoAbsoluteAdjustments, setStereoAdjustment, setStereoMode, viewAll, viewAll, viewAll, viewAll, viewAll
-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
offset
public final SoSFFloat 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.
-
balance
public final SoSFFloat balance
The stereo balance (the position of the zero parallax plane). Default balance is 1.0.
-
balanceNearFrac
public final SoSFBool 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.
-
absoluteAdjustments
public final SoSFBool 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); 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);
-
-