![]() |
http://www.sim.no http://www.coin3d.org |
The SoFrustumCamera class defines a camera with a generic frustum.. More...
#include <Inventor/nodes/SoFrustumCamera.h>
Public Member Functions | |
SoFrustumCamera (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 | left |
SoSFFloat | right |
SoSFFloat | top |
SoSFFloat | bottom |
Protected Member Functions | |
virtual | ~SoFrustumCamera () |
virtual void | viewBoundingBox (const SbBox3f &box, float aspect, float slack) |
The SoFrustumCamera class defines a camera with a generic frustum..
The SoFrustumCamera class makes it possible to specify a frustum in the same manner as the OpenGL glFrustum() function. It has four new fields (left, right, top, bottom), and will use SoCamera::nearDistance and SoCamera::farDistance for the two last glFrustum() parameters.
This camera can be useful in applications that require full control over the view frustum, such as in CAVE or other multipipe applications.
SoFrustumCamera::~SoFrustumCamera | ( | void | ) | [protected, virtual] |
Destructor.
void SoFrustumCamera::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.
void SoFrustumCamera::scaleHeight | ( | float | scalefactor | ) | [virtual] |
SbViewVolume SoFrustumCamera::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; }
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 bottom, SoCamera::farDistance, SbViewVolume::frustum(), left, SoCamera::nearDistance, SoCamera::orientation, SoCamera::position, right, SbViewVolume::rotateCamera(), top, and SbViewVolume::translateCamera().
void SoFrustumCamera::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 bottom, SbSphere::circumscribe(), SbVec3f::dot(), SoCamera::farDistance, SoCamera::focalDistance, SbBox3f::getCenter(), SbSphere::getRadius(), SbBox3f::isEmpty(), SbRotation::multVec(), SoCamera::nearDistance, SbVec3f::normalize(), SoCamera::orientation, SoCamera::position, SoDebugError::postWarning(), and top.
The left clipping plane position. Default value is -0.5.
Referenced by getViewVolume(), and SoFrustumCamera().
The right clipping plane position. Default value is 0.5
Referenced by getViewVolume(), and SoFrustumCamera().
The top clipping plane position. Default value is 0.5.
Referenced by getViewVolume(), scaleHeight(), SoFrustumCamera(), and viewBoundingBox().
The bottom clipping plane position. Default value is -0.5.
Referenced by getViewVolume(), scaleHeight(), SoFrustumCamera(), and viewBoundingBox().
Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.
Generated on Mon Feb 28 2011 10:12:12 for Coin by Doxygen. 1.7.3