Tucano
0.1
A library for rapid prototyping with modern OpenGL and GLSL
|
Mainpulator for translating a mesh. More...
#include <trackball.hpp>
Public Member Functions | |
Eigen::Vector3f | computeTranslationVector (void) |
Compute the trackball's translation, using stored initial and final position vectors. More... | |
Eigen::Vector3f | translateCamera (const Eigen::Vector2f &pos) |
Computes and applies the translation transformations to the trackball given new position. More... | |
void | updateViewMatrix (void) |
Applies all trackball's transformations to the view matrix. More... | |
Public Member Functions inherited from Tucano::Manipulator | |
Manipulator (void) | |
Default constructor. More... | |
Eigen::Vector3f | getSpherePos (void) |
Returns the manipulator 3D position. More... | |
void | setSpherePos (const Eigen::Vector3f &pos) |
Sets the manipulator 3D position. More... | |
void | setExternalCamera (Tucano::Camera *ext_cam) |
Sets the pointer to the external camera The external camera is the actual view camera since the trackball is used here as a mesh manipulator. More... | |
Public Member Functions inherited from Tucano::Trackball | |
Trackball (string shader_dir="") | |
Default constructor. More... | |
void | reset (void) |
Resets trackball to initial position and orientation. More... | |
bool | isRotating (void) |
Returns wether the trackball is being rotated or not. More... | |
bool | isTranslating (void) |
Returns wether the trackball is being translated or not. More... | |
Eigen::Vector3f | getDefaultTranslation (void) |
Returns the default translation for placing the camera outside the trackball sphere. More... | |
void | setDefaultTranslation (Eigen::Vector3f t) |
Sets the default translation vector. More... | |
Eigen::Quaternion< float > | getDefaultRotation (void) |
Returns the default rotation quaternion. More... | |
virtual Eigen::Quaternion< float > | getRotation (void) |
Returns the rotation (without the default part) as a quaternion. More... | |
void | setDefaultRotation (Eigen::Matrix3f rot) |
Sets the default rotation quaternion. More... | |
virtual void | setRadius (float r) |
Sets the radius. More... | |
float | getZoom (void) |
Retuns the zoom factor (the radius of the trackball). More... | |
void | setTrackballProjectionMatrix (const Eigen::Matrix4f &mat) |
Sets the projection matrix used for the trackball rendering. Note that this is usually different than the projection matrix for the scene. More... | |
virtual void | endRotation (void) |
Indicates that a rotation has ended. Disables the rotating flag, indicating that the mouse callback functions will stop reading the mouse coordinates in order to stop the trackball's rotation. More... | |
void | endTranslation (void) |
Indicates that a translation has ended. Disable the translating flag, indicating that the mouse callback functions will stop reading the mouse coordinates in order to stop the trackball's translation. More... | |
void | setRenderFlag (bool flag) |
Returns wether the trackball representation should be drawn or not. More... | |
void | loadShader (void) |
Load Trackball Shader file. More... | |
void | initOpenGLMatrices (void) |
Initializes the view and projection matrices. They are all initialized as Identity matrices, but view is then translated by the default_translation vector. More... | |
Eigen::Matrix4f | setTrackballPerspectiveMatrix (float fy, float aspect_ratio, float near_plane, float far_plane) |
Sets the trackball projection matrix as perspective. More... | |
Eigen::Matrix4f | setTrackballOrthographicMatrix (float left, float right, float bottom, float top, float near_plane, float far_plane) |
Sets the trackball projection matrix as orthographic. More... | |
virtual Eigen::Quaternion< float > | computeRotationAngle (float sensibility=1.0) |
Computes the trackball's rotation, using stored initial and final position vectors. More... | |
Eigen::Vector2f | normalizePosition (const Eigen::Vector2f &pos) |
Nomalizes a screen position to range [-1,1]. More... | |
virtual Eigen::Quaternion< float > | rotateCamera (const Eigen::Vector2f &pos) |
Computes and applies the rotation transformations to the trackball given new position. More... | |
void | increaseZoom (float scale) |
Increases the zoom on the scene by appling a scale to the View Matrix. The current scale used in View Matrix is multiplied by the given scale factor. More... | |
void | decreaseZoom (float scale) |
Decreases the zoom on the scene by appling a scale to the View Matrix. The current scale used in View Matrix is divided by the given scale factor. More... | |
void | applyScaleToViewMatrix (float scale) |
Applies a scale factor to the viewMatrix. The current scale used in view matrix will be substituted by the given scale factor. More... | |
void | translateViewMatrix (const Eigen::Vector3f &translation) |
Translates the view matrix by a given vector trans. This directly modifies the translation vector of the trackball. Note that the view matrix is always recomputed using the translation, quaternion and zoom. More... | |
void | rotateViewMatrix (const Eigen::Affine3f &rot) |
Rotates the view matrix by a given rotation matrix. This directly modifies the quaternion of the trackball. Note that the view matrix is always recomputed using the translation, quaternion and zoom. More... | |
void | createTrackballRepresentation (void) |
Creates the circle representating rotation around Z axis. The other circles will be created by simply rotating this one around the desired axis. More... | |
virtual void | render (Eigen::Affine3f ext_view_matrix=Eigen::Affine3f::Identity(), Eigen::Matrix4f ext_proj_matrix=Eigen::Matrix4f::Identity()) |
Renders the trackball representation. 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... | |
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... | |
Protected Attributes inherited from Tucano::Manipulator | |
Tucano::Camera * | external_camera |
Pointer to external camera. More... | |
Eigen::Vector3f | sphere_position = Eigen::Vector3f::Zero() |
Clicked position on manipulator sphere. More... | |
Protected Attributes inherited from Tucano::Trackball | |
float | zoom = 1.0 |
The current scale being applied to the View Matrix. More... | |
bool | rotating = false |
Flag that indicates wether the trackball is being rotated. More... | |
bool | translating = false |
Flag that indicates wether the trackball is being translated. More... | |
bool | drawTrackball = true |
Flag that indicates wether the trackball's representation should be drawn. More... | |
Eigen::Matrix4f | trackballProjectionMatrix |
Projection matrix used for the trackball's drawing. By default it is defined as an orthogonal projection matrix. More... | |
Eigen::Vector3f | initialPosition |
Initial position vector used to calculate trackball's rotation. More... | |
Eigen::Vector3f | finalPosition |
Final position vector used to calculate trackball's rotation. More... | |
Eigen::Vector2f | initialTranslationPosition |
Initial position vector used to calculate trackball's translation. More... | |
Eigen::Vector2f | finalTranslationPosition |
Final position vector used to calculate trackball's translation. More... | |
Eigen::Quaternion< float > | quaternion |
Trackball's quaternion. More... | |
Eigen::Quaternion< float > | default_quaternion |
Trackball's default rotation. More... | |
Eigen::Vector3f | translationVector |
Trackball's translation vector. More... | |
Eigen::Vector3f | default_translation = Eigen::Vector3f (0.0, 0.0, -4.0) |
Default translation to move camera away from center. More... | |
Tucano::Shader | trackball_shader |
Trackball Shader, used just for rendering the trackball's representation. More... | |
Tucano::Mesh | mesh |
Trackball visual representation. More... | |
float | radius = 0.8 |
The trackball radius. It's defined as 0.8 times the smallest viewport dimension. More... | |
bool | use_default_shaders |
Flag to use default shaders set as const strings in class, or pass a directory with custom shaders. More... | |
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... | |
Mainpulator for translating a mesh.
|
inlinevirtual |
Compute the trackball's translation, using stored initial and final position vectors.
Reimplemented from Tucano::Trackball.
|
inlinevirtual |
Computes and applies the translation transformations to the trackball given new position.
pos | New mouse position in normalized trackball system |
Reimplemented from Tucano::Trackball.
|
inlinevirtual |
Applies all trackball's transformations to the view matrix.
Reimplemented from Tucano::Trackball.