Coin Logo https://bitbucket.org/Coin3D/coin/wiki/Home
http://grey.colorado.edu/emergent/index.php/Coin3d

Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions
SoPerspectiveCamera Class Reference

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. More...

#include <Inventor/nodes/SoPerspectiveCamera.h>

Inheritance diagram for SoPerspectiveCamera:
SoCamera SoNode SoFieldContainer SoBase

List of all members.

Public Member Functions

virtual SoType getTypeId (void) const
 Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting.
 SoPerspectiveCamera (void)
virtual void scaleHeight (float scalefactor)
virtual SbViewVolume getViewVolume (float useaspectratio=0.0f) const
virtual void viewBoundingBox (const SbBox3f &box, float aspect, float slack)

Static Public Member Functions

static SoType getClassTypeId (void)
 This static method returns the SoType object associated with objects of this class.
static void initClass (void)
 Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.

Public Attributes

SoSFFloat heightAngle

Protected Member Functions

virtual const SoFieldDatagetFieldData (void) const
virtual ~SoPerspectiveCamera ()

Static Protected Member Functions

static const SoFieldData ** getFieldDataPtr (void)

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

Constructor.

Destructor.


Member Function Documentation

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

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting.

Usage example:

  void foo(SoNode * node)
  {
    if (node->getTypeId() == SoFile::getClassTypeId()) {
      SoFile * filenode = (SoFile *)node;  // safe downward cast, knows the type
    }
  }

For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.

For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.

Reimplemented from SoCamera.

const SoFieldData ** SoPerspectiveCamera::getFieldDataPtr ( void  ) [static, protected]

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.

Reimplemented from SoCamera.

const SoFieldData * SoPerspectiveCamera::getFieldData ( void  ) const [protected, virtual]

Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.

Reimplemented from SoCamera.

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

Scale the SoPerspectiveCamera::heightAngle field by multiplying with scalefactor.

Implements SoCamera.

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 use getViewVolume(SbViewportRegion & vp, const SbMatrix & mm), or 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;
  }

  

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 the SoCamera::getView() source-code (private method) to see how this is done.

Implements SoCamera.

void SoPerspectiveCamera::viewBoundingBox ( const SbBox3f box,
float  aspect,
float  slack 
) [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.


Member Data Documentation

The vertical angle of the viewport, also known as "field of view". Default value is 45 (note: value is specified in radians).


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

Coin3D is Free Software, published under the BSD 3-clause license.

Generated on Mon Dec 16 2013 00:27:49 for Coin by Doxygen 1.7.6.1.