|
| 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...
|
|
virtual Eigen::Vector3f | computeTranslationVector (void) |
| Compute the trackball's translation, 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...
|
|
virtual Eigen::Vector3f | translateCamera (const Eigen::Vector2f &pos) |
| Computes and applies the translation 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...
|
|
virtual void | updateViewMatrix (void) |
| Applies all trackball's transformations to the view matrix. 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...
|
|
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...
|
|
|
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...
|
|
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...
|
|
Trackball class for manipulating a camera.
This class simulates a standard trackball manipulation. The visual representation is a sphere with radius equal to 0.8 centered in the middle of the window (represented by the equation: x^2 + y^2 + z^2 = r^2), nested in an hyperbolic sheet opening (represented by the equation: z = (r^2/2)/sqrt(x^2+y^2). It is usually used for camera and light manipulation. It's important to notice that the x and y mouse coordinates passed to the trackball must be ranging from (-1,-1), being the lower left corner of screen, to (1,1) being the higher right corner. This means the coordinate system is centered in screen and normalized. Also, the view matrix is by default translated by the vector [0,0,-2], in order to remove the camera from the center of the world.