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

Free camera class for manipulating a camera. More...

#include <freecamera.hpp>

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

Public Member Functions

void reset (void) override
 Resets camera to initial position and orientation. More...
 
void updateViewMatrix () override
 Compose rotation and translation. More...
 
void strideLeft (void) override
 Translates the view matrix to the left. More...
 
void strideRight (void) override
 Translates the view matrix to the right. More...
 
void moveBack (void) override
 Translates the view matrix back. More...
 
void moveForward (void) override
 Translates the view matrix forward. More...
 
void moveDown (void) override
 Translates the view matrix down. More...
 
void moveUp (void) override
 Translates the view matrix up. More...
 
void rotate (Eigen::Vector2f new_mouse_pos) override
 Rotates the camera view direction around X and Y axes. More...
 
void rotateZ (Eigen::Vector2f new_mouse_pos) override
 Rotates the camera view direction around Z axis. More...
 
- Public Member Functions inherited from Tucano::Flycamera
 ~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...
 
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...
 
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 rotation_Z_axis
 
- Protected Attributes inherited from Tucano::Flycamera
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

Free camera class for manipulating a camera.

This class simulates a free camera which apply transformations based on camera's frame, instead of world's frame.

Member Function Documentation

void Tucano::Freecamera::moveBack ( void  )
inlineoverridevirtual

Translates the view matrix back.

Reimplemented from Tucano::Flycamera.

void Tucano::Freecamera::moveDown ( void  )
inlineoverridevirtual

Translates the view matrix down.

Reimplemented from Tucano::Flycamera.

void Tucano::Freecamera::moveForward ( void  )
inlineoverridevirtual

Translates the view matrix forward.

Reimplemented from Tucano::Flycamera.

void Tucano::Freecamera::moveUp ( void  )
inlineoverridevirtual

Translates the view matrix up.

Reimplemented from Tucano::Flycamera.

void Tucano::Freecamera::reset ( void  )
inlineoverridevirtual

Resets camera to initial position and orientation.

Reimplemented from Tucano::Flycamera.

void Tucano::Freecamera::rotate ( Eigen::Vector2f  new_mouse_pos)
inlineoverridevirtual

Rotates the camera view direction around X and Y axes.

Parameters
new_mouse_posNew mouse position

Reimplemented from Tucano::Flycamera.

void Tucano::Freecamera::rotateZ ( Eigen::Vector2f  new_mouse_pos)
inlineoverridevirtual

Rotates the camera view direction around Z axis.

Parameters
new_mouse_posNew mouse position

Reimplemented from Tucano::Flycamera.

void Tucano::Freecamera::strideLeft ( void  )
inlineoverridevirtual

Translates the view matrix to the left.

Reimplemented from Tucano::Flycamera.

void Tucano::Freecamera::strideRight ( void  )
inlineoverridevirtual

Translates the view matrix to the right.

Reimplemented from Tucano::Flycamera.

void Tucano::Freecamera::updateViewMatrix ( )
inlineoverridevirtual

Compose rotation and translation.

Reimplemented from Tucano::Flycamera.

Member Data Documentation

float Tucano::Freecamera::rotation_Z_axis
protected

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