Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
Tucano::Flycamera Class Reference

Flythrough camera class for manipulating a camera. More...

#include <flycamera.hpp>

Inheritance diagram for Tucano::Flycamera:
Tucano::Camera Tucano::Freecamera

Public Member Functions

virtual void reset (void)
 Resets camera to initial position and orientation. More...
 
 ~Flycamera ()
 Default destructor. More...
 
void initOpenGLMatrices (void)
 Initializes the view and projection matrices. They are all initialized as Identity matrices, but view is then translated by the defaultTranslation vector. More...
 
 Flycamera ()
 Default constructor. More...
 
void setDefaultView (Eigen::Affine3f view)
 Set default rotation and translation from and Affine3f matrix. More...
 
Eigen::Vector3f getDefaultTranslation (void)
 Returns the default translation for placing the camera outside the trackball sphere. More...
 
void renderAtCorner (void)
 Renders the camera's coordinate axis at the lower right corner of the screen. More...
 
virtual void updateViewMatrix ()
 Compose rotation and translation. More...
 
virtual void strideLeft (void)
 Translates the view matrix to the left. More...
 
virtual void strideRight (void)
 Translates the view matrix to the right. More...
 
virtual void moveBack (void)
 Translates the view matrix back. More...
 
virtual void moveForward (void)
 Translates the view matrix forward. More...
 
virtual void moveDown (void)
 Translates the view matrix down. More...
 
virtual void moveUp (void)
 Translates the view matrix up. More...
 
Eigen::Vector2f normalizePosition (const Eigen::Vector2f &pos)
 Nomalizes a screen position to range [-1,1]. More...
 
void startRotation (Eigen::Vector2f pos)
 Begin view direction rotation. More...
 
virtual void rotate (Eigen::Vector2f new_mouse_pos)
 Rotates the camera view direction. More...
 
virtual void rotateZ (Eigen::Vector2f new_mouse_pos)
 Rotates the camera view direction around Z axis. Default implementation does nothing. More...
 
void setSpeed (const float &speed)
 Changes the camera speed. More...
 
- Public Member Functions inherited from Tucano::Camera
void resetViewMatrix (void)
 Reset view matrix. More...
 
void resetProjectionMatrix (void)
 Reset projection matrix. More...
 
void reset (void)
 Resets trackball to initial position and orientation. More...
 
Eigen::Vector3f getCenter (void) const
 Returns the center of the camera in world space. More...
 
void getViewMatrix (GLdouble *matrix)
 Return the modelview matrix as a GLdouble array. More...
 
void getProjectionMatrix (GLdouble *matrix)
 Return the projection matrix as a GLdouble array. More...
 
Eigen::Vector3f projectPoint (const Eigen::Vector4f &pt, Eigen::Vector4f &viewport)
 Returns screen space coordinates of a 3D point. More...
 
Eigen::Affine3f getViewMatrix (void) const
 Returns the view matrix as an Affine 3x3 matrix. More...
 
Eigen::Affine3f * viewMatrix (void)
 Returns a pointer to the view matrix as an Affine 3x3 matrix. More...
 
Eigen::Matrix4f getProjectionMatrix (void) const
 Returns the view matrix as an 4x4 matrix. More...
 
Eigen::Matrix4f * projectionMatrix (void)
 Returns a pointer to the projection matrix as an 4x4 matrix. More...
 
Eigen::Matrix3f getRotationMatrix (void) const
 Returns a 3x3 matrix containing only the rotation of the view matrix. More...
 
Eigen::Vector3f getTranslationMatrix (void) const
 Returns the translation part of the view matrix as a vector. More...
 
float getPerspectiveScale (void) const
 Returns the perspective scale. More...
 
Eigen::Vector4f getViewport (void) const
 Returns the viewport coordinates. More...
 
Eigen::Vector2i getViewportSize (void) const
 Returns the dimensions of the viewport. More...
 
float getViewportAspectRatio (void) const
 Returns the viewport aspect ratio. More...
 
void setViewport (const Eigen::Vector4f &vp)
 Sets the viewport coordinates. More...
 
void setViewport (const Eigen::Vector2i &vp)
 
void setViewport (const Eigen::Vector2f &vp)
 Sets the viewport coordinates considering that the minimum coordinates are zero. More...
 
void setProjectionMatrix (const Eigen::Matrix4f &mat)
 Sets the projection matrix from a given 4x4 matrix. More...
 
void setViewMatrix (const Eigen::Affine3f &mat)
 Sets the view matrix from a given an affine 3x3 matrix. More...
 
float getNearPlane (void) const
 Returns near plane value. More...
 
float getFarPlane (void) const
 Returns far plane value. More...
 
 ~Camera ()
 Default destructor. More...
 
float getFovy (void) const
 Returns current field of view angle in y axis. More...
 
 Camera (void)
 Default constructor. More...
 
Eigen::Matrix4f setPerspectiveMatrix (float fy, float in_aspect_ratio, float in_near_plane, float in_far_plane)
 Sets the projection matrix as a perspective matrix. More...
 
void changeFovy (float new_fovy)
 Changes the fovy and computes new perspective projection matrix. More...
 
Eigen::Matrix4f setOrthographicMatrix (float left, float right, float bottom, float top, float near_plane, float far_plane)
 Sets the projection matrix as a orthographic matrix. More...
 
void incrementFov (float inc)
 Increases the fov of the perspective matrix by a given increment. More...
 
void translate (const Eigen::Vector3f &translation)
 Translates the view matrix by a given vector. More...
 
void rotate (const Eigen::Quaternion< float > &rotation)
 Rotate the view matrix by a given quaternion. More...
 
void scale (const Eigen::Vector3f &scale_factors)
 Scales the view matrix by given factors. More...
 
void scale (float scale_factor)
 Scales the view matrix by given factor in all axis. More...
 

Protected Attributes

float speed
 Global movement speed. More...
 
Eigen::Vector2f start_mouse_pos
 Current mouse position. More...
 
Eigen::Matrix3f rotation_matrix
 Camera rotation (view direction) More...
 
Eigen::Matrix3f default_rotation
 Default start rotation matrix. More...
 
Eigen::Vector3f translation_vector
 Camera position. More...
 
Eigen::Vector3f default_translation
 
float rotation_Y_axis
 Rotation angles. More...
 
float rotation_X_axis
 
Tucano::Shapes::CoordinateAxes axes
 
- Protected Attributes inherited from Tucano::Camera
Eigen::Matrix4f projection_matrix
 Projection, or intrinsic, matrix. More...
 
Eigen::Affine3f view_matrix
 View, or extrinsic, matrix. More...
 
Eigen::Vector4f viewport
 Viewport dimensions [minX, minY, width, height]. More...
 
Eigen::Affine3f default_view
 
float near_plane
 Near plane used for projection matrix. More...
 
float far_plane
 Far plane used for projection matrix. More...
 
float frustum_left
 Frustum left dimension. More...
 
float frustum_right
 Frustum right dimension. More...
 
float frustum_top
 Frustum top dimension. More...
 
float frustum_bottom
 Frustum bottom dimension. More...
 
float aspect_ratio
 Aspect ratio for projection matrix. More...
 
float focal_length
 Camera's Focal Length. More...
 
float fovy
 Field of view angle in y axis. More...
 
bool use_perspective
 Flag to indicate if using a perspective or othograpic projection. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Tucano::Camera
static Eigen::Matrix4f createPerspectiveMatrix (float fy, float in_aspect_ratio, float in_near_plane, float in_far_plane)
 Returns a perspective projection matrix with the given parameters. More...
 
static Eigen::Matrix4f createOrthographicMatrix (float left, float right, float bottom, float top, float near_plane, float far_plane)
 Returns an orthographic projection matrix with the given parameters. More...
 

Detailed Description

Flythrough camera class for manipulating a camera.

This class simulates a flythrough camera with 6 DOF.

Constructor & Destructor Documentation

Tucano::Flycamera::~Flycamera ( )
inline

Default destructor.

Tucano::Flycamera::Flycamera ( )
inline

Default constructor.

Member Function Documentation

Eigen::Vector3f Tucano::Flycamera::getDefaultTranslation ( void  )
inline

Returns the default translation for placing the camera outside the trackball sphere.

Returns
The default translation vector for the view matrix
void Tucano::Flycamera::initOpenGLMatrices ( void  )
inline

Initializes the view and projection matrices. They are all initialized as Identity matrices, but view is then translated by the defaultTranslation vector.

virtual void Tucano::Flycamera::moveBack ( void  )
inlinevirtual

Translates the view matrix back.

Reimplemented in Tucano::Freecamera.

virtual void Tucano::Flycamera::moveDown ( void  )
inlinevirtual

Translates the view matrix down.

Reimplemented in Tucano::Freecamera.

virtual void Tucano::Flycamera::moveForward ( void  )
inlinevirtual

Translates the view matrix forward.

Reimplemented in Tucano::Freecamera.

virtual void Tucano::Flycamera::moveUp ( void  )
inlinevirtual

Translates the view matrix up.

Reimplemented in Tucano::Freecamera.

Eigen::Vector2f Tucano::Flycamera::normalizePosition ( const Eigen::Vector2f &  pos)
inline

Nomalizes a screen position to range [-1,1].

Parameters
posScreen position
Returns
Returns position in normalized coordinates.
void Tucano::Flycamera::renderAtCorner ( void  )
inline

Renders the camera's coordinate axis at the lower right corner of the screen.

virtual void Tucano::Flycamera::reset ( void  )
inlinevirtual

Resets camera to initial position and orientation.

Reimplemented in Tucano::Freecamera.

virtual void Tucano::Flycamera::rotate ( Eigen::Vector2f  new_mouse_pos)
inlinevirtual

Rotates the camera view direction.

Parameters
new_mouse_posNew mouse position

Reimplemented in Tucano::Freecamera.

virtual void Tucano::Flycamera::rotateZ ( Eigen::Vector2f  new_mouse_pos)
inlinevirtual

Rotates the camera view direction around Z axis. Default implementation does nothing.

Parameters
new_mouse_posNew mouse position

Reimplemented in Tucano::Freecamera.

void Tucano::Flycamera::setDefaultView ( Eigen::Affine3f  view)
inline

Set default rotation and translation from and Affine3f matrix.

Parameters
viewAffine view matrix to set as default start rotation and translation
void Tucano::Flycamera::setSpeed ( const float &  speed)
inline

Changes the camera speed.

Parameters
speedNew camera speed.
void Tucano::Flycamera::startRotation ( Eigen::Vector2f  pos)
inline

Begin view direction rotation.

Parameters
posMouse coordinates
virtual void Tucano::Flycamera::strideLeft ( void  )
inlinevirtual

Translates the view matrix to the left.

Reimplemented in Tucano::Freecamera.

virtual void Tucano::Flycamera::strideRight ( void  )
inlinevirtual

Translates the view matrix to the right.

Reimplemented in Tucano::Freecamera.

virtual void Tucano::Flycamera::updateViewMatrix ( )
inlinevirtual

Compose rotation and translation.

Reimplemented in Tucano::Freecamera.

Member Data Documentation

Tucano::Shapes::CoordinateAxes Tucano::Flycamera::axes
protected
Eigen::Matrix3f Tucano::Flycamera::default_rotation
protected

Default start rotation matrix.

Eigen::Vector3f Tucano::Flycamera::default_translation
protected
Eigen::Matrix3f Tucano::Flycamera::rotation_matrix
protected

Camera rotation (view direction)

float Tucano::Flycamera::rotation_X_axis
protected
float Tucano::Flycamera::rotation_Y_axis
protected

Rotation angles.

float Tucano::Flycamera::speed
protected

Global movement speed.

Eigen::Vector2f Tucano::Flycamera::start_mouse_pos
protected

Current mouse position.

Eigen::Vector3f Tucano::Flycamera::translation_vector
protected

Camera position.


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