Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuPerspectiveCamera Class Reference

creates a camera for perpective projection More...

#include <vuPerspectiveCamera.h>

Inheritance diagram for vuPerspectiveCamera:

Inheritance graph
[legend]
Collaboration diagram for vuPerspectiveCamera:

Collaboration graph
[legend]
List of all members.

Public Member Functions

vuCameraType getType (void)
 vuPerspectiveCamera ()
 Default constructor - set initial values.
 vuPerspectiveCamera (const vuPerspectiveCamera &c)
 Copy constructor.
virtual ~vuPerspectiveCamera ()
 Destructor.
float getFOV (void)
 Get the field of view.
void setFOV (const float fov)
 Set the field of view.
float getAspect (void)
 Get the aspect ratio.
void setAspect (const float aspect)
 Set the aspect ratio.
vuVector getTopLeft (void)
void setTopLeft (vuVector &temp)
 thrown in for consistency, calls init () and ignores temp;
vuVector getXStep (void)
void setXStep (vuVector &temp)
vuVector getYStep (void)
void setYStep (vuVector &temp)
void init (void)
 Initialize the camera for the current position.
void glInit ()
 setup perpective projection for OpenGL according to the settings of the camera
vuRay getRay (float xpixel, float ypixel)
 Get the ray through pixel (xpixel, ypixel).
virtual void TakeSnapShot ()
 this will save the current state of the camera to the open file that is being recorded to
virtual void TakeSnapShot (char *Shot)
 This will save the current state of the camera to the string to Shot Shot.
void TakeSnapShotPersp (char *Shot)
 this will save a persective snapshot, ie, the members of perspective camera that are not data members of a basic camera.
virtual int RestoreShot (char *Shot)
 This will take the snapshot contained in Shot and will restore it to the screen.
int RestoreShotPersp (char *Shot)
 this will restore the extra members associated with the perspective camera over the basic camera
virtual int RestoreNextShot ()
 This Will take the next line from the loaded file and set this camera equal to the state preserved therein.
virtual int RestorePreviousShot ()
 This Will take the Previous line from the loaded file and set this camera equal to the state preserved therein.
virtual char * get_id ()
 This will return a ptr to a copy of the appropriate header for a perspective camera with this type of data to prevent situations like a parallel camera attempting to load a perspective camera's data, which inherently cannot work.
virtual bool verify_id (char *id)
 This will return whether or not id equals get_id () (ie, whether or not id is an appropriate file header for a perspective camera).
virtual vuPerspectiveCameraoperator= (const vuPerspectiveCamera &rhs)
 Assignment operator.
virtual vuCameracreate_new ()
 This will create a new perspective camera and return a pointer to it cast as a vuCamera pointer.
virtual vuCameraoperator * (float t)
 Multiplication Operator,.
virtual vuCameraoperator *= (float t)
 Multiplication/Assignment operator,.
virtual vuCameraoperator+ (vuPerspectiveCamera &rhs)
 Addition Operator,.
virtual vuCameraoperator+= (vuPerspectiveCamera &rhs)
 Addition/Assignment Operator,.
virtual vuCameraoperator+ (vuPerspectiveCamera *rhs)
 Addition Operator,.
virtual vuCameraoperator+= (vuPerspectiveCamera *rhs)
 Addition/Assignment Operator,.
virtual vuPerspectiveCameraoperator= (vuPerspectiveCamera *rhs)
 Assignment operator,.
virtual void set_defaults ()
 This function will restore this camera to it's default value.
virtual vuCameraset_equal_to_interp (vuCamera *cam1, vuCamera *cam2, float t1, float t2)

Protected Attributes

float m_FOV
 Field of view.
float m_Aspect
 Aspect ratio.
vuVector m_TopLeft
 Top left of viewing frustum.
vuVector m_XStep
 Distance between adjacent x pixels.
vuVector m_YStep
 Distance between adjacent y pixels.

Friends

ostream & operator<< (ostream &out, vuPerspectiveCamera &cam)
 this will store the data of camera to a string and pass that string to the streeam 'in'
istream & operator>> (istream &in, vuPerspectiveCamera &cam)
 This will write restore cam to the state that is passed in by in.
vuCameraoperator * (float t, vuPerspectiveCamera &cam)
 Multiplication operator,.

Detailed Description

creates a camera for perpective projection

This class extends the standard vuCamera with features for a creating vuRay instances for a specific position.

Definition at line 43 of file vuPerspectiveCamera.h.


Constructor & Destructor Documentation

vuPerspectiveCamera::vuPerspectiveCamera  ) 
 

Default constructor - set initial values.

Definition at line 23 of file vuPerspectiveCamera.cpp.

vuPerspectiveCamera::vuPerspectiveCamera const vuPerspectiveCamera c  ) 
 

Copy constructor.

This will copy all of the data related to the state of the camera

for safety, if camera c is recording to or has any files loaded, these files will not carry into the newly created camera

Definition at line 53 of file vuPerspectiveCamera.cpp.

References m_Aspect, m_FOV, vuCamera::m_Height, vuCamera::m_LookAtVector, vuCamera::m_Position, vuCamera::m_RightVector, m_TopLeft, vuCamera::m_UpVector, vuCamera::m_Width, m_XStep, and m_YStep.

vuPerspectiveCamera::~vuPerspectiveCamera  )  [virtual]
 

Destructor.

Definition at line 75 of file vuPerspectiveCamera.cpp.

References vuCamera::clear_lines().

Here is the call graph for this function:


Member Function Documentation

vuCamera * vuPerspectiveCamera::create_new  )  [virtual]
 

This will create a new perspective camera and return a pointer to it cast as a vuCamera pointer.

This is so that I can use the camera in vuKeyFramerDialog without concern as to what type of camera this points to (ie, it's easier to program for later).

Reimplemented from vuCamera.

Definition at line 423 of file vuPerspectiveCamera.cpp.

Referenced by operator *(), operator *(), and operator+().

char * vuPerspectiveCamera::get_id  )  [virtual]
 

This will return a ptr to a copy of the appropriate header for a perspective camera with this type of data to prevent situations like a parallel camera attempting to load a perspective camera's data, which inherently cannot work.

Reimplemented from vuCamera.

Definition at line 385 of file vuPerspectiveCamera.cpp.

Referenced by verify_id().

float vuPerspectiveCamera::getAspect void   ) 
 

Get the aspect ratio.

Definition at line 95 of file vuPerspectiveCamera.cpp.

Referenced by operator+(), and operator+=().

float vuPerspectiveCamera::getFOV void   ) 
 

Get the field of view.

Definition at line 81 of file vuPerspectiveCamera.cpp.

Referenced by operator+(), and operator+=().

vuRay vuPerspectiveCamera::getRay float  xpixel,
float  ypixel
[virtual]
 

Get the ray through pixel (xpixel, ypixel).

Reimplemented from vuCamera.

Definition at line 193 of file vuPerspectiveCamera.cpp.

References vuRay::m_Direction, vuRay::m_Position, m_TopLeft, m_XStep, and m_YStep.

vuVector vuPerspectiveCamera::getTopLeft void   ) 
 

Definition at line 108 of file vuPerspectiveCamera.cpp.

vuCameraType vuPerspectiveCamera::getType void   )  [inline, virtual]
 

Reimplemented from vuCamera.

Definition at line 46 of file vuPerspectiveCamera.h.

vuVector vuPerspectiveCamera::getXStep void   ) 
 

Definition at line 122 of file vuPerspectiveCamera.cpp.

vuVector vuPerspectiveCamera::getYStep void   ) 
 

Definition at line 136 of file vuPerspectiveCamera.cpp.

void vuPerspectiveCamera::glInit  )  [virtual]
 

setup perpective projection for OpenGL according to the settings of the camera

Reimplemented from vuCamera.

Definition at line 228 of file vuPerspectiveCamera.cpp.

void vuPerspectiveCamera::init void   )  [virtual]
 

Initialize the camera for the current position.

This function has to be called everytime the position or orientation of the camera changes. We may can integrate this into wrapped setPosition... functions.

Reimplemented from vuCamera.

Definition at line 154 of file vuPerspectiveCamera.cpp.

References vuVector::cross, m_FOV, M_PI, m_TopLeft, m_XStep, m_YStep, vuVector::makeUnit(), and vuVector::norm().

Referenced by operator *(), operator *(), operator *=(), operator+(), operator+=(), setTopLeft(), setXStep(), and setYStep().

Here is the call graph for this function:

vuCamera * vuPerspectiveCamera::operator * float  t  )  [virtual]
 

Multiplication Operator,.

This will multiply each component of this camera by t and will create a new camera to store the result and will return a pointer to that camera.

Reimplemented from vuCamera.

Definition at line 433 of file vuPerspectiveCamera.cpp.

References create_new(), init(), m_Aspect, m_FOV, setAspect(), setFOV(), vuCamera::setHeight(), vuCamera::setLookAtVector(), vuCamera::setPosition(), vuCamera::setUpVector(), vuCamera::setWidth(), and temp_cam_vpc_cgs__.

Here is the call graph for this function:

vuCamera * vuPerspectiveCamera::operator *= float  t  )  [virtual]
 

Multiplication/Assignment operator,.

This will multiply each component of this camera by t and return a pointer to this camera.

Reimplemented from vuCamera.

Definition at line 458 of file vuPerspectiveCamera.cpp.

References init(), m_Aspect, m_FOV, setAspect(), setFOV(), vuCamera::setHeight(), vuCamera::setLookAtVector(), vuCamera::setPosition(), vuCamera::setUpVector(), and vuCamera::setWidth().

Here is the call graph for this function:

vuCamera * vuPerspectiveCamera::operator+ vuPerspectiveCamera rhs  )  [virtual]
 

Addition Operator,.

This will add each component of the camera pointed to by rhs with the component of this. It will then return a pointer to the camera storing the result (cast as a vuCamera pointer).

Note that this method will create the camera which will store the result.

Definition at line 558 of file vuPerspectiveCamera.cpp.

References create_new(), getAspect(), getFOV(), vuCamera::getHeight(), vuCamera::getLookAtVector(), vuCamera::getPosition(), vuCamera::getUpVector(), vuCamera::getWidth(), init(), m_Aspect, m_FOV, setAspect(), setFOV(), vuCamera::setHeight(), vuCamera::setLookAtVector(), vuCamera::setPosition(), vuCamera::setUpVector(), vuCamera::setWidth(), and temp_cam_vpc_cgs__.

Here is the call graph for this function:

vuCamera * vuPerspectiveCamera::operator+ vuPerspectiveCamera rhs  )  [virtual]
 

Addition Operator,.

This will add each component of this camera to each component of rhs and store the result in a camera that it creates. It will then return a pointer to the camera which it created in order to store the result.

Definition at line 510 of file vuPerspectiveCamera.cpp.

References create_new(), getAspect(), getFOV(), vuCamera::getHeight(), vuCamera::getLookAtVector(), vuCamera::getPosition(), vuCamera::getUpVector(), vuCamera::getWidth(), init(), m_Aspect, m_FOV, setAspect(), setFOV(), vuCamera::setHeight(), vuCamera::setLookAtVector(), vuCamera::setPosition(), vuCamera::setUpVector(), vuCamera::setWidth(), and temp_cam_vpc_cgs__.

Here is the call graph for this function:

vuCamera * vuPerspectiveCamera::operator+= vuPerspectiveCamera rhs  )  [virtual]
 

Addition/Assignment Operator,.

This will perform a componentwise addition of the camera pointed to by rhs and return a pointer to this camera.

Definition at line 583 of file vuPerspectiveCamera.cpp.

References getAspect(), getFOV(), vuCamera::getHeight(), vuCamera::getLookAtVector(), vuCamera::getPosition(), vuCamera::getUpVector(), vuCamera::getWidth(), init(), m_Aspect, m_FOV, setAspect(), setFOV(), vuCamera::setHeight(), vuCamera::setLookAtVector(), vuCamera::setPosition(), vuCamera::setUpVector(), and vuCamera::setWidth().

Here is the call graph for this function:

vuCamera * vuPerspectiveCamera::operator+= vuPerspectiveCamera rhs  )  [virtual]
 

Addition/Assignment Operator,.

This will add each component of rhs to this camera and will then return a pointer to this camera.

Definition at line 535 of file vuPerspectiveCamera.cpp.

References getAspect(), getFOV(), vuCamera::getHeight(), vuCamera::getLookAtVector(), vuCamera::getPosition(), vuCamera::getUpVector(), vuCamera::getWidth(), init(), m_Aspect, m_FOV, setAspect(), setFOV(), vuCamera::setHeight(), vuCamera::setLookAtVector(), vuCamera::setPosition(), vuCamera::setUpVector(), and vuCamera::setWidth().

Here is the call graph for this function:

vuPerspectiveCamera * vuPerspectiveCamera::operator= vuPerspectiveCamera rhs  )  [virtual]
 

Assignment operator,.

This will assign each component of the camera pointed to by rhs to this camera.

Definition at line 606 of file vuPerspectiveCamera.cpp.

References m_Aspect, m_FOV, vuCamera::m_Height, vuCamera::m_LookAtVector, vuCamera::m_Position, vuCamera::m_RightVector, m_TopLeft, vuCamera::m_UpVector, vuCamera::m_Width, m_XStep, and m_YStep.

vuPerspectiveCamera & vuPerspectiveCamera::operator= const vuPerspectiveCamera rhs  )  [virtual]
 

Assignment operator.

Definition at line 205 of file vuPerspectiveCamera.cpp.

References m_Aspect, m_FOV, vuCamera::m_Height, vuCamera::m_LookAtVector, vuCamera::m_Position, vuCamera::m_RightVector, m_TopLeft, vuCamera::m_UpVector, vuCamera::m_Width, m_XStep, and m_YStep.

int vuPerspectiveCamera::RestoreNextShot  )  [virtual]
 

This Will take the next line from the loaded file and set this camera equal to the state preserved therein.

Please refer to the comments surrounding bool vuCamera::load (char* filename); for a complete description Please refer to virtual int vuCamera::RestoreNextShot () for a complete description.

Reimplemented from vuCamera.

Definition at line 347 of file vuPerspectiveCamera.cpp.

References get_next_comma(), vuCamera::IsNextAvailable(), vuCamera::RestoreShotBasic(), and RestoreShotPersp().

Here is the call graph for this function:

int vuPerspectiveCamera::RestorePreviousShot  )  [virtual]
 

This Will take the Previous line from the loaded file and set this camera equal to the state preserved therein.

Please refer to the comments surrounding bool vuCamera::load (char* filename); for a complete description Please refer to virtual int vuCamera::RestorePreviousShot () for a complete description.

Reimplemented from vuCamera.

Definition at line 366 of file vuPerspectiveCamera.cpp.

References get_next_comma(), vuCamera::IsPreviousAvailable(), vuCamera::RestoreShotBasic(), and RestoreShotPersp().

Here is the call graph for this function:

int vuPerspectiveCamera::RestoreShot char *  Shot  )  [virtual]
 

This will take the snapshot contained in Shot and will restore it to the screen.

Reimplemented from vuCamera.

Definition at line 297 of file vuPerspectiveCamera.cpp.

References get_next_comma(), vuCamera::RestoreShotBasic(), and RestoreShotPersp().

Referenced by operator>>().

Here is the call graph for this function:

int vuPerspectiveCamera::RestoreShotPersp char *  Shot  ) 
 

this will restore the extra members associated with the perspective camera over the basic camera

Definition at line 307 of file vuPerspectiveCamera.cpp.

References clear_blanks(), get_next_close(), get_next_comma(), get_next_open(), vuVector::load(), m_Aspect, m_FOV, m_TopLeft, m_XStep, and m_YStep.

Referenced by RestoreNextShot(), RestorePreviousShot(), and RestoreShot().

Here is the call graph for this function:

void vuPerspectiveCamera::set_defaults  )  [virtual]
 

This function will restore this camera to it's default value.

Reimplemented from vuCamera.

Definition at line 37 of file vuPerspectiveCamera.cpp.

vuCamera * vuPerspectiveCamera::set_equal_to_interp vuCamera cam1,
vuCamera cam2,
float  t1,
float  t2
[virtual]
 

Reimplemented from vuCamera.

Definition at line 629 of file vuPerspectiveCamera.cpp.

References m_Aspect, m_FOV, vuCamera::m_Height, vuCamera::m_LookAtVector, vuCamera::m_Position, vuCamera::m_RightVector, m_TopLeft, vuCamera::m_UpVector, vuCamera::m_Width, m_XStep, and m_YStep.

void vuPerspectiveCamera::setAspect const float  aspect  ) 
 

Set the aspect ratio.

Definition at line 101 of file vuPerspectiveCamera.cpp.

References m_Aspect.

Referenced by operator *(), operator *(), operator *=(), operator+(), operator+=(), vu1512113::setImageSize(), vu1112113::setImageSize(), and vu1512122::setImageSize().

void vuPerspectiveCamera::setFOV const float  fov  ) 
 

Set the field of view.

Definition at line 87 of file vuPerspectiveCamera.cpp.

References m_FOV.

Referenced by operator *(), operator *(), operator *=(), operator+(), and operator+=().

void vuPerspectiveCamera::setTopLeft vuVector temp  ) 
 

thrown in for consistency, calls init () and ignores temp;

Definition at line 114 of file vuPerspectiveCamera.cpp.

References init().

Here is the call graph for this function:

void vuPerspectiveCamera::setXStep vuVector temp  ) 
 

Definition at line 128 of file vuPerspectiveCamera.cpp.

References init().

Here is the call graph for this function:

void vuPerspectiveCamera::setYStep vuVector temp  ) 
 

Definition at line 142 of file vuPerspectiveCamera.cpp.

References init().

Here is the call graph for this function:

void vuPerspectiveCamera::TakeSnapShot char *  Shot  )  [virtual]
 

This will save the current state of the camera to the string to Shot Shot.

Reimplemented from vuCamera.

Definition at line 249 of file vuPerspectiveCamera.cpp.

References vuCamera::TakeSnapShotBasic(), and TakeSnapShotPersp().

Here is the call graph for this function:

void vuPerspectiveCamera::TakeSnapShot  )  [virtual]
 

this will save the current state of the camera to the open file that is being recorded to

Reimplemented from vuCamera.

Definition at line 235 of file vuPerspectiveCamera.cpp.

Referenced by operator<<().

void vuPerspectiveCamera::TakeSnapShotPersp char *  Shot  ) 
 

this will save a persective snapshot, ie, the members of perspective camera that are not data members of a basic camera.

Definition at line 262 of file vuPerspectiveCamera.cpp.

References m_Aspect, m_FOV, m_TopLeft, m_XStep, m_YStep, and vuVector::save().

Referenced by TakeSnapShot().

Here is the call graph for this function:

bool vuPerspectiveCamera::verify_id char *  id  )  [virtual]
 

This will return whether or not id equals get_id () (ie, whether or not id is an appropriate file header for a perspective camera).

NB, must be overridden in derived classes if any data is added or changed

Returns:
true if id is a proper file header for this type of data, false otherwise

Reimplemented from vuCamera.

Definition at line 391 of file vuPerspectiveCamera.cpp.

References get_id().

Here is the call graph for this function:


Friends And Related Function Documentation

vuCamera* operator * float  t,
vuPerspectiveCamera cam
[friend]
 

Multiplication operator,.

This will multiply each component of cam by t and create a new camera to store the result in. It will return a pointer to the camera that stores the result.

Definition at line 485 of file vuPerspectiveCamera.cpp.

ostream& operator<< ostream &  out,
vuPerspectiveCamera cam
[friend]
 

this will store the data of camera to a string and pass that string to the streeam 'in'

Definition at line 397 of file vuPerspectiveCamera.cpp.

istream& operator>> istream &  in,
vuPerspectiveCamera cam
[friend]
 

This will write restore cam to the state that is passed in by in.

Definition at line 411 of file vuPerspectiveCamera.cpp.


Member Data Documentation

float vuPerspectiveCamera::m_Aspect [protected]
 

Aspect ratio.

Definition at line 199 of file vuPerspectiveCamera.h.

Referenced by operator *(), operator *(), operator *=(), operator+(), operator+=(), operator=(), RestoreShotPersp(), set_equal_to_interp(), setAspect(), TakeSnapShotPersp(), and vuPerspectiveCamera().

float vuPerspectiveCamera::m_FOV [protected]
 

Field of view.

Definition at line 198 of file vuPerspectiveCamera.h.

Referenced by init(), operator *(), operator *(), operator *=(), operator+(), operator+=(), operator=(), RestoreShotPersp(), set_equal_to_interp(), setFOV(), TakeSnapShotPersp(), and vuPerspectiveCamera().

vuVector vuPerspectiveCamera::m_TopLeft [protected]
 

Top left of viewing frustum.

Definition at line 201 of file vuPerspectiveCamera.h.

Referenced by getRay(), init(), operator=(), RestoreShotPersp(), set_equal_to_interp(), TakeSnapShotPersp(), and vuPerspectiveCamera().

vuVector vuPerspectiveCamera::m_XStep [protected]
 

Distance between adjacent x pixels.

Definition at line 202 of file vuPerspectiveCamera.h.

Referenced by getRay(), init(), operator=(), RestoreShotPersp(), set_equal_to_interp(), TakeSnapShotPersp(), and vuPerspectiveCamera().

vuVector vuPerspectiveCamera::m_YStep [protected]
 

Distance between adjacent y pixels.

Definition at line 203 of file vuPerspectiveCamera.h.

Referenced by getRay(), init(), operator=(), RestoreShotPersp(), set_equal_to_interp(), TakeSnapShotPersp(), and vuPerspectiveCamera().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:22:00 2004 for vuVolume by  doxygen 1.3.9.1