Camera Class Reference

Basic class for all cameras. More...

#include <Camera.h>

Inheritance diagram for Camera:

Object3d ViewObject Object OrbitCamera

List of all members.

Public Member Functions

 Camera ()
 Constructor.
 Camera (const Camera &camera)
 Copy constructor.
void setFocusDistance (const GLfloat &distance)
 Setter for distanceToTarget.
GLfloat getFocusDistance ()
 Getter for distanceToTarget.
void setUp (const Vector &up)
 Setter for up-Vector.
void setNear (const GLfloat &near)
 Setter for near plane distance.
GLfloat getNear ()
 Getter for near plane distance.
void setFar (const GLfloat &far)
 Setter for far plane distance.
GLfloat getFar ()
 Getter for far plane distance.
void setFovy (const Angle &fovy)
 Setter for camera opening angle.
AnglegetFovy ()
 Getter for camera opening angle.
void setLensShift (const GLfloat &lensShift)
 Setter for lens shift (z-shift of the cam).
GLfloat getMaximumBackShift (const GLfloat &maxSizeOfBlur)
 Getter for maximum lens back-shift.
GLfloat getMaximumForwardShift (const GLfloat &maxSizeOfBlur)
 Getter for maximum lens forward-shift.
void setTarget (const Vector &target, const bool &adjustFocus)
 Sets a target to look at.
const VectorgetTarget ()
 Getter for virtual target.
void setAzimuth (const Angle &azimuth)
 Sets the azimuth of the camera.
const AnglegetAzimuth ()
 Getter for azimuth.
void setElevation (const Angle &elevation)
 Sets the elevation of the camera.
const AnglegetElevation ()
 Getter for elevation.
void setOrbitDistance (const GLfloat &distance)
 Setter for orbit distance.
GLfloat getOrbitDistance ()
 Getter for orbit distance.
void renderGl ()
 The specific OpenGL commands for renderGL.
void selectGl ()
 Not needed for cameras.
void projectGl (const GLint &width, const GLint &height, const GLfloat &pixelRatio)
 Set up a projection for the given width and height.
virtual string toString () const
 Returns a textual representation.
virtual string className () const
 Returns the class name of the object.
virtual enum classId classId () const
 Returns the class id of the object.

Private Member Functions

GLfloat getHalfSizeNearPlane ()
 Getter for half size of near plane (y-axis).
GLfloat getHalfSizeFocusPlane ()
 Getter for half size of focus plane (y-axis).
GLfloat getHalfSizeFarPlane ()
 Getter for half size of far plane (y-axis).

Private Attributes

GLfloat focusDistance
 The presumed distance to the rotation center and focal point.
GLfloat nearP
 The distance to the near plane.
GLfloat farP
 The distance to the far plane.
Angle fovy
 The opening angle (fovy).
Vector up
 The up-vector.
GLfloat lensShift
 lens shift for DoF-Effect


Detailed Description

Basic class for all cameras.

Constructor & Destructor Documentation

Camera::Camera (  ) 

Constructor.

The camera will be initialized with the following values: Position (0,0,0), focal distance 1, up-vector (0, 1, 0), near 1 and far 100. The camara will be looking along the negative z-axis. The opening in y-direction is 45.0°.

Camera::Camera ( const Camera camera  ) 

Copy constructor.


Member Function Documentation

GLfloat Camera::getHalfSizeNearPlane (  )  [private]

Getter for half size of near plane (y-axis).

GLfloat Camera::getHalfSizeFocusPlane (  )  [private]

Getter for half size of focus plane (y-axis).

GLfloat Camera::getHalfSizeFarPlane (  )  [private]

Getter for half size of far plane (y-axis).

void Camera::setFocusDistance ( const GLfloat &  distance  ) 

Setter for distanceToTarget.

Setter for focus distance.

GLfloat Camera::getFocusDistance (  ) 

Getter for distanceToTarget.

Getter for focus distance.

void Camera::setUp ( const Vector up  ) 

Setter for up-Vector.

Setter for upVector.

void Camera::setNear ( const GLfloat &  near  ) 

Setter for near plane distance.

GLfloat Camera::getNear (  ) 

Getter for near plane distance.

void Camera::setFar ( const GLfloat &  far  ) 

Setter for far plane distance.

GLfloat Camera::getFar (  ) 

Getter for far plane distance.

void Camera::setFovy ( const Angle fovy  ) 

Setter for camera opening angle.

Angle & Camera::getFovy (  ) 

Getter for camera opening angle.

void Camera::setLensShift ( const GLfloat &  lensShift  ) 

Setter for lens shift (z-shift of the cam).

The parameter defines a deviation from the actual position of the camera. If the camera is shifted, for projection the fovy will modified, so that the slice of the viewing frustum defined by focusDistance (the focus plane) stays the same size.

Parameters:
lensShift Negative values move the camera in, positive values move the camera out.

GLfloat Camera::getMaximumBackShift ( const GLfloat &  maxSizeOfBlur  ) 

Getter for maximum lens back-shift.

Parameters:
maxSizeOfBlur The maximum bluring in y-direction measured in one tenth of a percent (relative to screen resolution).
Returns:
A positive value, if back shifting is possible

GLfloat Camera::getMaximumForwardShift ( const GLfloat &  maxSizeOfBlur  ) 

Getter for maximum lens forward-shift.

Parameters:
maxSizeOfBlur The maximum bluring in y-direction measured in one tenth of a percent (relative to screen resolution).
Returns:
A negative value, if forward shifting is possible

void Camera::setTarget ( const Vector target,
const bool &  adjustFocus 
)

Sets a target to look at.

Changes Yaw and Pitch of the Camera in order for it to point to a specific target.

Parameters:
target The Point in 3-space the cam shall look at
adjustFocus If set to true the focus of the camera will be changed to meet the target distance.

const Vector & Camera::getTarget (  ) 

Getter for virtual target.

Returns:
the focal point the camera is looking at

void Camera::setAzimuth ( const Angle azimuth  ) 

Sets the azimuth of the camera.

Rotates camera arount the current target. Azimuth is measured counter clock wise with 0.0 when camera is looking down the negative Z axis.

Parameters:
azimuth the camera's new azimuth

const Angle & Camera::getAzimuth (  ) 

Getter for azimuth.

Azimuth is measured counter clock wise with 0.0 when camera is looking down the negative Z axis.

Returns:
the camera's azimuth

void Camera::setElevation ( const Angle elevation  ) 

Sets the elevation of the camera.

Rotates camera arount the current target. Elevation has 0.0 when camera is aligned with x/z-plane, positive when looking down.

Parameters:
elevation the new elevation

const Angle & Camera::getElevation (  ) 

Getter for elevation.

Elevation has 0.0 when camera is aligned with x/z-plane, positive when looking down.

Returns:
the camera's elevation

void Camera::setOrbitDistance ( const GLfloat &  distance  ) 

Setter for orbit distance.

Sets the orbiting distance to the rotation center. Changes the focus as well /param distance the new camera-target distance

GLfloat Camera::getOrbitDistance (  ) 

Getter for orbit distance.

Getter for orbiting distance to the rotation center.

Returns:
the distance eye-target

void Camera::renderGl (  )  [virtual]

The specific OpenGL commands for renderGL.

The specific OpenGL commands for paintGL.

Implements Object3d.

void Camera::selectGl (  )  [virtual]

Not needed for cameras.

Not needed for cameras

Implements Object3d.

void Camera::projectGl ( const GLint &  width,
const GLint &  height,
const GLfloat &  pixelRatio 
)

Set up a projection for the given width and height.

Parameters:
width The width of the OpenGL viewport
height The height of the OpenGL viewport
pixelAspect The target ratio width/height of a pixel on the screen (e.g. use 1.2 for streching 4:3 resolutions to 16:10 widescreen)

string Camera::toString (  )  const [virtual]

Returns a textual representation.

Returns:
a string descriping the run-time object

Reimplemented from Object3d.

Reimplemented in OrbitCamera.

string Camera::className (  )  const [virtual]

Returns the class name of the object.

Returns:
a string with the name of the object's class

Reimplemented from Object3d.

Reimplemented in OrbitCamera.

enum classId Camera::classId (  )  const [virtual]

Returns the class id of the object.

Returns:
an id of the object's class

Reimplemented from Object3d.

Reimplemented in OrbitCamera.


Member Data Documentation

GLfloat Camera::focusDistance [private]

The presumed distance to the rotation center and focal point.

GLfloat Camera::nearP [private]

The distance to the near plane.

GLfloat Camera::farP [private]

The distance to the far plane.

Angle Camera::fovy [private]

The opening angle (fovy).

Vector Camera::up [private]

The up-vector.

GLfloat Camera::lensShift [private]

lens shift for DoF-Effect


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

Generated on Mon Jul 7 13:30:33 2008 for Firefly by  doxygen 1.5.6