CUGL
2.0
|
#include <cugl.h>
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) |
![]() | |
BaseCamera () | |
void | setSteps (int s) |
virtual void | update () |
Protected Member Functions | |
void | update (const Point &e, const Point &m) |
Protected Attributes | |
Point | eye |
Point | eyeOld |
Point | eyeNew |
Point | model |
Point | modelOld |
Point | modelNew |
Vector | up |
bool | smooth |
![]() | |
int | steps |
int | maxSteps |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Camera &c) |
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.
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).
Construct a camera for a particular view.
eye | sets the eye coordinates for gluLookAt() . |
model | sets the model coordinates for gluLookAt() . |
up | sets the 'up' vector for gluLookAt() . |
Construct a camera for a particular view. The 'up' vector is set to (0,1,0).
eye | sets the eye coordinates for gluLookAt() . |
model | sets the model coordinates for gluLookAt() . |
|
explicit |
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).
eye | sets the eye coordinates for gluLookAt() . |
|
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.
|
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::moveForward | ( | GLfloat | distance | ) |
Move the camera forwards. The camera moves towards the model.
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.
distance | gives the amount of movement. Negative values move the camera to its right. |
void cugl::Camera::moveUp | ( | GLfloat | distance | ) |
Move the camera upwards (+Y direction).
distance | gives the amount of movement. Negative values move the camera downwards. |
void cugl::Camera::panLeft | ( | double | angle | ) |
Pan the camera to the left.
angle | gives the angle through which the camera should be panned. Negative values give panning to the right. |
Set the camera for a particular view.
eye | sets the eye coordinates for gluLookAt() . |
model | sets the model coordinates for gluLookAt() . |
up | sets the 'up' vector for gluLookAt() . |
Set the camera for a particular view. The 'up' vector is set to (0,1,0).
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).
eye | sets the eye coordinates for gluLookAt() . |
|
inline |
void cugl::Camera::tiltUp | ( | double | angle | ) |
Tilt the camera upwards.
angle | gives the angle through which the camera should be moved. Negative values give a downward tilt. |
Update the camera position.
|
friend |
Write a representation of the camera to a stream. This function displays the current settings of the eye point, the model point, and the up vector.
os | is a reference to an output stream. |
c | is a reference to a camera. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |