SoPerspectiveCamera.3coin2

Langue: en

Version: 373279 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

SoPerspectiveCamera -

The SoPerspectiveCamera class defines a camera node with perspective rendering.

For realistic looking 3D scene, the geometry should be rendered with perspective calculations. Use this camera type to accomplish this.

SYNOPSIS


#include <Inventor/nodes/SoPerspectiveCamera.h>

Inherits SoCamera.

Public Member Functions


SoPerspectiveCamera (void)

virtual void scaleHeight (float scalefactor)

virtual SbViewVolume getViewVolume (float useaspectratio=0.0f) const

Static Public Member Functions


static void initClass (void)

Public Attributes


SoSFFloat heightAngle

Protected Member Functions


virtual ~SoPerspectiveCamera ()

virtual void viewBoundingBox (const SbBox3f &box, float aspect, float slack)

Detailed Description

The SoPerspectiveCamera class defines a camera node with perspective rendering.

For realistic looking 3D scene, the geometry should be rendered with perspective calculations. Use this camera type to accomplish this.

FILE FORMAT/DEFAULTS:

     PerspectiveCamera {
         viewportMapping ADJUST_CAMERA
         position 0 0 1
         orientation 0 0 1  0
         nearDistance 1
         farDistance 10
         aspectRatio 1
         focalDistance 5
         heightAngle 0.78539819
     }
 
 


 

Constructor & Destructor Documentation

SoPerspectiveCamera::SoPerspectiveCamera (void)Constructor.

References heightAngle.

SoPerspectiveCamera::~SoPerspectiveCamera () [protected, virtual]Destructor.

Member Function Documentation

void SoPerspectiveCamera::initClass (void) [static]Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.

Reimplemented from SoCamera.

References SoNode::VRML1.

void SoPerspectiveCamera::scaleHeight (float scalefactor) [virtual]Scale the SoPerspectiveCamera::heightAngle field by multiplying with scalefactor.

Implements SoCamera.

References heightAngle.

SbViewVolume SoPerspectiveCamera::getViewVolume (float useaspectratio = 0.0f) const [virtual]Returns total view volume covered by the camera under the current settings.

This view volume is not adjusted to account for viewport mapping. If you want the same view volume as the one used during rendering, you should do something like this:

 
 
   SbViewVolume vv;
   float aspectratio = myviewport.getViewportAspectRatio();
 
   switch (camera->viewportMapping.getValue()) {
   case SoCamera::CROP_VIEWPORT_FILL_FRAME:
   case SoCamera::CROP_VIEWPORT_LINE_FRAME:
   case SoCamera::CROP_VIEWPORT_NO_FRAME:
     vv = camera->getViewVolume(0.0f);
     break;
   case SoCamera::ADJUST_CAMERA:
     vv = camera->getViewVolume(aspectratio);
     if (aspectratio < 1.0f) vv.scale(1.0f / aspectratio);
     break;
   case SoCamera::LEAVE_ALONE:
     vv = camera->getViewVolume(0.0f);
     break;
   default:
     assert(0 && "unknown viewport mapping");
     break;
   }
 
   .fi
 
 
 Also, for the CROPPED viewport mappings, the viewport might be changed if the viewport aspect ratio is not equal to the camera aspect ratio. See SoCamera::getView() to see how this is done. 
 
 Implements SoCamera.
 
 References SoCamera::aspectRatio, SoCamera::farDistance, heightAngle, SoCamera::nearDistance, SoCamera::orientation, SbViewVolume::perspective(), SoCamera::position, SbViewVolume::rotateCamera(), and SbViewVolume::translateCamera().
 
 

void SoPerspectiveCamera::viewBoundingBox (const SbBox3f & box, float aspect, float slack) [protected, virtual]Convenience method for setting up the camera definition to cover the given bounding box with the given aspect ratio. Multiplies the exact dimensions with a slack factor to have some space between the rendered model and the borders of the rendering area.

If you define your own camera node class, be aware that this method should not set the orientation field of the camera, only the position, focal distance and near and far clipping planes.

Implements SoCamera.

References SbSphere::circumscribe(), SoCamera::farDistance, SoCamera::focalDistance, SbBox3f::getCenter(), SbSphere::getRadius(), heightAngle, SbBox3f::isEmpty(), SbRotation::multVec(), SoCamera::nearDistance, SbVec3f::normalize(), SoCamera::orientation, SoCamera::position, and SoDebugError::postWarning().

Member Data Documentation

SoSFFloat SoPerspectiveCamera::heightAngleThe vertical angle of the viewport, also known as 'field of view'. Default value is 45° (note: value is specified in radians).

Referenced by getViewVolume(), scaleHeight(), SoPerspectiveCamera(), and viewBoundingBox().

Author

Generated automatically by Doxygen for Coin from the source code.