Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Camera Class Reference

Camera class. More...

#include <Camera.h>

Inherits DynamicObject.

Inheritance diagram for Camera:

Inheritance graph
[legend]
Collaboration diagram for Camera:

Collaboration graph
[legend]
List of all members.

Public Methods

 Camera (Vertex3 pos=Vertex3(0.0, 0.0, 0.0), real f=1.0)
 Default constructor. More...

Vertex3getPosition ()
 Returns a reference to the camera position.

QuaterniongetOrientation ()
 Returns a reference to the camera orientation.

real getFov ()
 Returns the camera fov.

void contructOrientation (Vertex3 &up, const Vertex3 &dir)
 Construct a camera frame. More...

void lookAt (Vertex3 &up, const Vertex3 &p)
 Construct a camera lookat frame.

void parseSymbol (Token &t, ObjectFile &file)
 Reads a single parameter sections inside the body of the object description. More...

void writeParams (ostream &stream)
 Writes all parameter sections inside the body of the object description. More...


Protected Types

typedef DynamicObject super

Protected Methods

void createSymbols ()
 Creates all parameter symbols that are used within the body of the object description.


Protected Attributes

real fov
 Camera field of view.

Vertex3 position
 Camera position.

Quaternion orientation
 Camera orientation.


Detailed Description

Camera class.

A camera is defined by its position orientation and field of view. It is used to define a view point from which to render a scene.

Format: (see DynamicObject)

    PARAM ::= POSITION | ORIENTATION | FOV | FRAME | LOOKAT
    POSITION ::= "position" <Vertex3>
    ORIENTATION ::= "" <Quaternion>
    FOV ::= "" <float>
    FRAME ::= "" <Vertex3> <Vertex3>
    LOOKAT ::= "" <Vertex3> <Vertex3>

    Example:
    Camera {
      position (0, 1.5, -5.5);
      lookat (0, 1, 0) (0, 0, 0);
    }
    


Constructor & Destructor Documentation

Camera::Camera Vertex3    pos = Vertex3(0.0, 0.0, 0.0),
real    f = 1.0
 

Default constructor.

Construct a camera with given position and field of view.

Parameters:
pos  Vertex3 position vector.
f  Field of View.
Precondition:
f > 0.0
Postcondition:
The camera orientation is cleared.


Member Function Documentation

void Camera::contructOrientation Vertex3   up,
const Vertex3   dir
 

Construct a camera frame.

Construct the camera orientation given an up vector and camera direction.

Parameters:
up  up-vector or camera y-axis.
dir  direction-vector or camera z-axis.
Precondition:
  • up and dir are normalized vectors.
  • up and dir may not lie on the same line.
Postcondition:
  • The camera orientation is aligned to the input vectors.
  • up is recalculated and is orthogonal to dir.

void Camera::parseSymbol Token   t,
ObjectFile   file
[virtual]
 

Reads a single parameter sections inside the body of the object description.

Each object has a set of parameter names associated with it, called symbols. Symbols are declared inside the createSymbols method. The method parseSymbol expects the Token t to be such a symbol and reads the corresponding parameters. Unknown symbols are passed to its super class.

Parameters:
t  Token that is the current parameter symbol.
file  ObjectFile from which to read.
Precondition:
The file is opened for reading and is positioned just after the parameter name.
Postcondition:
The parameter section is read including the terminating semicolon (';').

Reimplemented from DynamicObject.

void Camera::writeParams ostream &    stream [virtual]
 

Writes all parameter sections inside the body of the object description.

This method writes all object parameters to ostream. Inhereting classes will always call super::writeParams().

Parameters:
stream  ostream to which to write.
Precondition:
stream is opened for writing.
Postcondition:
All object parameters are written.

Reimplemented from DynamicObject.


The documentation for this class was generated from the following files:
This documentation was generated using doxygen. If you have any comments or additions please mail me.