A
base class that encapsulates behavior of perspective.
Synopsis
#include <AlCamera.h>
class AlCamera : public AlObject
virtual ~AlCamera();
virtual statusCode deleteObject();
virtual AlObject* copyWrapper() const;
virtual AlObjectType type() const;
virtual const char* name() const;
virtual statusCode setName( const char* );
statusCode addImagePlane( const char * );
AlImagePlane* firstImagePlane( void );
statusCode applyIteratorToImagePlanes( AlIterator*, int& );
AlWindow* firstWindow( void );
AlWindow* nextWindow( AlWindow *lastWindow );
statusCode nextWindowD( AlWindow *lastWindow );
statusCode nearClippingPlane( double& ) const;
statusCode farClippingPlane( double& ) const;
statusCode setNearClippingPlane( double );
statusCode setFarClippingPlane( double );
statusCode stereoView(boolean&, double&) const;
statusCode setStereoView(boolean, double);
statusCode motionBlur(boolean&) const;
statusCode setMotionBlur(boolean);
Description
This class represents
all of the functionality of Alias perspective cameras. When
the AlWindow class was developed and it became possible to get and
set the window associated with a camera, it became necessary not
only to provide an interface to orthographic cameras as well, but
also to separate the differences in functionality into two child
classes. The AlCamera class remains as a base class, providing access
to the behavior that all cameras share. In places where AlCameras
were formerly used, it is possible to easily convert old code simply
by substituting AlPerspectiveCamera for AlCamera almost everywhere.
(A few other small modifications may be necessary.)
Any camera can have image
planes attached to it. To create an image plane on a camera, use
the addImagePlane() method.
If a window is associated
with this camera (which will always be the case for orthographic cameras,
but not so for perspective cameras) the firstWindow() function will
return it.
AlCamera::~AlCamera()
Description
Deletes
an AlCamera wrapper object.
AlObject *AlCamera::copyWrapper()
const
Description
Makes
a copy of the AlCamera. The returned AlCamera will reference the
same data as the original.
statusCode AlCamera::deleteObject()
Description
Abstract
base class function, always returns sFailure.
AlObjectType AlCamera::type()
const
Description
Returns
the class identifier ’kCameraType’.
const char* AlCamera::name()
const
Description
Returns
a pointer to this camera’s name.
statusCode AlCamera::setName(
const char *newName )
Description
Changes the camera’s name to the
given name. If the given name is not a unique one, then a unique
name is generated based on the given name and assigned to the camera.
In this case, a status code of sNameChangedToUniqueOne is returned.
A copy of the argument string is made, so you are responsible for
deleting it.
Arguments
< newName - the name
to be given to the camera
Return Codes
sSuccess - successful
sInvalidObject - the
camera is not valid
sInvalidArgument - given
pointer is NULL
statusCode AlCamera::addImagePlane(
const char * fname )
Description
Builds an image from an image file
and attaches it to the camera.
Arguments
fname - the name of the
image to attach to the camera
Return Codes
sSuccess - successful
sInvalidObject - the
camera is not valid
sInvalidArgument - given
pointer is NULL
sFailure - image could
not be built
AlImagePlane* AlCamera::firstImagePlane(
void )
Description
Returns the first image plane attached to this
camera.
statusCode AlCamera::applyIteratorToImagePlanes(
AlIterator* iter, int& rc )
Description
Applies an iterator
to each image that is attached to this camera.
Arguments
iter - the iterator to
apply
> rc - the return
variable for the return value of the last iterator’s application
Return Codes
sSuccess - successful
sInvalidObject - the
camera is not valid
sInvalidArgument - given
pointer is NULL
AlWindow *AlCamera::firstWindow(
void )
Description
Returns
the first window attached to this camera.
AlWindow *AlCamera::nextWindow(
AlWindow *window )
Description
Returns the next window attached
to this camera.
Arguments
< window - the window
from which to walk forward
statusCode AlCamera::nextWindowD(
AlWindow *lastWindow )
Description
Destructively points the given
wrapper to the next window attached to this camera.
Arguments
< lastWindow - the
window from which to walk forward
Return Codes
sSuccess - the wrapper
now points to the next object in the list
sFailure - there is no
next window
sInvalidObject - the
camera is invalid
sInvalidArgument - the
given window is invalid
statusCode AlCamera::nearClippingPlane(
double& ncp ) const
Description
Returns the distance from the
eye position to the near clipping plane.
Arguments
> ncp - return variable
for the distance to the clipping plane
Return Codes
sSuccess - plane was
retrieved
sInvalidObject - the
camera is not valid
statusCode AlCamera::farClippingPlane(
double& fcp ) const
Description
Returns the distance from the
eye position to the far clipping plane.
Arguments
> fcp - return variable
for the distance to the clipping plane
Return Codes
sSuccess - plane was
retrieved
sInvalidObject - the
camera is not valid
statusCode AlCamera::setNearClippingPlane(
double newNearDistance )
Description
Sets the distance between the
eye position to the near clipping plane. The new distance to the
near clipping plane must be SMALLER than the distance to the far
clipping plane.
Arguments
< newNearDistance
- the new distance to the clipping plane
Return Codes
sSuccess - plane was
set
sInvalidArgument - new
near distance was greater than current far distance
sInvalidObject - the
camera is not valid
statusCode AlCamera::setFarClippingPlane(
double newFarDistance)
Description
Sets the distance to the far
clipping plane. The new distance to the far clipping plane must be
larger than the near clipping plane.
Arguments
< double newFarDistance
- the new distance to the clipping plane
Return Codes
sSuccess - plane was
set
sInvalidArgument - new
far distance was less than current near list
sInvalidObject - the
camera is not valid
statusCode AlCamera::stereoView(boolean&
stereoEnabled, double& eyeOffset) const
Description
Returns
the camera stereo view information.
Arguments
> stereoEnabled -
TRUE if stereo view is enabled, FALSE if not
> eyeOffset - ocular
separation
Return Codes
sSuccess - successful
sInvalidObject - the
camera is not valid
statusCode AlCamera::setStereoView(boolean
stereoEnabled, double eyeOffset)
Description
Sets the camera stereo
view information.
Arguments
< stereoEnabled -
TRUE to enable stereo viewing, FALSE to disable it
< eyeOffset - ocular
separation
Return Codes
sSuccess - successful
sInvalidObject - the
camera is not valid
statusCode AlCamera::motionBlur(
boolean& blur) const
Description
Returns the camera motion blur
information.
Arguments
> blur - TRUE if motion
blur is on
Return Codes
sSuccess - successful
sInvalidObject - the
camera is not valid
statusCode AlCamera::setMotionBlur(
boolean blurEnabled )
Description
Sets the camera motion blur information.
Arguments
< blurEnabled - TRUE
to enable motion blur
Return Codes
sSuccess - successful
sInvalidObject - the
camera is not valid