public abstract class SoCamera extends SoNode
You can also use a node kit to create a camera; see the reference page for SoCameraKit
.
Useful algorithms for manipulating a camera are provided in the SoCameraInteractor
class.
Compute the current view vector or up vector.
Compute the current focal point.
See also:
SoOrthographicCamera
, SoPerspectiveCamera
, SoCameraKit
, SoCameraInteractor
Modifier and Type | Class and Description |
---|---|
static class |
SoCamera.StereoModes
Stereo mode
|
static class |
SoCamera.ViewportMappings
Viewport mapping.
|
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
static int |
ADJUST_CAMERA
Deprecated.
Use
SoCamera.ViewportMappings.ADJUST_CAMERA instead. |
SoSFFloat |
aspectRatio
The ratio of camera viewing width to height.
|
static int |
CROP_VIEWPORT_FILL_FRAME
Deprecated.
Use
SoCamera.ViewportMappings.CROP_VIEWPORT_FILL_FRAME instead. |
static int |
CROP_VIEWPORT_LINE_FRAME
Deprecated.
Use
SoCamera.ViewportMappings.CROP_VIEWPORT_LINE_FRAME instead. |
static int |
CROP_VIEWPORT_NO_FRAME
Deprecated.
Use
SoCamera.ViewportMappings.CROP_VIEWPORT_NO_FRAME instead. |
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.
|
static int |
LEAVE_ALONE
Deprecated.
Use
SoCamera.ViewportMappings.LEAVE_ALONE instead. |
static int |
LEFT_VIEW
Deprecated.
Use
SoCamera.StereoModes.LEFT_VIEW instead. |
static int |
MONOSCOPIC
Deprecated.
Use
SoCamera.StereoModes.MONOSCOPIC instead. |
SoSFFloat |
nearDistance
The distance from the camera viewpoint to the near clipping plane.
|
SoSFRotation |
orientation
The orientation of the camera viewpoint, defined as a rotation of the viewing direction from its default (0,0,-1) vector.
|
SoSFVec3f |
position
The location of the camera viewpoint.
|
static int |
RIGHT_VIEW
Deprecated.
Use
SoCamera.StereoModes.RIGHT_VIEW instead. |
SoSFEnum<SoCamera.ViewportMappings> |
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.
|
VERBOSE_LEVEL, ZeroHandle
Modifier and Type | Method and Description |
---|---|
void |
allowStereo(boolean name_9980)
Deprecated.
As of Open Inventor 9700 See documentation for more details
|
float |
getBalanceAdjustment()
Deprecated.
As of Open Inventor 9700 See documentation for more details
|
boolean |
getStereoAbsoluteAdjustment()
Deprecated.
As of Open Inventor 9700 See documentation for more details
|
float |
getStereoAdjustment()
Deprecated.
As of Open Inventor 9700 See documentation for more details
|
SoCamera.StereoModes |
getStereoMode()
Queries the stereo mode.
|
SbViewportRegion |
getViewportBounds(SbViewportRegion region)
Returns the viewport region this camera would use to render into the given viewport region, accounting for cropping.
|
SbViewVolume |
getViewVolume()
Calls getViewVolume((float)0.0).
|
SbViewVolume |
getViewVolume(float useAspectRatio)
Returns a view volume object, based on the camera's viewing parameters.
|
boolean |
isBalanceAdjustmentNearFrac()
Deprecated.
As of Open Inventor 9700 See documentation for more details
|
void |
pointAt(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 |
scaleHeight(float scaleFactor)
Scales the height of the camera.
|
void |
setBalanceAdjustment(float adjustment)
Deprecated.
|
void |
setBalanceAdjustment(float adjustment,
boolean nearFrac)
Deprecated.
As of Open Inventor 9700 See documentation for more details
|
void |
setStereoAbsoluteAdjustments(boolean absolute)
Deprecated.
As of Open Inventor 9700 See documentation for more details
|
void |
setStereoAdjustment(float adjustment)
Deprecated.
As of Open Inventor 9700 See documentation for more details
|
void |
setStereoMode(SoCamera.StereoModes mode)
Sets the stereo mode.
|
void |
viewAll(SbBox3f bbox,
SbViewportRegion vpRegion)
Sets the camera to view the region defined by the given bounding box.
|
void |
viewAll(SoNode sceneRoot,
SbViewportRegion vpRegion)
Calls viewAll(sceneRoot, vpRegion, (float)1.0).
|
void |
viewAll(SoNode sceneRoot,
SbViewportRegion vpRegion,
float slack)
Sets the camera to view the scene rooted by the given node.
|
void |
viewAll(SoPath path,
SbViewportRegion vpRegion)
Calls viewAll(path, vpRegion, (float)1.0).
|
void |
viewAll(SoPath path,
SbViewportRegion vpRegion,
float slack)
Sets the camera to view the scene defined by the given path.
|
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizable
getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
@Deprecated public static final int CROP_VIEWPORT_FILL_FRAME
SoCamera.ViewportMappings.CROP_VIEWPORT_FILL_FRAME
instead.@Deprecated public static final int CROP_VIEWPORT_LINE_FRAME
SoCamera.ViewportMappings.CROP_VIEWPORT_LINE_FRAME
instead.@Deprecated public static final int CROP_VIEWPORT_NO_FRAME
SoCamera.ViewportMappings.CROP_VIEWPORT_NO_FRAME
instead.@Deprecated public static final int ADJUST_CAMERA
SoCamera.ViewportMappings.ADJUST_CAMERA
instead.@Deprecated public static final int LEAVE_ALONE
SoCamera.ViewportMappings.LEAVE_ALONE
instead.@Deprecated public static final int MONOSCOPIC
SoCamera.StereoModes.MONOSCOPIC
instead.@Deprecated public static final int LEFT_VIEW
SoCamera.StereoModes.LEFT_VIEW
instead.@Deprecated public static final int RIGHT_VIEW
SoCamera.StereoModes.RIGHT_VIEW
instead.public final SoSFEnum<SoCamera.ViewportMappings> viewportMapping
public final SoSFVec3f position
public final SoSFRotation orientation
public final SoSFFloat aspectRatio
public final SoSFFloat nearDistance
public final SoSFFloat farDistance
public final SoSFFloat focalDistance
public SbViewVolume getViewVolume()
public void viewAll(SoPath path, SbViewportRegion vpRegion)
public void viewAll(SoNode sceneRoot, SbViewportRegion vpRegion)
@Deprecated public void setBalanceAdjustment(float adjustment)
@Deprecated public float getBalanceAdjustment()
SoStereoCamera
and balance field instead. @Deprecated public boolean isBalanceAdjustmentNearFrac()
SoStereoCamera
and balanceNearFrac field instead. public void scaleHeight(float scaleFactor)
public void pointAt(SbVec3f targetPoint)
public SoCamera.StereoModes getStereoMode()
@Deprecated public void setBalanceAdjustment(float adjustment, boolean nearFrac)
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.Deprecated since Open Inventor 9700
Use SoStereoCamera
and balance / balanceNearFrac fields instead.
@Deprecated public void allowStereo(boolean name_9980)
SoStereoCamera
instead. public void setStereoMode(SoCamera.StereoModes mode)
public SbViewVolume getViewVolume(float useAspectRatio)
If the useAspectRatio parameter is 0.0 (the default), the camera uses the current value of the aspectRatio
field to compute the view volume.
NOTE: In ADJUST_CAMERA mode (the default), the view volume returned when useAspectRatio = 0, is not (in general) the actual view volume used for rendering. Using this view volume to project points will not (in general) produce the correct results.
This is because, in ADJUST_CAMERA mode, Inventor automatically modifies the view volume to match the aspect ratio of the current viewport. This avoids the distortion that would be caused by "stretching" the view volume when it is mapped into the viewport. However the view volume values are not changed, only the values passed to OpenGL. In order to get the modified values (i.e., the actual view volume used for rendering) you must pass the actual viewport aspect ratio to getViewVolume. You can get the current viewport from the renderArea or viewer object that contains the Open Inventor window.
Also note that in ADJUST_CAMERA mode, when the viewport aspect ratio is less than 1, Open Inventor automatically scales the actual rendering view volume by the inverse of the aspect ratio (i.e. 1/aspect). The getViewVolume method does not automatically apply this adjustment. So a correct query of the actual rendering view volume can be done like this:
@Deprecated public float getStereoAdjustment()
SoStereoCamera
and offset field instead. @Deprecated public void setStereoAdjustment(float adjustment)
SoStereoCamera
and offset field instead. @Deprecated public boolean getStereoAbsoluteAdjustment()
SoStereoCamera
and absoluteAdjustments field instead. @Deprecated public void setStereoAbsoluteAdjustments(boolean absolute)
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:
The left eye view is symmetric.StereoCameraOffset = getStereoAdjustment(); FrustumAsymmetry = getBalanceAdjustment(); 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.
The left eye view is symmetric.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);
Not virtual pure for compatiblity reasons.Deprecated since Open Inventor 9700
Use SoStereoCamera
and absoluteAdjustments field instead.
public void viewAll(SoPath path, SbViewportRegion vpRegion, float slack)
See note about bounding boxes in the sceneRoot version of this method.
public void viewAll(SoNode sceneRoot, SbViewportRegion vpRegion, float slack)
The node applies an SoGetBoundingBoxAction
to the scene graph to get the bounding box of the entire scene. The bounding box will only include shapes that are actually traversed. For example the bounding box will not include shapes under an SoSwitch
with whichChild set to SO_SWITCH_NONE. The action does not consider the visibility of shapes that are traversed. In other words the bounding box will include shapes that are invisible (SoDrawStyle
), shapes that are clipped (SoClipPlane
), etc. Use an SoBBox
node to exclude shapes from the bounding box computation. Bounding boxes are automatically cached at SoSeparator
nodes, so getting the bounding box is very fast when the scene graph has not been changed.
public SbViewportRegion getViewportBounds(SbViewportRegion region)
public void viewAll(SbBox3f bbox, SbViewportRegion vpRegion)
See note about bounding boxes in the sceneRoot version of this method.
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com