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

A perspective camera that looks at a specific location. More...

#include <cameras.h>

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

Public Member Functions

 CameraLookAt ()
 Constructor. More...
 
Cameraclone () const
 clone function More...
 
virtual ~CameraLookAt ()
 Destructor. More...
 
void setOrigin (const Point3D &)
 Set the look at target. More...
 
void setTarget (const Point3D &)
 Set the look at target. More...
 
Point3D getTarget () const
 Get the look at target. More...
 
float getFOV () const
 Get the camera's FOV angle (full angle across) More...
 
float getNearPlane () const
 
void apply (float outAspect, const BoundCube &boundCube, bool loadIdentity=true) const
 Applies the view transform. More...
 
void lookAt () const
 Only apply the look-at opengl transform. More...
 
void forwardsDolly (float dollyAmount)
 Do a forwards "dolly",where the camera moves along its viewing axis. More...
 
void move (float leftRightAmount, float UpDownAmount)
 Move the camera origin. More...
 
void pivot (float lrRad, float udRad)
 Simulate pivot of camera. More...
 
void translate (float lrTrans, float udTrans)
 Move the camera origin. More...
 
void roll (float rollRad)
 Roll around the view direction. More...
 
void recomputeUpDirection ()
 Ensure that up direction is perpendicular to view direction. More...
 
void repositionAroundTarget (unsigned int direction)
 
virtual void ensureVisible (const BoundCube &b, unsigned int face=3)
 Ensure that the box is visible. More...
 
void getProperties (CameraProperties &p) const
 Return the user-settable properties of the camera. More...
 
bool setProperty (unsigned int key, const std::string &value)
 Set the camera property from a key & string pair. More...
 
bool writeState (std::ostream &f, unsigned int format, unsigned int tabs=0) const
 Write the state of the camera. More...
 
bool readState (xmlNodePtr nodePtr)
 Read the state of the camera. More...
 
float getViewWidth (float depth) const
 
void setFrustumDistort (float offset)
 
- Public Member Functions inherited from Camera
 Camera ()
 constructor More...
 
virtual ~Camera ()
 Destructor. 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
 
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...
 
unsigned int type () const
 

Protected Member Functions

void recomputeViewDirection ()
 

Protected Attributes

Point3D target
 Location for camera to look at. More...
 
float fovAngle
 Perspective FOV. More...
 
float nearPlane
 Near clipping plane distance. More...
 
float farPlane
 Far plane is computed on-the-fly. cannot be set directly. Oh no! mutable. gross! More...
 
float frustumDistortion
 Distort to the viewing frustum. (eg for stero) ( a frustum is a rectangular pyramid with the top cut off) More...
 
- Protected Attributes inherited from Camera
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 CameraLookAt &)
 Streaming output operator, presents human readable text. More...
 

Detailed Description

A perspective camera that looks at a specific location.

Constructor & Destructor Documentation

◆ CameraLookAt()

CameraLookAt::CameraLookAt ( )

Constructor.

References CAM_LOOKAT, Camera::origin, PROJECTION_MODE_PERSPECTIVE, Camera::projectionMode, Camera::typeNum, Camera::upDirection, and Camera::viewDirection.

Referenced by clone().

Here is the caller graph for this function:

◆ ~CameraLookAt()

CameraLookAt::~CameraLookAt ( )
virtual

Destructor.

Member Function Documentation

◆ apply()

void CameraLookAt::apply ( float  outAspect,
const BoundCube boundCube,
bool  loadIdentity = true 
) const
virtual

◆ clone()

Camera * CameraLookAt::clone ( ) const
virtual

◆ ensureVisible()

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

Ensure that the box is visible.

Face is set by cube net 0 1 2 3 4 5 2 is the face directed to the +ve x axis, with the "up"" vector on the 3 aligned to z, so "0" is perpendicular to the Z axis and is "visible"

Implements Camera.

References ASSERT, CAMERA_DIR_XMINUS, CAMERA_DIR_XPLUS, CAMERA_DIR_YMINUS, CAMERA_DIR_YPLUS, CAMERA_DIR_ZMINUS, CAMERA_DIR_ZPLUS, fovAngle, BoundCube::getCentroid(), BoundCube::getSize(), Camera::lock, M_PI, nearPlane, Camera::origin, Camera::orthoScale, PROJECTION_MODE_PERSPECTIVE, Camera::projectionMode, recomputeUpDirection(), recomputeViewDirection(), Point3D::sqrDist(), target, and Camera::upDirection.

◆ forwardsDolly()

void CameraLookAt::forwardsDolly ( float  dollyAmount)
virtual

Do a forwards "dolly",where the camera moves along its viewing axis.

Reimplemented from Camera.

References Camera::lock, Camera::origin, ORTHO_SPEED_HACK, Camera::orthoScale, PROJECTION_MODE_PERSPECTIVE, Camera::projectionMode, Point3D::sqrDist(), target, and Camera::viewDirection.

◆ getFOV()

float CameraLookAt::getFOV ( ) const
inline

Get the camera's FOV angle (full angle across)

Referenced by BasicGLPane::saveImage().

Here is the caller graph for this function:

◆ getNearPlane()

float CameraLookAt::getNearPlane ( ) const
inline

References CameraProperty::key, and tabs().

Referenced by BasicGLPane::saveImage().

Here is the caller graph for this function:

◆ getProperties()

void CameraLookAt::getProperties ( CameraProperties p) const
virtual

◆ getTarget()

Point3D CameraLookAt::getTarget ( ) const

Get the look at target.

References target.

◆ getViewWidth()

float CameraLookAt::getViewWidth ( float  depth) const

◆ lookAt()

void CameraLookAt::lookAt ( ) const

Only apply the look-at opengl transform.

References ASSERT, Camera::origin, target, and Camera::upDirection.

Referenced by apply().

Here is the caller graph for this function:

◆ move()

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

◆ pivot()

void CameraLookAt::pivot ( float  lrRad,
float  udRad 
)
virtual

◆ readState()

bool CameraLookAt::readState ( xmlNodePtr  nodePtr)
virtual

◆ recomputeUpDirection()

void CameraLookAt::recomputeUpDirection ( )

Ensure that up direction is perpendicular to view direction.

References Point3D::crossProd(), Point3D::normalise(), Camera::upDirection, and Camera::viewDirection.

Referenced by ensureVisible(), pivot(), roll(), and setProperty().

Here is the caller graph for this function:

◆ recomputeViewDirection()

void CameraLookAt::recomputeViewDirection ( )
protected

References Point3D::normalise(), Camera::origin, target, and Camera::viewDirection.

Referenced by ensureVisible(), move(), pivot(), readState(), setOrigin(), and setTarget().

Here is the caller graph for this function:

◆ repositionAroundTarget()

void CameraLookAt::repositionAroundTarget ( unsigned int  direction)

◆ roll()

void CameraLookAt::roll ( float  roll)
virtual

◆ setFrustumDistort()

void CameraLookAt::setFrustumDistort ( float  offset)
inline

◆ setOrigin()

void CameraLookAt::setOrigin ( const Point3D newOrigin)
virtual

Set the look at target.

Reimplemented from Camera.

References ASSERT, Camera::lock, Camera::origin, recomputeViewDirection(), Point3D::sqrDist(), and target.

Referenced by repositionAroundTarget().

Here is the caller graph for this function:

◆ setProperty()

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

◆ setTarget()

void CameraLookAt::setTarget ( const Point3D pt)

Set the look at target.

References ASSERT, Camera::origin, recomputeViewDirection(), Point3D::sqrDist(), and target.

Referenced by MainWindowFrame::realignCameraButton().

Here is the caller graph for this function:

◆ translate()

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

◆ writeState()

bool CameraLookAt::writeState ( std::ostream &  f,
unsigned int  format,
unsigned int  tabs = 0 
) const
virtual

Friends And Related Function Documentation

◆ operator<<

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

Streaming output operator, presents human readable text.

Member Data Documentation

◆ farPlane

float CameraLookAt::farPlane
mutableprotected

Far plane is computed on-the-fly. cannot be set directly. Oh no! mutable. gross!

Referenced by apply(), and clone().

◆ fovAngle

float CameraLookAt::fovAngle
protected

◆ frustumDistortion

float CameraLookAt::frustumDistortion
protected

Distort to the viewing frustum. (eg for stero) ( a frustum is a rectangular pyramid with the top cut off)

◆ nearPlane

float CameraLookAt::nearPlane
protected

Near clipping plane distance.

Referenced by apply(), clone(), ensureVisible(), operator<<(), readState(), and writeState().

◆ target

Point3D CameraLookAt::target
protected

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