cugl::Camera Class Reference

#include <cugl.h>

Inheritance diagram for cugl::Camera:

Inheritance graph
[legend]
Collaboration diagram for cugl::Camera:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Camera ()
 Camera (const Point &eye, const Point &model, const Vector &up)
 Camera (const Point &eye, const Point &model)
 Camera (const Point &eye)
void set (const Point &eye, const Point &model, const Vector &up)
void set (const Point &eye, const Point &model)
void set (const Point &eye)
virtual void idle ()
void apply () const
void moveUp (GLfloat distance)
void moveForward (GLfloat distance)
void moveLeft (GLfloat distance)
void tiltUp (double angle)
void panLeft (double angle)
void setMode (bool mode)

Protected Member Functions

void update (Point &e, Point &m)

Protected Attributes

Point eye
Point eyeOld
Point eyeNew
Point model
Point modelOld
Point modelNew
Vector up
bool smooth

Friends

std::ostream & operator<< (std::ostream &os, Camera &c)

Detailed Description

An instance represents a camera. An instance of class Camera is used to control the view. The function Camera::apply() calls gluLookAt() with appropriate parameters. The other functions of this class set up these parameters.

Camera movements may be smooth (interlpolated between end points) or abrupt. The function Camera::setMode() determines the kind of movement. Smooth transitions are obtained by calling Camera::idle() in the GLUT idle callback function, together with the various camera movement functions.

Definition at line 1511 of file cugl.h.


Constructor & Destructor Documentation

cugl::Camera::Camera (  ) 

Construct a default camera. The view is set as follows: Eye = (0,0,1). Model=(0,0,0). Up=(0,1,0).

cugl::Camera::Camera ( const Point eye,
const Point model,
const Vector up 
)

Construct a camera for a particular view.

Parameters:
eye sets the eye coordinates for gluLookAt().
model sets the model coordinates for gluLookAt().
up sets the 'up' vector for gluLookAt().

cugl::Camera::Camera ( const Point eye,
const Point model 
)

Construct a camera for a particular view. The 'up' vector is set to (0,1,0).

Parameters:
eye sets the eye coordinates for gluLookAt().
model sets the model coordinates for gluLookAt().

cugl::Camera::Camera ( const Point eye  ) 

Construct a camera for a particular view. The 'up' vector is set to (0,1,0). The model point is set to (0,0,0).

Parameters:
eye sets the eye coordinates for gluLookAt().


Member Function Documentation

void cugl::Camera::set ( const Point eye,
const Point model,
const Vector up 
)

Set the camera for a particular view.

Parameters:
eye sets the eye coordinates for gluLookAt().
model sets the model coordinates for gluLookAt().
up sets the 'up' vector for gluLookAt().

void cugl::Camera::set ( const Point eye,
const Point model 
)

Set the camera for a particular view. The 'up' vector is set to (0,1,0).

Parameters:
eye sets the eye coordinates for gluLookAt().
model sets the model coordinates for gluLookAt().

void cugl::Camera::set ( const Point eye  ) 

Set the camera for a particular view. The model point is set to (0,0,0). The 'up' vector is set to (0,1,0).

Parameters:
eye sets the eye coordinates for gluLookAt().

virtual void cugl::Camera::idle (  )  [virtual]

Update the camera position. This function should be called from the GLUT idle() function or its equivalent. It performs one step of the motion until the motion is complete, after which it has no effect.

Implements cugl::BaseCamera.

void cugl::Camera::apply (  )  const [virtual]

Apply the camera position to the model-view matrix. This function calls gluLookAt() with appropriate parameters. It should be called in the GLUT display function or its equivalent after the model-view matrix has been initialized.

Implements cugl::BaseCamera.

void cugl::Camera::moveUp ( GLfloat  distance  ) 

Move the camera upwards (+Y direction).

Parameters:
distance gives the amount of movement. Negative values move the camera downwards.

void cugl::Camera::moveForward ( GLfloat  distance  ) 

Move the camera forwards. The camera moves towards the model.

Parameters:
distance gives the amount of movement. Negative values move the camera away from the model..

void cugl::Camera::moveLeft ( GLfloat  distance  ) 

Move the camera to its left.

Parameters:
distance gives the amount of movement. Negative values move the camera to its right.

void cugl::Camera::tiltUp ( double  angle  ) 

Tilt the camera upwards.

Parameters:
angle gives the angle through which the camera should be moved. Negative values give a downward tilt.

void cugl::Camera::panLeft ( double  angle  ) 

Pan the camera to the left.

Parameters:
angle gives the angle through which the camera should be panned. Negative values give panning to the right.

void cugl::Camera::setMode ( bool  mode  )  [inline]

Set the kind of motion required.

Parameters:
mode should be set to true for smooth movements or to false for abrupt movements.

Definition at line 1639 of file cugl.h.

References smooth.

void cugl::Camera::update ( Point e,
Point m 
) [protected]

Update the camera position.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
Camera c 
) [friend]

Write a textul representation of the camera's status.

Parameters:
os is the stream to which the desccription will be written.
c is a camera.


Member Data Documentation

Point cugl::Camera::eye [protected]

Eye coordinates for gluLookAt().

Definition at line 1656 of file cugl.h.

Point cugl::Camera::eyeOld [protected]

Previous eye coordinates.

Definition at line 1659 of file cugl.h.

Point cugl::Camera::eyeNew [protected]

Updated eye coordinates.

Definition at line 1662 of file cugl.h.

Point cugl::Camera::model [protected]

Model coordinates for gluLookAt()

Definition at line 1666 of file cugl.h.

Point cugl::Camera::modelOld [protected]

Previous model coordinates

Definition at line 1669 of file cugl.h.

Point cugl::Camera::modelNew [protected]

Updated model coordinates

Definition at line 1672 of file cugl.h.

Vector cugl::Camera::up [protected]

Up vector for gluLookAt()

Definition at line 1675 of file cugl.h.

bool cugl::Camera::smooth [protected]

Mode for motion

Definition at line 1678 of file cugl.h.

Referenced by setMode().


The documentation for this class was generated from the following file:
Generated on Wed Sep 12 14:31:42 2007 for CUGL by  doxygen 1.5.2