CUGL  2.0
Public Member Functions | Protected Attributes | List of all members
cugl::BaseCamera Class Referenceabstract

#include <cugl.h>

Inheritance diagram for cugl::BaseCamera:
Inheritance graph
[legend]

Public Member Functions

 BaseCamera ()
 
void setSteps (int s)
 
virtual void idle ()=0
 
virtual void apply () const =0
 
virtual void update ()
 

Protected Attributes

int steps
 
int maxSteps
 

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. All derived class must implement at least two virtual functions BaseCamera::idle() which will typically be called in the callback function for glutIdleFunc, i.e. within callback function "idle()" DerivedClass::idle() will be called and later in "main" callback "idle()" will be called as parameter to "glutIdleFunc". void idle() { DerivedClass::idle();} int main() { ... glutIdleFunc(idle); ...} BaseCamera::apply() const. Similarly inside callback function for "glutDisplayFunc", say "display()", DerivedClass::apply() will be called. i.e. void display() { DerivedClass::apply();..} int main(){...glutDisplayFunc(display); ...}

Definition at line 1589 of file cugl.h.

Constructor & Destructor Documentation

cugl::BaseCamera::BaseCamera ( )
inline

Construct an instance of a BaseCamera. This constructor is usually called from a subclass.

Definition at line 1595 of file cugl.h.

Member Function Documentation

virtual void cugl::BaseCamera::apply ( ) const
pure virtual

This function should be called from the GLUT display() function or its equivalent.

Implemented in cugl::Interpolator, and cugl::Camera.

virtual void cugl::BaseCamera::idle ( )
pure virtual

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.

Implemented in cugl::Interpolator, and cugl::Camera.

void cugl::BaseCamera::setSteps ( int  s)
inline

Set the number of steps required for a camera movement.

Parameters
sis the number of steps executed during a movement. s = 10 will give a rapid, possibly jerky, movement. s = 100 will give a slow, smooth movement.

Definition at line 1604 of file cugl.h.

References maxSteps.

virtual void cugl::BaseCamera::update ( )
inlinevirtual

This function is just a suggested wrapper for all derived class for initializations, such as set up first and last position for motions in /c Interpolator, or set up new eye and view parameter for /c Camera. I don't want to force new class to wrap their initialization actions within this function, so, I don't make this method as abstract one. (added by nick)

Reimplemented in cugl::Interpolator.

Definition at line 1631 of file cugl.h.

Member Data Documentation

int cugl::BaseCamera::maxSteps
protected

Maximum number of steps for a smooth movement.

Definition at line 1640 of file cugl.h.

Referenced by setSteps().

int cugl::BaseCamera::steps
protected

Current value of step counter.

Definition at line 1637 of file cugl.h.


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