iMSTK
Interactive Medical Simulation Toolkit
Public Member Functions | Protected Attributes | Friends | List of all members
imstk::Camera Class Reference

Produces a perpsective transformation matrix. More...

#include <imstkCamera.h>

Public Member Functions

Mat4d & getView ()
 Get camera view matrix. More...
 
const Mat4d & getHMDView () const
 Get the HMD view, supplied when using VR.
 
Mat4d & getProj ()
 Get camera projection matrix, this matrix will be identity until first render is done. More...
 
const Mat4d & getInvView ()
 Get the inverse view matrix.
 
void setView (const Mat4d &view)
 Set the camera view matrix.
 
double getFieldOfView () const
 Gets the field of view. More...
 
void setFieldOfView (const double fov)
 Sets the field of view. More...
 
void setNearZ (const double nearZ)
 Set clipping near note: You lose depth accuracy as the range between near and far increases could cause z fighting.
 
double getNearZ () const
 
void setFarZ (const double farZ)
 Set clipping near note: You lose depth accuracy as the range between near and far increases could cause z fighting.
 
double getFarZ () const
 
virtual void update ()
 
const Vec3d & getPosition () const
 Gets the camera position. More...
 
void setPosition (const Vec3d &pos)
 Sets the camera position.
 
void setPosition (const double x, const double y, const double z)
 
const Vec3d & getFocalPoint () const
 Returns the focal point The focal point is the point that the camera points to. More...
 
void setFocalPoint (const Vec3d &focalPt)
 Sets the point to look at, point the camera towards.
 
void setFocalPoint (const double x, const double y, const double z)
 
const Vec3d & getViewUp () const
 Get the up direction of the view.
 
Vec3d getForward () const
 Get the forward/look direction of the view.
 
Vec3d getEyeRayDir (const Vec2d &ndcPos) const
 Compute ray emanating from the camera position that travels through the point in normalized device coordinates (-1,1 on x and y view plane)
 
void setViewUp (const Vec3d &up)
 Set the up vector.
 
void setViewUp (const double x, const double y, const double z)
 
void print ()
 Utility function to quickly print cam stats.
 

Protected Attributes

Mat4d m_view = Mat4d::Identity()
 Actual view matrix used.
 
Mat4d m_invView = Mat4d::Identity()
 Inverse is often needed so we maintain it.
 
Mat4d m_proj
 Only modifiable through projection parameters (fov,near,far)
 
bool m_viewModified = true
 
double m_fieldOfView = 40.0
 field of view in degrees
 
double m_nearZ = 0.01
 near plane of the camera
 
double m_farZ = 1000.0
 far plane of the camera
 
Vec3d m_position = Vec3d(0.0, 0.0, 0.0)
 camera position
 
Vec3d m_focalPoint = -Vec3d::UnitZ()
 camera focal point
 
Vec3d m_viewUp = Vec3d::UnitY()
 camera up vector
 
Mat4d m_hmdView = Mat4d::Identity()
 

Friends

class VTKRenderer
 Allows setting of the projection matrix without exposing a setter only renders may set it.
 

Detailed Description

Produces a perpsective transformation matrix.

The base camera class defines a lookat camera

Definition at line 58 of file imstkCamera.h.

Member Function Documentation

◆ getFieldOfView()

double imstk::Camera::getFieldOfView ( ) const
inline

Gets the field of view.

Returns
vertical field of view in degrees

Definition at line 107 of file imstkCamera.h.

◆ getFocalPoint()

const Vec3d& imstk::Camera::getFocalPoint ( ) const
inline

Returns the focal point The focal point is the point that the camera points to.

Returns
Focal point position

Definition at line 177 of file imstkCamera.h.

◆ getPosition()

const Vec3d& imstk::Camera::getPosition ( ) const
inline

Gets the camera position.

Returns
camera position

Definition at line 154 of file imstkCamera.h.

◆ getProj()

Mat4d& imstk::Camera::getProj ( )
inline

Get camera projection matrix, this matrix will be identity until first render is done.

Returns
Camera projection matrix reference

Definition at line 86 of file imstkCamera.h.

◆ getView()

Mat4d& imstk::Camera::getView ( )
inline

Get camera view matrix.

Returns
Camera view matrix reference

Definition at line 74 of file imstkCamera.h.

◆ setFieldOfView()

void imstk::Camera::setFieldOfView ( const double  fov)
inline

Sets the field of view.

Parameters
verticalfield of view in degrees

Definition at line 113 of file imstkCamera.h.


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