SoPerspectiveCamera Class Reference
[Cameras]

Perspective camera node. More...

#include <Inventor/nodes/SoPerspectiveCamera.h>

Inheritance diagram for SoPerspectiveCamera:
SoCamera SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject SoStereoCamera

List of all members.

Public Member Functions

virtual SoType getTypeId () const
 SoPerspectiveCamera ()
virtual void scaleHeight (float scaleFactor)
virtual SbViewVolume getViewVolume (float useAspectRatio=0.0) const
virtual SbViewVolume getViewVolume (float useAspectRatio, float nearDist, float farDist, SbVec3f position, SbRotation orientation) const

Static Public Member Functions

static SoType getClassTypeId ()

Public Attributes

SoSFFloat heightAngle

Detailed Description

Perspective camera node.

A perspective camera defines a perspective projection from a viewpoint. The viewing volume for a perspective camera is a truncated right pyramid.

By default, the camera is located at (0,0,1) and looks along the negative z-axis; the position and orientation fields can be used to change these values. The heightAngle field defines the total vertical angle of the viewing volume; this and the aspectRatio field determine the horizontal angle.

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

Useful algorithms for manipulating a camera are provided in the SoCameraInteractor class.

FILE FORMAT/DEFAULT

ACTION BEHAVIOR

SEE ALSO

SbViewVolume, SoOrthographicCamera, SoCameraInteractor


Constructor & Destructor Documentation

SoPerspectiveCamera::SoPerspectiveCamera (  ) 

Creates a perspective camera node with default settings.


Member Function Documentation

static SoType SoPerspectiveCamera::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoCamera.

Reimplemented in SoStereoCamera.

virtual SoType SoPerspectiveCamera::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoCamera.

Reimplemented in SoStereoCamera.

virtual SbViewVolume SoPerspectiveCamera::getViewVolume ( float  useAspectRatio,
float  nearDist,
float  farDist,
SbVec3f  position,
SbRotation  orientation 
) const [virtual]

Returns a view volume object, based on the camera's viewing parameters.
This object can be used, for example, to get the view and projection matrices, to project 2D screen coordinates into 3D space and to project 3D coordinates into screen space.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:

       // Given a viewer object, get the actual rendering view volume
       float     aspect = viewer->getViewportRegion().getViewportAspectRatio();
       SoCamera* camera = viewer->getCamera();
       SbViewVolume viewVol = camera->getViewVolume( aspect );
       if (aspect < 1)
         viewVol.scale( 1 / aspect );
.

Implements SoCamera.

virtual SbViewVolume SoPerspectiveCamera::getViewVolume ( float  useAspectRatio = 0.0  )  const [virtual]

Fills in a view volume structure, based on the camera.

If the useAspectRatio field is not 0.0 (the default), the camera uses that ratio instead of the one it has.

Note that in ADJUST_CAMERA mode, Inventor automatically modifies the view volume based on the aspect ratio of 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 to render) you must pass the actual viewport aspect ratio to getViewVolume.

Implements SoCamera.

virtual void SoPerspectiveCamera::scaleHeight ( float  scaleFactor  )  [virtual]

Scales the height of the camera, in this case, the heightAngle field.

Implements SoCamera.


Member Data Documentation

Vertical angle of the viewing volume.


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

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/