Open Inventor Reference
SoCamera Class Reference

Abstract base class for camera nodes. More...

#include <Inventor/nodes/SoCamera.h>

Inheritance diagram for SoCamera:
SoNode SoFieldContainer SoBase SoOrthographicCamera SoPerspectiveCamera

List of all members.

Public Types

enum  ViewportMapping {
  CROP_VIEWPORT_FILL_FRAME = 0, CROP_VIEWPORT_LINE_FRAME = 1, CROP_VIEWPORT_NO_FRAME = 2, ADJUST_CAMERA = 3,
  LEAVE_ALONE = 4
}
 What will happen if the camera and. More...

Public Member Functions

void pointAt (const 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.
virtual void scaleHeight (float scaleFactor)=0
 Scales the height of the camera.
virtual SbViewVolume getViewVolume (float useAspectRatio=0.0) const =0
 Returns a view volume structure, based on the camera's viewing parameters.
void viewAll (SoNode *sceneRoot, const SbViewportRegion &vpRegion, float slack=1.0)
 Sets the camera up to view the scene under the given node or defined by the given path.
void viewAll (SoPath *path, const SbViewportRegion &vpRegion, float slack=1.0)
SbViewportRegion getViewportBounds (const SbViewportRegion &region) const
 Returns the viewport region this camera would use to render into the given viewport region, accounting for cropping.
virtual void doAction (SoAction *action)
 This method performs the "typical" operation of a node for any action.
virtual void callback (SoCallbackAction *action)
virtual void GLRender (SoGLRenderAction *action)
 These virtual functions implement all of the actions for nodes, Most of the default implementations do nothing.
virtual void getBoundingBox (SoGetBoundingBoxAction *action)
virtual void handleEvent (SoHandleEventAction *action)
virtual void rayPick (SoRayPickAction *action)

Static Public Member Functions

static void initClass ()
 Initializes base node class.

Public Attributes

Fields

NOTE: These fields are here so that all camera subclasses do not have to define them separately.

However, all subclasses DO have to set up field data with these fields in them to make things work properly.

SoSFEnum 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.
SoSFVec3f position
 The location of the camera viewpoint.
SoSFRotation orientation
 The orientation of the camera viewpoint, defined as a rotation of the viewing direction from its default (0,0,-1) vector.
SoSFFloat aspectRatio
 The ratio of camera viewing width to height.
SoSFFloat nearDistance
 Distance from viewpoint to view plane.
SoSFFloat farDistance
 Distance from viewpoint to far clipping plane.
SoSFFloat focalDistance
 The distance from the viewpoint to the point of focus.

Protected Member Functions

 SoCamera ()
 Makes this abstract.
virtual ~SoCamera ()
virtual void viewBoundingBox (const SbBox3f &box, float aspect, float slack)=0
 Subclasses must define this method, which changes the position and clipping planes of a camera to view the passed bounding box using the given aspect ratio, without changing the height scaling.
virtual void jitter (int numPasses, int curPass, const SbViewportRegion &vpReg, SbVec3f &jitterAmount) const
 Returns amount to jitter camera in normalized device coordinates (after projection) for anti-aliasing during multi-pass rendering.

Detailed Description

This is the abstract base class for all camera nodes. It defines the common methods and fields that all cameras have. Cameras are used to view a scene. When a camera is encountered during rendering, it sets the projection and viewing matrices and viewport appropriately; it does not draw geometry. Cameras should be placed before any shape nodes or light nodes in a scene graph; otherwise, those shapes or lights cannot be rendered properly. Cameras are affected by the current transformation, so you can position a camera by placing a transformation node before it in the scene graph . The default position and orientation of a camera is at (0,0,1) looking along the negative z-axis.

You can also use a node kit to create a camera; see the reference page for SoCameraKit.

See Also
SoOrthographicCamera, SoPerspectiveCamera, SoCameraKit

Definition at line 96 of file SoCamera.h.


Member Enumeration Documentation

Enumerator:
CROP_VIEWPORT_FILL_FRAME 

viewport aspect ratios differ?

The first 3 adjust the viewport to fit the camera. Draw filled frame around vp.

CROP_VIEWPORT_LINE_FRAME 

Draw frame in lines.

CROP_VIEWPORT_NO_FRAME 

Draw no frame.

ADJUST_CAMERA 

Adjust camera to fit viewport.

LEAVE_ALONE 

Do nothing.

Camera image may become stretched out of proportion

Definition at line 102 of file SoCamera.h.


Constructor & Destructor Documentation

SoCamera::SoCamera ( ) [protected]
virtual SoCamera::~SoCamera ( ) [protected, virtual]

Member Function Documentation

virtual void SoCamera::callback ( SoCallbackAction action) [virtual]

Reimplemented from SoNode.

virtual void SoCamera::doAction ( SoAction action) [virtual]

The default implementation does nothing.

Reimplemented from SoNode.

virtual void SoCamera::getBoundingBox ( SoGetBoundingBoxAction action) [virtual]

Reimplemented from SoNode.

SbViewportRegion SoCamera::getViewportBounds ( const SbViewportRegion region) const
virtual SbViewVolume SoCamera::getViewVolume ( float  useAspectRatio = 0.0) const [pure virtual]

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

Implemented in SoOrthographicCamera, and SoPerspectiveCamera.

virtual void SoCamera::GLRender ( SoGLRenderAction action) [virtual]

Reimplemented from SoNode.

virtual void SoCamera::handleEvent ( SoHandleEventAction action) [virtual]

Reimplemented from SoNode.

static void SoCamera::initClass ( ) [static]

Reimplemented from SoNode.

Reimplemented in SoOrthographicCamera, and SoPerspectiveCamera.

virtual void SoCamera::jitter ( int  numPasses,
int  curPass,
const SbViewportRegion vpReg,
SbVec3f jitterAmount 
) const [protected, virtual]
void SoCamera::pointAt ( const SbVec3f targetPoint)

If this is not possible, it uses the positive z-axis as "up."

virtual void SoCamera::rayPick ( SoRayPickAction action) [virtual]

Reimplemented from SoNode.

virtual void SoCamera::scaleHeight ( float  scaleFactor) [pure virtual]

Perspective cameras scale their heightAngle fields, and orthographic cameras scale their height fields.

Implemented in SoOrthographicCamera, and SoPerspectiveCamera.

void SoCamera::viewAll ( SoNode sceneRoot,
const SbViewportRegion vpRegion,
float  slack = 1.0 
)

The near and far clipping planes will be positioned 'slack' bounding sphere radii away from the bounding box's center. A value of 1.0 will make the clipping planes the tightest around the bounding sphere.

void SoCamera::viewAll ( SoPath path,
const SbViewportRegion vpRegion,
float  slack = 1.0 
)
virtual void SoCamera::viewBoundingBox ( const SbBox3f box,
float  aspect,
float  slack 
) [protected, pure virtual]

Member Data Documentation

This value must be greater than 0.0. There are several standard camera aspect ratios defined in SoCamera.h.

Definition at line 138 of file SoCamera.h.

Definition at line 142 of file SoCamera.h.

This is typically ignored during rendering, but may be used by some viewers to define a point of interest.

Definition at line 147 of file SoCamera.h.

Definition at line 140 of file SoCamera.h.

Definition at line 133 of file SoCamera.h.

Definition at line 129 of file SoCamera.h.

Definition at line 126 of file SoCamera.h.


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