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

vuCamera Class Reference

The camera class controls the parameters associated with a camera. More...

#include <vuCamera.h>

Inheritance diagram for vuCamera:

Inheritance graph
[legend]
Collaboration diagram for vuCamera:

Collaboration graph
[legend]
List of all members.

Public Types

enum  vuCameraType { vuGENERIC_CAMERA, vuPARALLEL_CAMERA, vuPERSPECTIVE_CAMERA }

Public Member Functions

virtual vuCameraType getType (void)
 vuCamera ()
 Default constructor.
 vuCamera (const vuCamera &c)
 Copy constructor.
virtual ~vuCamera ()
 Destructor.
virtual void init (void)
virtual vuRay getRay (float xpixel, float ypixel)
virtual vuCameraoperator= (const vuCamera &rhs)
 Assignment operator.
void setPosition (const vuVector &pos)
 Sets the position of the camera.
vuVector getPosition (void) const
 Returns the position of the camera.
void setUpVector (const vuVector &up)
 Sets the camera's up vector.
vuVector getUpVector (void) const
 Returns the camera's up vector.
void setLookAtVector (const vuVector &lookat)
 Sets the camera's look-at vector.
vuVector getLookAtVector (void) const
 Returns the camera's look at vector.
void setRightVector (const vuVector &right)
 Sets the right vector.
vuVector getRightVector (void) const
 Returns the camera's right vector.
void gluLookAt (void)
 Places a gluLookAt() function call for this camera.
virtual void glInit (void)
virtual void glViewport ()
 Sets up the viewport for OpenGL rendering.
int getWidth (void) const
 Get the width (in pixels).
void setWidth (const int width)
 Set the width (in pixels).
int getHeight (void) const
 Get the height (in pixels).
void setHeight (const int height)
 Set the height (in pixels).
void rotateAboutUp (float theta)
 Rotates the camera about the up vector.
void rotateAboutLookAt (float theta)
 Rotates the camera about the look-at vector.
void rotateAboutRight (float theta)
 Rotates the camera about the right vector.
void translateV (const vuVector &t)
 Translates the camera by a position vector.
void translateXYZ (float x, float y, float z)
 Translates the camera by a position.
void transform (const vuMatrix &m)
 Applies the given transformation matrix to the camera.
vuMatrix getViewMat ()
 Returns the viewing matrix.
bool record (const char *record_to)
 starts recording each position and direction that is rendered.
void TakeSnapShotBasic (char *Shot)
 saves the current state to Shot in the basic format.
virtual void TakeSnapShot ()
 This is overridden in derived classes so that the state of the current class is written to fp in the approriate format.
virtual void TakeSnapShot (char *Shot)
 This performs a TakeSnapShot except that it writes the shot to the char* Shot rather than the file that we are currently recording to.
int RestoreShotBasic (char *Shot)
 restores the camera to the state information in Shot
virtual int RestoreShot (char *Shot)
 This will restore the next shot and return the position of the last character of the line.
virtual int RestoreNextShot ()
 This will take the next line of the loaded file and set the current camera equal to that state.
virtual int RestorePreviousShot ()
 This will take the previous line of the loaded file and set the current camera equal to that state.
void stop_recording ()
 stops recording and closes the file that the recording is saved to.
bool load (char *load_from)
 loads the file so that RestoreNextShot will work.
void clear_lines ()
 this will remove every saved camera position from the buffer
virtual bool verify_id (char *id)
 this will return true if the first n characterds of id = get_id ()
virtual char * get_id ()
 this will return a pointer to a string containing the appropriate header for the type of camera that this is
bool IsNextAvailable ()
 This will return whether or not there are any more states available in the buffer of the camera.
bool IsPreviousAvailable ()
 This will return whether or not there are any more states available in the buffer of the camera.
bool IsRecording ()
 This will return true if this camera is recording to a file, and this will return false otherwise.
virtual bool load_cameras (vuDVector< vuCamera > &vect, char *fname)
 This function will load the cameras stored in the file "fname" and will set vect to be the array of cameras in fname.
char * getWithTime_id ()
 This returns an identifier that must be incorporated into the header file of a timed recording if this recording also contains time values.
bool verify_time_id (char *cmp)
 This will verify that cmp is equal to the WithTime Identifier.
virtual vuCameracreate_new ()
 returns a pointer to a new camera, of the same type as this.
virtual vuCameraset_equal_to_interp (vuCamera *cam1, vuCamera *cam2, float t1, float t2)
virtual vuCameraoperator * (float t)
 Multiplication Operator,.
virtual vuCameraoperator *= (float t)
 Addition/Assignment Operator,.
virtual vuCameraoperator+ (vuCamera &rhs)
 Addition Operator,.
virtual vuCameraoperator+= (vuCamera &rhs)
 Addition/Assignment operator,.
virtual vuCameraoperator+ (vuCamera *rhs)
 Addition operator,.
virtual vuCameraoperator+= (vuCamera *rhs)
 Addition/Assignment operator,.
virtual vuCameraoperator= (vuCamera *rhs)
 Assignment Operator,.
bool IsChanged ()
 This will return true if the camera has had any data changed since the last call to this function, and false if no changes have been made to the camera since the last time that this camera was called.
virtual void set_defaults ()
 This will restore the camera to the default state.

Public Attributes

int m_IsRecording
 this is true if recording, false otherwise
FILE * fp
 this is the file that is being recorded to
int line_number
 this is the current line number (from [0..lines.Size ()])
vuDVector< char * > lines
 these are the lines from the camera script

Protected Attributes

vuVector m_Position
 the position that the camera is located at
vuVector m_UpVector
 the direction that 'up' is in for the screen
vuVector m_LookAtVector
 the direction that the camera is pointed in
vuVector m_RightVector
 the direction of 'right' for the camera to the screen
int m_Width
 Width in pixels.
int m_Height
 Height in pixels.
bool m_IsChanged
 This is true if the camera has been changed since the last call to IsChanged (), and is false otherwise.

Friends

ostream & operator<< (ostream &out, vuCamera &cam)
 This will set cam equal to the state stored in out.
istream & operator>> (istream &in, vuCamera &cam)
 This will set in to be the state that cam is in.
bool record_with_time (char *record_to, vuCamera &cam)
 This will open the file "record_to" for recording (cam is needed so that it can give the correct header information to this function),.
bool stop_recording (vuCamera &cam)
 This will stop recording to the file opened by record_with_time (...) and save the file.
bool TakeSnapShotWithTime (float time, vuCamera &cam)
 This will take a SnapShot of the camera and record it to the file opened with the function record_with_time (...) and willalso record the time.
bool load_WithTime (char *load_from, vuCamera *cam, vuDVector< vuCamera * > &cameras, vuDVector< float > &times)
 This will load the frames with their times from the file "load from" into the cameras in the vector cameras (it will first allocate those cameras from the create_new function of the camera cam, and then set those cameras equal to the proper camera).
vuCameraoperator * (float t, vuCamera &cam)
 Multiplication Operator,.

Detailed Description

The camera class controls the parameters associated with a camera.

This class also controls the OpenGL camera properties. The functionality of this basic camera can be extended by more specialized cameras like vuPerspectiveCamera. Other approaches like affine multiple centers of projection are also imaginable...

This class also contains the functionality to record data and restore it later.

Definition at line 46 of file vuCamera.h.


Member Enumeration Documentation

enum vuCamera::vuCameraType
 

Enumeration values:
vuGENERIC_CAMERA 
vuPARALLEL_CAMERA 
vuPERSPECTIVE_CAMERA 

Definition at line 50 of file vuCamera.h.


Constructor & Destructor Documentation

vuCamera::vuCamera  ) 
 

Default constructor.

Definition at line 14 of file vuCamera.cpp.

References NULL.

vuCamera::vuCamera const vuCamera c  ) 
 

Copy constructor.

This will copy the state of the camera but will not preserve any recording or loaded file information for safety (ie, if c has a file loaded, the loaded file will not carry into the newly created vuCamera

Definition at line 42 of file vuCamera.cpp.

References fp, line_number, m_Height, m_IsChanged, m_IsRecording, m_LookAtVector, m_Position, m_RightVector, m_UpVector, and m_Width.

vuCamera::~vuCamera  )  [virtual]
 

Destructor.

Definition at line 60 of file vuCamera.cpp.

References clear_lines().

Here is the call graph for this function:


Member Function Documentation

void vuCamera::clear_lines  ) 
 

this will remove every saved camera position from the buffer

Please refer to bool vuCamera::load for greater details about the buffer

Definition at line 502 of file vuCamera.cpp.

References vuDVector< T >::getLength(), lines, and vuDVector< T >::removeRange().

Referenced by load(), load_cameras(), load_WithTime(), ~vuCamera(), vuParallelCamera::~vuParallelCamera(), and vuPerspectiveCamera::~vuPerspectiveCamera().

Here is the call graph for this function:

vuCamera * vuCamera::create_new  )  [virtual]
 

returns a pointer to a new camera, of the same type as this.

This must be overridden in all derived classes for the derived cameras to behave correctly.

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 735 of file vuCamera.cpp.

Referenced by interpolate(), load_WithTime(), vuKeyFramerDialog::OnTakeShot(), operator *(), operator *(), and operator+().

char * vuCamera::get_id  )  [virtual]
 

this will return a pointer to a string containing the appropriate header for the type of camera that this is

This is implemented to allow, say, a perspective camera to reject the notion of loading data that should be loaded by a parallel camera. Type is important here.

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 535 of file vuCamera.cpp.

Referenced by record(), and verify_id().

int vuCamera::getHeight void   )  const
 

Get the height (in pixels).

Definition at line 164 of file vuCamera.cpp.

Referenced by vu1512112::drawSlice(), vu1112113::getImageSize(), vuBCCSheetSplatter::glOnMouse(), vuBCCSheetSplatter::glRender(), vuBasicUtility::onMouseLeftMoving(), vuRaycast::onRender(), vuBCCRaycaster::onRender(), vuBCCFirstHitRaycaster::onRender(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), vuParallelCamera::operator=(), vu1112::preview(), vu1512::preview(), vu1512112::render(), vu1512113::renderImage(), vu1512122::renderImage(), ns_vu1112112::vu1112112::run(), vu1112113::run(), ns_vu1112112::vu1112112::setImageSize(), vu1512113::setImageSize(), vu1112113::setImageSize(), vu1512122::setImageSize(), ns_vu1112112::vu1112112::shootRays(), and vu1112113::shootRays().

vuVector vuCamera::getLookAtVector void   )  const
 

Returns the camera's look at vector.

Definition at line 119 of file vuCamera.cpp.

Referenced by vuSphVwFlt_Blend< SIZE, TYPE >::filter(), vuSphericFilter< SIZE, TYPE >::getNearestViews(), vuFVR::glOnMouse(), vuSplat::glRender(), vuSpecSplat::glRender(), vuShearWarp::glRender(), vuCellProjector::glRender(), vuBccSplat::glRender(), vuBCCShearWarp::glRender(), vuBCCMarchingTetrahedra::glRender(), vuShearWarp::OnButtonApplyViewing(), vuBCCShearWarp::OnButtonApplyViewing(), vuSimpleFBR< SIZE, TYPE >::OnButtonSnap2View(), vuRaycast::onKeyboard(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), operator+=(), vuParallelCamera::operator=(), operator=(), vu1611_2< SIZE, TYPE >::preview(), vu1611< SIZE, TYPE >::read(), ns_vu1112112::vu1112112::render(), vu1112113::render(), vu1512113::renderImage(), vu1512122::renderImage(), vuParallelCamera::set_equal_to_interp(), set_equal_to_interp(), vuFourierVolume< S >::setCamera(), Volume::setCamera(), and vu1712_1< SIZE >::vu1712_1().

vuVector vuCamera::getPosition void   )  const
 

Returns the position of the camera.

Definition at line 91 of file vuCamera.cpp.

Referenced by vuSplat::glOnMouse(), vuSpecSplat::glOnMouse(), vuSpecFVR::glOnMouse(), vuShearWarp::glOnMouse(), vuPreviewWin::glOnMouse(), vuFVR::glOnMouse(), vuCellProjector::glOnMouse(), vuBccSplat::glOnMouse(), vuBCCSheetSplatter::glOnMouse(), vuBCCShearWarp::glOnMouse(), vuBCCMarchingTetrahedra::glOnMouse(), vuSpectral::OnButtonLightPos(), vuSpecFVR::OnButtonLightPos(), vuRaycast::onKeyboard(), vuBasicUtility::onKeyboardRotate(), vuBasicUtility::onMouseLeftMoving(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), operator+=(), vuParallelCamera::operator=(), operator=(), vu1512112::read(), vu1512112::readRaw(), ns_vu1112112::vu1112112::render(), vu1112113::render(), vuParallelCamera::set_equal_to_interp(), set_equal_to_interp(), and vu1512112::sortByDistance().

virtual vuRay vuCamera::getRay float  xpixel,
float  ypixel
[inline, virtual]
 

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 73 of file vuCamera.h.

Referenced by vu1512113::renderImage(), vu1512122::renderImage(), ns_vu1112112::vu1112112::shootRays(), and vu1112113::shootRays().

vuVector vuCamera::getRightVector void   )  const
 

Returns the camera's right vector.

Definition at line 124 of file vuCamera.cpp.

Referenced by vuSphVwFlt_Blend< SIZE, TYPE >::filter(), vuFVR::glOnMouse(), vuSplat::glRender(), vuSpecSplat::glRender(), vuShearWarp::glRender(), vuCellProjector::glRender(), vuBccSplat::glRender(), vuBCCShearWarp::glRender(), vuBCCMarchingTetrahedra::glRender(), vuShearWarp::OnButtonApplyViewing(), vuBCCShearWarp::OnButtonApplyViewing(), vuSimpleFBR< SIZE, TYPE >::OnButtonSnap2View(), vuParallelCamera::operator=(), operator=(), vuParallelCamera::set_equal_to_interp(), set_equal_to_interp(), vuFourierVolume< S >::setCamera(), and Volume::setCamera().

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

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 56 of file vuCamera.h.

Referenced by vu1512113::setImageSize(), vu1112113::setImageSize(), and vu1512122::setImageSize().

vuVector vuCamera::getUpVector void   )  const
 

Returns the camera's up vector.

Definition at line 105 of file vuCamera.cpp.

Referenced by vuSphVwFlt_Blend< SIZE, TYPE >::filter(), vuFVR::glOnMouse(), vuSplat::glRender(), vuSpecSplat::glRender(), vuShearWarp::glRender(), vuCellProjector::glRender(), vuBccSplat::glRender(), vuBCCShearWarp::glRender(), vuBCCMarchingTetrahedra::glRender(), vuShearWarp::OnButtonApplyViewing(), vuBCCShearWarp::OnButtonApplyViewing(), vuSimpleFBR< SIZE, TYPE >::OnButtonSnap2View(), vuRaycast::onKeyboard(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), operator+=(), vuParallelCamera::operator=(), operator=(), vuParallelCamera::set_equal_to_interp(), set_equal_to_interp(), vuFourierVolume< S >::setCamera(), and Volume::setCamera().

vuMatrix vuCamera::getViewMat  ) 
 

Returns the viewing matrix.

Definition at line 260 of file vuCamera.cpp.

References vuVector::getData(), m_LookAtVector, m_RightVector, and m_UpVector.

Referenced by vuArcBall::turn().

Here is the call graph for this function:

int vuCamera::getWidth void   )  const
 

Get the width (in pixels).

Definition at line 150 of file vuCamera.cpp.

Referenced by vu1512112::drawSlice(), vu1112113::getImageSize(), vuBCCSheetSplatter::glOnMouse(), vuBCCSheetSplatter::glRender(), vuBasicUtility::onMouseLeftMoving(), vuRaycast::onRender(), vuBCCRaycaster::onRender(), vuBCCFirstHitRaycaster::onRender(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), vuParallelCamera::operator=(), vu1112::preview(), vu1512::preview(), vu1512112::render(), vu1512113::renderImage(), vu1512122::renderImage(), ns_vu1112112::vu1112112::setImageSize(), vu1512113::setImageSize(), vu1112113::setImageSize(), vu1512122::setImageSize(), ns_vu1112112::vu1112112::shootRays(), and vu1112113::shootRays().

char * vuCamera::getWithTime_id  ) 
 

This returns an identifier that must be incorporated into the header file of a timed recording if this recording also contains time values.

(ie, if times are associated with each camera, then this string will be in the file).

Definition at line 723 of file vuCamera.cpp.

Referenced by record_with_time(), and verify_time_id().

virtual void vuCamera::glInit void   )  [inline, virtual]
 

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 101 of file vuCamera.h.

Referenced by vuBCCSheetSplatter::glRender(), vu1112::preview(), vu1512::preview(), and vuPreviewWin::render().

void vuCamera::gluLookAt void   ) 
 

Places a gluLookAt() function call for this camera.

Definition at line 136 of file vuCamera.cpp.

References m_Position, and m_UpVector.

Referenced by vuFVR::glOnMouse(), vuSplat::glRender(), vuSpecSplat::glRender(), vuCellProjector::glRender(), vuBccSplat::glRender(), vuBCCSheetSplatter::glRender(), vuBCCMarchingTetrahedra::glRender(), vu1112::preview(), vu1512::preview(), and vuPreviewWin::render().

void vuCamera::glViewport  )  [virtual]
 

Sets up the viewport for OpenGL rendering.

This virtual function is implemented by the derived classes.

Definition at line 144 of file vuCamera.cpp.

Referenced by vu1112::preview(), and vu1512::preview().

virtual void vuCamera::init void   )  [inline, virtual]
 

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 72 of file vuCamera.h.

Referenced by vuPreviewWin::glOnMouse(), vu1712_1< SIZE >::glResize(), vu1611< SIZE, TYPE >::glResize(), ns_vu1112112::vu1112112::load_scene(), vuSimpleFBR< SIZE, TYPE >::OnButtonSnap2View(), vuBasicUtility::onKeyboardRotate(), vuBasicUtility::onMouseLeftMoving(), vu1611< SIZE, TYPE >::read(), vu1512113::read(), vu1112113::read(), vu1512122::read(), ns_vu1112112::vu1112112::readRaw(), vu1112113::readRaw(), ns_vu1112112::vu1112112::setImageSize(), vu1512113::setImageSize(), vu1112113::setImageSize(), vu1512122::setImageSize(), ns_vu1112112::vu1112112::setViewVectors(), vu1512113::setViewVectors(), vu1112113::setViewVectors(), vu1512122::setViewVectors(), and vu1712_1< SIZE >::vu1712_1().

bool vuCamera::IsChanged  ) 
 

This will return true if the camera has had any data changed since the last call to this function, and false if no changes have been made to the camera since the last time that this camera was called.

Definition at line 903 of file vuCamera.cpp.

References m_IsChanged.

bool vuCamera::IsNextAvailable  ) 
 

This will return whether or not there are any more states available in the buffer of the camera.

Returns:
true if there are more states to be loaded in the buffer

false if there are no more states in the buffer to be loaded

Please refer to bool vuCamera::load for greater details about the buffer

Definition at line 567 of file vuCamera.cpp.

References vuDVector< T >::getLength(), line_number, and lines.

Referenced by load_cameras(), vuPerspectiveCamera::RestoreNextShot(), vuParallelCamera::RestoreNextShot(), RestoreNextShot(), and vuParallelCamera::RestorePreviousShot().

Here is the call graph for this function:

bool vuCamera::IsPreviousAvailable  ) 
 

This will return whether or not there are any more states available in the buffer of the camera.

Returns:
true if there are previous states in the buffer

false if there are no previous states in the buffer

Please refer to bool vuCamera::load for greater details about the buffer

Definition at line 573 of file vuCamera.cpp.

References vuDVector< T >::getLength(), line_number, and lines.

Referenced by vuPerspectiveCamera::RestorePreviousShot(), and RestorePreviousShot().

Here is the call graph for this function:

bool vuCamera::IsRecording  ) 
 

This will return true if this camera is recording to a file, and this will return false otherwise.

Definition at line 579 of file vuCamera.cpp.

Referenced by vuKeyFramerDialog::OnStop(), and vuKeyFramerDialog::SaveFunc().

bool vuCamera::load char *  load_from  ) 
 

loads the file so that RestoreNextShot will work.

The file must have the appropriate header (the string pointed to by get_id ()), otherwise, it will not be loaded.

Returns:
success or failure
Each line is loaded line into lines (except for the header).

NB - This function will fail if the header line of the file is not the apporpriate header for the type of camera that is being loaded into.

The proper usage of this function is:

camera.load (file_name);

while (displaying pictures)

{ camera.RestoreNextShot (); }

camera.clear_lines ();

This proper usage will apply to any camera that is derived from vuCamera (such as vuPerspectiveCamera, vuParallelCamera).

Definition at line 460 of file vuCamera.cpp.

References vuDVector< T >::add(), clear_lines(), fp, line_number, lines, and verify_id().

Referenced by load_cameras().

Here is the call graph for this function:

bool vuCamera::load_cameras vuDVector< vuCamera > &  vect,
char *  fname
[virtual]
 

This function will load the cameras stored in the file "fname" and will set vect to be the array of cameras in fname.

This will work if you recast a derived camera as a base class camera.

Definition at line 585 of file vuCamera.cpp.

References vuDVector< T >::add(), clear_lines(), dword, vuDVector< T >::getLength(), IsNextAvailable(), load(), vuDVector< T >::removeRange(), and RestoreNextShot().

Here is the call graph for this function:

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

Multiplication Operator,.

This will return the camera obtained by multiplying each component of this camera with t

It will create that camera, so you must delete it later.

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 749 of file vuCamera.cpp.

References create_new(), m_IsChanged, m_LookAtVector, m_Position, m_UpVector, setLookAtVector(), setPosition(), and setUpVector().

Here is the call graph for this function:

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

Addition/Assignment Operator,.

This will multiply each component of this camera by t and will return this camera upon completion

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 764 of file vuCamera.cpp.

References m_IsChanged, m_LookAtVector, m_Position, m_UpVector, setLookAtVector(), setPosition(), and setUpVector().

Here is the call graph for this function:

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

Addition operator,.

This will add this and rhs (componentwise).

It will create the camera that it returns, you must deallocate this later.

Definition at line 820 of file vuCamera.cpp.

References create_new(), getLookAtVector(), getPosition(), getUpVector(), m_LookAtVector, m_Position, m_UpVector, setLookAtVector(), setPosition(), and setUpVector().

Here is the call graph for this function:

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

Addition Operator,.

This will perform a component wise addition of this and rhs and will return a pointer to the result.

Note that this will create a new vuCamera, so you will have to deallocate it later.

Definition at line 794 of file vuCamera.cpp.

References create_new(), getLookAtVector(), getPosition(), getUpVector(), m_LookAtVector, m_Position, m_UpVector, setLookAtVector(), setPosition(), and setUpVector().

Here is the call graph for this function:

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

Addition/Assignment operator,.

this will perform a component wise addition on this camera and the camera pointed to by rhs, and then will store the result in this camera and return a pointer to this camera.

Definition at line 833 of file vuCamera.cpp.

References getLookAtVector(), getPosition(), getUpVector(), m_IsChanged, m_LookAtVector, m_Position, m_UpVector, setLookAtVector(), setPosition(), and setUpVector().

Here is the call graph for this function:

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

Addition/Assignment operator,.

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

Definition at line 807 of file vuCamera.cpp.

References getLookAtVector(), getPosition(), getUpVector(), m_IsChanged, m_LookAtVector, m_Position, m_UpVector, setLookAtVector(), setPosition(), and setUpVector().

Here is the call graph for this function:

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

Assignment Operator,.

This will set this camera equal to the camera pointed to by rhs

Definition at line 846 of file vuCamera.cpp.

References getLookAtVector(), getPosition(), getRightVector(), getUpVector(), m_IsChanged, m_LookAtVector, m_Position, m_RightVector, and m_UpVector.

Here is the call graph for this function:

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

Assignment operator.

Definition at line 65 of file vuCamera.cpp.

References m_Height, m_IsChanged, m_IsRecording, m_LookAtVector, m_Position, m_RightVector, m_UpVector, and m_Width.

bool vuCamera::record const char *  record_to  ) 
 

starts recording each position and direction that is rendered.

this will record to the file listed by record_to.

To properely use, you should run similar to as follows:

camera.record (recordfile); while (takingpictures)

{ camera.TakeSnapShot (); } camera.stop_recording ();

This is the proper usage for vuCamera and any camera derived from vuCamera (such as vuPerspectiveCamera and vuParallelCamera(.

and will store in the format: [BasicShot|[,AdvancedShot
]] where basicShot is obtained from TakeSnapShotBasic () and the advancedShot is obtained from the extra data in derived classes by functions in those derived classes.

Returns:
true if the recording was started successfully

false if the recording was not successfully started

NB - you may not start recording if you are in the middle of recording to any other file with this camera (ie, if you've successfully started recording and have not stop_recording (), then this will return false).

Definition at line 272 of file vuCamera.cpp.

References fp, get_id(), and m_IsRecording.

Referenced by record_with_time().

Here is the call graph for this function:

int vuCamera::RestoreNextShot  )  [virtual]
 

This will take the next line of the loaded file and set the current camera equal to that state.

NB This must be overridden appropriately in any derived class!!!

Returns:
length of shot 'consumed' if successful, < 0 otherwise NB - You must call load () successfully before using this function NB - There IsNextStateAvailable must return true for this for to return success.

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 396 of file vuCamera.cpp.

References IsNextAvailable(), line_number, lines, and RestoreShotBasic().

Referenced by load_cameras().

Here is the call graph for this function:

int vuCamera::RestorePreviousShot  )  [virtual]
 

This will take the previous line of the loaded file and set the current camera equal to that state.

NB This must be overridden appropriately in any derived class!!!

Returns:
length of shot 'consumed' if successful, < 0 otherwise
NB - You must call load () successfully before using this function NB - There IsNextStateAvailable must return true for this for to return success.

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 407 of file vuCamera.cpp.

References IsPreviousAvailable(), line_number, lines, and RestoreShotBasic().

Here is the call graph for this function:

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

This will restore the next shot and return the position of the last character of the line.

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 390 of file vuCamera.cpp.

References RestoreShotBasic().

Referenced by load_WithTime(), and operator>>().

Here is the call graph for this function:

int vuCamera::RestoreShotBasic char *  Shot  ) 
 

restores the camera to the state information in Shot

Definition at line 359 of file vuCamera.cpp.

References get_next_close(), get_next_open(), vuVector::load(), m_IsChanged, m_LookAtVector, m_Position, m_RightVector, and m_UpVector.

Referenced by vuPerspectiveCamera::RestoreNextShot(), RestoreNextShot(), vuPerspectiveCamera::RestorePreviousShot(), RestorePreviousShot(), vuPerspectiveCamera::RestoreShot(), vuParallelCamera::RestoreShot(), and RestoreShot().

Here is the call graph for this function:

void vuCamera::rotateAboutLookAt float  theta  ) 
 

Rotates the camera about the look-at vector.

Definition at line 193 of file vuCamera.cpp.

References m_LookAtVector, vuMatrix::makeRotate(), and transform().

Here is the call graph for this function:

void vuCamera::rotateAboutRight float  theta  ) 
 

Rotates the camera about the right vector.

Definition at line 207 of file vuCamera.cpp.

References m_RightVector, vuMatrix::makeRotate(), and transform().

Referenced by vuSplat::glOnMouse(), vuSpecSplat::glOnMouse(), vuShearWarp::glOnMouse(), vuFVR::glOnMouse(), vuCellProjector::glOnMouse(), vuBccSplat::glOnMouse(), vuBCCShearWarp::glOnMouse(), vuBCCMarchingTetrahedra::glOnMouse(), and vuBasicUtility::onKeyboardRotate().

Here is the call graph for this function:

void vuCamera::rotateAboutUp float  theta  ) 
 

Rotates the camera about the up vector.

Transforms always accur about the axes defining the local camera coordinate system.

Definition at line 178 of file vuCamera.cpp.

References m_UpVector, vuMatrix::makeRotate(), and transform().

Referenced by vuSplat::glOnMouse(), vuSpecSplat::glOnMouse(), vuShearWarp::glOnMouse(), vuFVR::glOnMouse(), vuCellProjector::glOnMouse(), vuBccSplat::glOnMouse(), vuBCCShearWarp::glOnMouse(), vuBCCMarchingTetrahedra::glOnMouse(), and vuBasicUtility::onKeyboardRotate().

Here is the call graph for this function:

void vuCamera::set_defaults  )  [virtual]
 

This will restore the camera to the default state.

Reimplemented in vuPerspectiveCamera.

Definition at line 27 of file vuCamera.cpp.

References m_IsChanged, m_LookAtVector, m_Position, m_RightVector, and m_UpVector.

Referenced by vuKeyFramerDialog::BurstPlayGI().

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

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 859 of file vuCamera.cpp.

References getLookAtVector(), getPosition(), getRightVector(), getUpVector(), m_LookAtVector, m_Position, m_RightVector, and m_UpVector.

Referenced by interpolate().

Here is the call graph for this function:

void vuCamera::setHeight const int  height  ) 
 

Set the height (in pixels).

Definition at line 170 of file vuCamera.cpp.

References m_Height, and m_IsChanged.

Referenced by vu1712_1< SIZE >::glResize(), vu1611< SIZE, TYPE >::glResize(), vuPerspectiveCamera::operator *(), operator *(), vuParallelCamera::operator *(), vuPerspectiveCamera::operator *=(), vuParallelCamera::operator *=(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), ns_vu1112112::Parser::ReadTarga(), ns_vu1112112::vu1112112::setImageSize(), vu1512112::setImageSize(), vu1512113::setImageSize(), vu1112113::setImageSize(), vu1512122::setImageSize(), ns_vu1112112::vu1112112::vu1112112(), vu1112113::vu1112113(), vu1512113::vu1512113(), and vu1512122::vu1512122().

void vuCamera::setLookAtVector const vuVector lookat  ) 
 

Sets the camera's look-at vector.

Definition at line 110 of file vuCamera.cpp.

References vuVector::cross, m_IsChanged, m_LookAtVector, m_RightVector, m_UpVector, and vuVector::makeUnit().

Referenced by Scanner::_renderView(), Volume::getCamera(), vuShearWarp::OnButtonApplyViewing(), vuBCCShearWarp::OnButtonApplyViewing(), vuSimpleFBR< SIZE, TYPE >::OnButtonSnap2View(), vuRaycast::onKeyboard(), vuPerspectiveCamera::operator *(), vuParallelCamera::operator *(), operator *(), operator *(), vuPerspectiveCamera::operator *=(), vuParallelCamera::operator *=(), operator *=(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), operator+=(), ns_vu1112112::vu1112112::setViewVectors(), vu1512113::setViewVectors(), vu1112113::setViewVectors(), and vu1512122::setViewVectors().

Here is the call graph for this function:

void vuCamera::setPosition const vuVector pos  ) 
 

Sets the position of the camera.

Definition at line 84 of file vuCamera.cpp.

References m_IsChanged, and m_Position.

Referenced by Scanner::_renderView(), vuFVR::init(), ns_vu1112112::vu1112112::load_scene(), vuRaycast::onKeyboard(), vuPerspectiveCamera::operator *(), vuParallelCamera::operator *(), operator *(), operator *(), vuPerspectiveCamera::operator *=(), vuParallelCamera::operator *=(), operator *=(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), operator+=(), vu1611< SIZE, TYPE >::read(), ns_vu1112112::vu1112112::read(), vu1512112::read(), vu1512113::read(), vu1112113::read(), vu1512122::read(), ns_vu1112112::vu1112112::readRaw(), vu1512112::readRaw(), vu1112113::readRaw(), ns_vu1112112::vu1112112::setViewVectors(), and vu1712_1< SIZE >::vu1712_1().

void vuCamera::setRightVector const vuVector right  ) 
 

Sets the right vector.

Definition at line 129 of file vuCamera.cpp.

References m_RightVector, and vuVector::makeUnit().

Referenced by Scanner::_renderView(), vuSimpleFBR< SIZE, TYPE >::OnButtonSnap2View(), vu1512113::setViewVectors(), and vu1512122::setViewVectors().

Here is the call graph for this function:

void vuCamera::setUpVector const vuVector up  ) 
 

Sets the camera's up vector.

Definition at line 96 of file vuCamera.cpp.

References vuVector::cross, m_IsChanged, m_LookAtVector, m_RightVector, m_UpVector, and vuVector::makeUnit().

Referenced by Scanner::_renderView(), Volume::getCamera(), vuShearWarp::OnButtonApplyViewing(), vuBCCShearWarp::OnButtonApplyViewing(), vuSimpleFBR< SIZE, TYPE >::OnButtonSnap2View(), vuRaycast::onKeyboard(), vuPerspectiveCamera::operator *(), vuParallelCamera::operator *(), operator *(), operator *(), vuPerspectiveCamera::operator *=(), vuParallelCamera::operator *=(), operator *=(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), operator+=(), ns_vu1112112::vu1112112::setViewVectors(), vu1512113::setViewVectors(), vu1112113::setViewVectors(), and vu1512122::setViewVectors().

Here is the call graph for this function:

void vuCamera::setWidth const int  width  ) 
 

Set the width (in pixels).

Definition at line 156 of file vuCamera.cpp.

References m_IsChanged, and m_Width.

Referenced by vu1712_1< SIZE >::glResize(), vu1611< SIZE, TYPE >::glResize(), vuPerspectiveCamera::operator *(), operator *(), vuParallelCamera::operator *(), vuPerspectiveCamera::operator *=(), vuParallelCamera::operator *=(), vuPerspectiveCamera::operator+(), vuParallelCamera::operator+(), vuPerspectiveCamera::operator+=(), vuParallelCamera::operator+=(), ns_vu1112112::Parser::ReadTarga(), ns_vu1112112::vu1112112::setImageSize(), vu1512112::setImageSize(), vu1512113::setImageSize(), vu1112113::setImageSize(), vu1512122::setImageSize(), ns_vu1112112::vu1112112::vu1112112(), vu1112113::vu1112113(), vu1512113::vu1512113(), and vu1512122::vu1512122().

void vuCamera::stop_recording  ) 
 

stops recording and closes the file that the recording is saved to.

NB - refer to the comments associated with void vuCamera::record (char* record_to);

Definition at line 416 of file vuCamera.cpp.

References fp, and m_IsRecording.

Referenced by vuKeyFramerDialog::OnStop(), vuKeyFramerDialog::SaveFunc(), and stop_recording().

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

This performs a TakeSnapShot except that it writes the shot to the char* Shot rather than the file that we are currently recording to.

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 331 of file vuCamera.cpp.

References TakeSnapShotBasic().

Here is the call graph for this function:

void vuCamera::TakeSnapShot  )  [virtual]
 

This is overridden in derived classes so that the state of the current class is written to fp in the approriate format.

NB - refer to the comments associated with void vuCamera::record (char* record_to);

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 315 of file vuCamera.cpp.

References fp, and TakeSnapShotBasic().

Referenced by operator<<(), and TakeSnapShotWithTime().

Here is the call graph for this function:

void vuCamera::TakeSnapShotBasic char *  Shot  ) 
 

saves the current state to Shot in the basic format.

Definition at line 288 of file vuCamera.cpp.

References m_LookAtVector, m_Position, m_RightVector, m_UpVector, and vuVector::save().

Referenced by vuPerspectiveCamera::TakeSnapShot(), vuParallelCamera::TakeSnapShot(), and TakeSnapShot().

Here is the call graph for this function:

void vuCamera::transform const vuMatrix m  ) 
 

Applies the given transformation matrix to the camera.

Definition at line 247 of file vuCamera.cpp.

References m_IsChanged, m_LookAtVector, m_RightVector, and m_UpVector.

Referenced by rotateAboutLookAt(), rotateAboutRight(), rotateAboutUp(), and vuArcBall::turn().

void vuCamera::translateV const vuVector t  ) 
 

Translates the camera by a position vector.

Definition at line 223 of file vuCamera.cpp.

References m_IsChanged, m_LookAtVector, m_Position, m_RightVector, and m_UpVector.

void vuCamera::translateXYZ float  x,
float  y,
float  z
 

Translates the camera by a position.

Definition at line 235 of file vuCamera.cpp.

References m_IsChanged, m_LookAtVector, m_Position, m_RightVector, and m_UpVector.

Referenced by vuSplat::glOnMouse(), vuSpecSplat::glOnMouse(), vuSpecFVR::glOnMouse(), vuShearWarp::glOnMouse(), vuPreviewWin::glOnMouse(), vuFVR::glOnMouse(), vuCellProjector::glOnMouse(), vuBccSplat::glOnMouse(), vuBCCSheetSplatter::glOnMouse(), vuBCCShearWarp::glOnMouse(), vuBCCMarchingTetrahedra::glOnMouse(), vuRaycast::init(), ns_vu1112112::vu1112112::load_scene(), vuBasicUtility::onKeyboardRotate(), vuBasicUtility::onKeyboardZoom(), vuBasicUtility::onMouseLeftMoving(), vuBasicUtility::onMouseRightMoving(), ns_vu1112112::vu1112112::read(), vu1512112::read(), vu1512113::read(), vu1112113::read(), vu1512122::read(), ns_vu1112112::vu1112112::readRaw(), vu1512112::readRaw(), and vu1112113::readRaw().

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

this will return true if the first n characterds of id = get_id ()

NB - n = strlen get_id ie - this verifies that the header is the correct header for the type of camera that is being loaded

Reimplemented in vuParallelCamera, and vuPerspectiveCamera.

Definition at line 525 of file vuCamera.cpp.

References get_id().

Referenced by load(), and load_WithTime().

Here is the call graph for this function:

bool vuCamera::verify_time_id char *  cmp  ) 
 

This will verify that cmp is equal to the WithTime Identifier.

This will return whether or not the two are equal (true if they are, and false otherwise).

Definition at line 729 of file vuCamera.cpp.

References getWithTime_id().

Referenced by load_WithTime().

Here is the call graph for this function:


Friends And Related Function Documentation

bool load_WithTime char *  load_from,
vuCamera cam,
vuDVector< vuCamera * > &  cameras,
vuDVector< float > &  times
[friend]
 

This will load the frames with their times from the file "load from" into the cameras in the vector cameras (it will first allocate those cameras from the create_new function of the camera cam, and then set those cameras equal to the proper camera).

This returns true if successful and false if it fails to load.

This will work if you recast a derived camera as a base class camera.

Definition at line 653 of file vuCamera.cpp.

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

Multiplication Operator,.

This will create a new camera, and return a pointer to that camera.

It will then multiply each component of cam by t and return the a pointer to the camera storing the result of this multiplication.

Definition at line 779 of file vuCamera.cpp.

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

This will set cam equal to the state stored in out.

Definition at line 541 of file vuCamera.cpp.

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

This will set in to be the state that cam is in.

Definition at line 555 of file vuCamera.cpp.

bool record_with_time char *  record_to,
vuCamera cam
[friend]
 

This will open the file "record_to" for recording (cam is needed so that it can give the correct header information to this function),.

This will return true if successful and false otherwise.

This works properely for all cameras properely derived from this class

This will work if you recast a derived camera as a base class camera.

Definition at line 611 of file vuCamera.cpp.

bool stop_recording vuCamera cam  )  [friend]
 

This will stop recording to the file opened by record_with_time (...) and save the file.

This will return true if successful, and false otherwise.

This works properely for all cameras properely derived from this class.

This will work if you recast a derived camera as a base class camera.

Definition at line 626 of file vuCamera.cpp.

bool TakeSnapShotWithTime float  time,
vuCamera cam
[friend]
 

This will take a SnapShot of the camera and record it to the file opened with the function record_with_time (...) and willalso record the time.

The format is time, path
...

This will return true if successful, and false otherwise.

This works correctly for all cameras properely derived from this class (ie, it'lkl record the correct data for a perspective camera passed into this recast as a vuCamera... ).

This will work if you recast a derived camera as a base class camera.

Definition at line 634 of file vuCamera.cpp.


Member Data Documentation

FILE* vuCamera::fp
 

this is the file that is being recorded to

Definition at line 471 of file vuCamera.h.

Referenced by load(), load_WithTime(), record(), record_with_time(), stop_recording(), TakeSnapShot(), TakeSnapShotWithTime(), and vuCamera().

int vuCamera::line_number
 

this is the current line number (from [0..lines.Size ()])

Definition at line 473 of file vuCamera.h.

Referenced by IsNextAvailable(), IsPreviousAvailable(), load(), load_WithTime(), RestoreNextShot(), RestorePreviousShot(), and vuCamera().

vuDVector<char*> vuCamera::lines
 

these are the lines from the camera script

Definition at line 476 of file vuCamera.h.

Referenced by clear_lines(), IsNextAvailable(), IsPreviousAvailable(), load(), load_WithTime(), RestoreNextShot(), and RestorePreviousShot().

int vuCamera::m_Height [protected]
 

Height in pixels.

Definition at line 462 of file vuCamera.h.

Referenced by operator *(), vuPerspectiveCamera::operator=(), vuParallelCamera::operator=(), operator=(), vuPerspectiveCamera::set_equal_to_interp(), vuParallelCamera::set_equal_to_interp(), setHeight(), vuCamera(), vuParallelCamera::vuParallelCamera(), and vuPerspectiveCamera::vuPerspectiveCamera().

bool vuCamera::m_IsChanged [protected]
 

This is true if the camera has been changed since the last call to IsChanged (), and is false otherwise.

Definition at line 464 of file vuCamera.h.

Referenced by IsChanged(), operator *(), operator *(), operator *=(), operator+=(), operator<<(), operator=(), operator>>(), RestoreShotBasic(), set_defaults(), setHeight(), setLookAtVector(), setPosition(), setUpVector(), setWidth(), transform(), translateV(), translateXYZ(), and vuCamera().

int vuCamera::m_IsRecording
 

this is true if recording, false otherwise

Definition at line 469 of file vuCamera.h.

Referenced by operator=(), record(), stop_recording(), TakeSnapShotWithTime(), and vuCamera().

vuVector vuCamera::m_LookAtVector [protected]
 

the direction that the camera is pointed in

Definition at line 457 of file vuCamera.h.

Referenced by getViewMat(), operator *(), operator *(), operator *=(), operator+(), operator+=(), vuPerspectiveCamera::operator=(), vuParallelCamera::operator=(), operator=(), RestoreShotBasic(), rotateAboutLookAt(), set_defaults(), vuPerspectiveCamera::set_equal_to_interp(), set_equal_to_interp(), setLookAtVector(), setUpVector(), TakeSnapShotBasic(), transform(), translateV(), translateXYZ(), vuCamera(), vuParallelCamera::vuParallelCamera(), and vuPerspectiveCamera::vuPerspectiveCamera().

vuVector vuCamera::m_Position [protected]
 

the position that the camera is located at

Definition at line 453 of file vuCamera.h.

Referenced by gluLookAt(), operator *(), operator *(), operator *=(), operator+(), operator+=(), vuPerspectiveCamera::operator=(), vuParallelCamera::operator=(), operator=(), RestoreShotBasic(), set_defaults(), vuPerspectiveCamera::set_equal_to_interp(), set_equal_to_interp(), setPosition(), TakeSnapShotBasic(), translateV(), translateXYZ(), vuCamera(), vuParallelCamera::vuParallelCamera(), and vuPerspectiveCamera::vuPerspectiveCamera().

vuVector vuCamera::m_RightVector [protected]
 

the direction of 'right' for the camera to the screen

Definition at line 459 of file vuCamera.h.

Referenced by getViewMat(), vuPerspectiveCamera::operator=(), operator=(), RestoreShotBasic(), rotateAboutRight(), set_defaults(), vuPerspectiveCamera::set_equal_to_interp(), set_equal_to_interp(), setLookAtVector(), setRightVector(), setUpVector(), TakeSnapShotBasic(), transform(), translateV(), translateXYZ(), vuCamera(), and vuPerspectiveCamera::vuPerspectiveCamera().

vuVector vuCamera::m_UpVector [protected]
 

the direction that 'up' is in for the screen

Definition at line 455 of file vuCamera.h.

Referenced by getViewMat(), gluLookAt(), operator *(), operator *(), operator *=(), operator+(), operator+=(), vuPerspectiveCamera::operator=(), vuParallelCamera::operator=(), operator=(), RestoreShotBasic(), rotateAboutUp(), set_defaults(), vuPerspectiveCamera::set_equal_to_interp(), set_equal_to_interp(), setLookAtVector(), setUpVector(), TakeSnapShotBasic(), transform(), translateV(), translateXYZ(), vuCamera(), vuParallelCamera::vuParallelCamera(), and vuPerspectiveCamera::vuPerspectiveCamera().

int vuCamera::m_Width [protected]
 

Width in pixels.

Definition at line 461 of file vuCamera.h.

Referenced by operator *(), vuPerspectiveCamera::operator=(), vuParallelCamera::operator=(), operator=(), vuPerspectiveCamera::set_equal_to_interp(), vuParallelCamera::set_equal_to_interp(), setWidth(), vuCamera(), vuParallelCamera::vuParallelCamera(), and vuPerspectiveCamera::vuPerspectiveCamera().


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