3Depict
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Attributes | Friends | List of all members
Camera Class Referenceabstract

An abstract base class for a camera. More...

#include <cameras.h>

Inheritance diagram for Camera:
Inheritance graph
[legend]
Collaboration diagram for Camera:
Collaboration graph
[legend]

Public Member Functions

 Camera ()
 constructor More...
 
virtual ~Camera ()
 Destructor. More...
 
virtual Cameraclone () const =0
 Duplication routine. Must delete returned pointer manually. More...
 
Point3D getOrigin () const
 Return the origin of the camera. More...
 
Point3D getViewDirection () const
 Return the view direction for the camera. More...
 
Point3D getUpDirection () const
 Return the up direction for the camera. More...
 
unsigned int getProjectionMode () const
 return the projection mode More...
 
float getOrthoScale () const
 
virtual void setOrigin (const Point3D &)
 Set the camera's position. More...
 
void setViewDirection (const Point3D &)
 set the direction that the camera looks towards More...
 
void setUpDirection (const Point3D &)
 set the direction that the camera considers "up" More...
 
void setUserString (const std::string &newString)
 Set the user string. More...
 
std::string getUserString () const
 Get the user string. More...
 
virtual void forwardsDolly (float dollyAmount)
 Do a forwards "dolly",where the camera moves along its viewing axis. In ortho mode, instead of moving along axis, a scaling is performed. More...
 
virtual void move (float leftRightAmount, float UpDownAmount)
 Move the camera origin. More...
 
virtual void translate (float leftRightAmount, float UpDownAmount)
 Move the camera origin. More...
 
virtual void pivot (float rollAroundAcross, float rollaroundUp)
 pivot the camera More...
 
virtual void roll (float roll)=0
 Roll around the view direction. More...
 
virtual void apply (float outputRatio, const BoundCube &b, bool loadIdentity=true) const =0
 Applies the camera settings to openGL. Ensures the far planes. More...
 
virtual void ensureVisible (const BoundCube &b, unsigned int face=3)=0
 Ensures that the given boundingbox should look nice, and be visible. More...
 
virtual void getProperties (CameraProperties &p) const =0
 Obtain the properties specific to a camera. More...
 
virtual bool setProperty (unsigned int key, const std::string &value)=0
 Set the camera property from a key & string pair. More...
 
unsigned int type () const
 
virtual bool writeState (std::ostream &f, unsigned int format, unsigned int tabs) const =0
 Write the state of the camera. More...
 
virtual bool readState (xmlNodePtr nodePtr)=0
 Read the state of the camera from XML document. More...
 

Protected Attributes

bool lock
 
Point3D origin
 Camera location. More...
 
Point3D viewDirection
 Direction camera is looking in. More...
 
Point3D upDirection
 Up direction for camera (required to work out "roll") More...
 
unsigned int projectionMode
 Projection mode (otho, perspective...)_. More...
 
float orthoScale
 The current orthographic scaling. More...
 
unsigned int typeNum
 Type number. More...
 
std::string userString
 user string, e.g. camera name More...
 

Friends

std::ostream & operator<< (std::ostream &stream, const Camera &)
 Streaming output operator, presents human readable text. More...
 

Detailed Description

An abstract base class for a camera.

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( )

constructor

◆ ~Camera()

Camera::~Camera ( )
virtual

Destructor.

Member Function Documentation

◆ apply()

virtual void Camera::apply ( float  outputRatio,
const BoundCube b,
bool  loadIdentity = true 
) const
pure virtual

Applies the camera settings to openGL. Ensures the far planes.

Implemented in CameraLookAt.

Referenced by Scene::glSelect(), and Scene::hasOverlays().

Here is the caller graph for this function:

◆ clone()

virtual Camera* Camera::clone ( ) const
pure virtual

Duplication routine. Must delete returned pointer manually.

Implemented in CameraLookAt.

Referenced by AnalysisState::addCam(), AnalysisState::addCamByClone(), Scene::cloneActiveCam(), AnaglyphEffect::enable(), BasicGLPane::saveImageSequence(), Scene::setActiveCamByClone(), AnalysisState::setCameraByClone(), and Scene::setTempCam().

Here is the caller graph for this function:

◆ ensureVisible()

virtual void Camera::ensureVisible ( const BoundCube b,
unsigned int  face = 3 
)
pure virtual

Ensures that the given boundingbox should look nice, and be visible.

Implemented in CameraLookAt.

Referenced by Scene::ensureVisible().

Here is the caller graph for this function:

◆ forwardsDolly()

void Camera::forwardsDolly ( float  dollyAmount)
virtual

Do a forwards "dolly",where the camera moves along its viewing axis. In ortho mode, instead of moving along axis, a scaling is performed.

Reimplemented in CameraLookAt.

References lock, origin, and viewDirection.

Referenced by BasicGLPane::keyReleased(), and BasicGLPane::mouseWheelMoved().

Here is the caller graph for this function:

◆ getOrigin()

Point3D Camera::getOrigin ( ) const

Return the origin of the camera.

References origin.

Referenced by Scene::applyDevice(), DrawGLText::draw(), DrawField3D::draw(), DrawIsoSurface::draw(), and BasicGLPane::saveImage().

Here is the caller graph for this function:

◆ getOrthoScale()

float Camera::getOrthoScale ( ) const
inline

Referenced by BasicGLPane::saveImage().

Here is the caller graph for this function:

◆ getProjectionMode()

unsigned int Camera::getProjectionMode ( ) const
inline

return the projection mode

Referenced by BasicGLPane::saveImage().

Here is the caller graph for this function:

◆ getProperties()

virtual void Camera::getProperties ( CameraProperties p) const
pure virtual

Obtain the properties specific to a camera.

Implemented in CameraLookAt.

Referenced by updateCameraPropertyGrid().

Here is the caller graph for this function:

◆ getUpDirection()

Point3D Camera::getUpDirection ( ) const

Return the up direction for the camera.

References upDirection.

Referenced by Scene::applyDevice(), DrawGLText::draw(), and BoxCropEffect::enable().

Here is the caller graph for this function:

◆ getUserString()

std::string Camera::getUserString ( ) const
inline

Get the user string.

References CameraProperty::key.

◆ getViewDirection()

Point3D Camera::getViewDirection ( ) const

Return the view direction for the camera.

References viewDirection.

Referenced by Scene::applyDevice(), BoxCropEffect::enable(), and Scene::hasOverlays().

Here is the caller graph for this function:

◆ move()

void Camera::move ( float  leftRightAmount,
float  UpDownAmount 
)
virtual

Move the camera origin.

Reimplemented in CameraLookAt.

References Point3D::crossProd(), lock, origin, upDirection, and viewDirection.

Referenced by BasicGLPane::mouseMoved(), BasicGLPane::saveImageSequence(), and translate().

Here is the caller graph for this function:

◆ pivot()

void Camera::pivot ( float  rollAroundAcross,
float  rollaroundUp 
)
virtual

pivot the camera

Reimplemented in CameraLookAt.

References Point3D::crossProd(), Point3f::fx, Point3f::fy, Point3f::fz, lock, quat_rot(), upDirection, and viewDirection.

Referenced by BasicGLPane::mouseMoved().

Here is the caller graph for this function:

◆ readState()

virtual bool Camera::readState ( xmlNodePtr  nodePtr)
pure virtual

Read the state of the camera from XML document.

Implemented in CameraLookAt.

◆ roll()

virtual void Camera::roll ( float  roll)
pure virtual

Roll around the view direction.

Implemented in CameraLookAt.

Referenced by BasicGLPane::mouseMoved().

Here is the caller graph for this function:

◆ setOrigin()

void Camera::setOrigin ( const Point3D pt)
virtual

Set the camera's position.

Reimplemented in CameraLookAt.

References lock, and origin.

◆ setProperty()

virtual bool Camera::setProperty ( unsigned int  key,
const std::string &  value 
)
pure virtual

Set the camera property from a key & string pair.

Implemented in CameraLookAt.

◆ setUpDirection()

void Camera::setUpDirection ( const Point3D pt)

set the direction that the camera considers "up"

References lock, Point3D::normalise(), and upDirection.

Referenced by MainWindowFrame::realignCameraButton().

Here is the caller graph for this function:

◆ setUserString()

void Camera::setUserString ( const std::string &  newString)
inline

Set the user string.

Referenced by AnalysisState::addCam().

Here is the caller graph for this function:

◆ setViewDirection()

void Camera::setViewDirection ( const Point3D pt)

set the direction that the camera looks towards

References lock, Point3D::normalise(), and viewDirection.

◆ translate()

void Camera::translate ( float  leftRightAmount,
float  UpDownAmount 
)
virtual

Move the camera origin.

Reimplemented in CameraLookAt.

References lock, and move().

Referenced by AnaglyphEffect::enable(), and BasicGLPane::mouseMoved().

Here is the caller graph for this function:

◆ type()

unsigned int Camera::type ( ) const
inline

◆ writeState()

virtual bool Camera::writeState ( std::ostream &  f,
unsigned int  format,
unsigned int  tabs 
) const
pure virtual

Write the state of the camera.

Implemented in CameraLookAt.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const Camera c 
)
friend

Streaming output operator, presents human readable text.

Member Data Documentation

◆ lock

bool Camera::lock
protected

◆ origin

Point3D Camera::origin
protected

◆ orthoScale

float Camera::orthoScale
protected

◆ projectionMode

unsigned int Camera::projectionMode
protected

◆ typeNum

unsigned int Camera::typeNum
protected

Type number.

Referenced by CameraLookAt::CameraLookAt(), and CameraLookAt::clone().

◆ upDirection

Point3D Camera::upDirection
protected

◆ userString

std::string Camera::userString
protected

user string, e.g. camera name

Referenced by CameraLookAt::clone(), CameraLookAt::readState(), and CameraLookAt::writeState().

◆ viewDirection

Point3D Camera::viewDirection
protected

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