Tucano
0.1
A library for rapid prototyping with modern OpenGL and GLSL
|
Defines an abstract camera with a projection and view matrices. More...
#include <camera.hpp>
Public Member Functions | |
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... | |
Static Public Member Functions | |
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 | |
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... | |
Defines an abstract camera with a projection and view matrices.
For a visual representation of a camera use the Shapers::CameraRep class
|
inline |
Default destructor.
|
inline |
Default constructor.
|
inline |
Changes the fovy and computes new perspective projection matrix.
new_fovy | New value for field of view. |
|
inlinestatic |
Returns an orthographic projection matrix with the given parameters.
left | Left plane for orthographic view. |
right | Right plane for orthographic view. |
bottom | Bottom plane for orthographic view. |
top | Top lane for orthographic view. |
near_plane | Near plane for orthographic view. |
far_plane | Far plane for orthographic view. |
|
inlinestatic |
Returns a perspective projection matrix with the given parameters.
fy | Vertical field of view angle |
in_aspect_ratio | Ratio of width to the height of the viewport |
in_near_plane | Near plane |
in_far_plane | Far plane |
|
inline |
Returns the center of the camera in world space.
|
inline |
Returns far plane value.
|
inline |
Returns current field of view angle in y axis.
|
inline |
Returns near plane value.
|
inline |
Returns the perspective scale.
Usually this is element(1,1) of the projection matrix.
|
inline |
Return the projection matrix as a GLdouble array.
Similar to OpenGL old method using glGet**(GL_PROJECTION_MATRIX)
matrix | A pointer to a GLdouble of at least 16 elements to fill with projection matrix. |
|
inline |
Returns the view matrix as an 4x4 matrix.
|
inline |
Returns a 3x3 matrix containing only the rotation of the view matrix.
|
inline |
Returns the translation part of the view matrix as a vector.
|
inline |
Return the modelview matrix as a GLdouble array.
Similar to OpenGL old method using glGet**(GL_MODELVIEW_MATRIX)
matrix | A pointer to a GLdouble of at least 16 elements to fill with view matrix. |
|
inline |
Returns the view matrix as an Affine 3x3 matrix.
|
inline |
Returns the viewport coordinates.
Viewport vector is as follows [minX, minY, width, height]
|
inline |
Returns the viewport aspect ratio.
|
inline |
Returns the dimensions of the viewport.
|
inline |
Increases the fov of the perspective matrix by a given increment.
inc | Given increment to increase fov |
|
inline |
Returns a pointer to the projection matrix as an 4x4 matrix.
|
inline |
Returns screen space coordinates of a 3D point.
Projects a given point to screen space using given viewport coordinates.
pt | Given point to be projected. |
viewport | Vector containing viewport coordinates in following order [minX, minY, maxX, maxY] |
|
inline |
Resets trackball to initial position and orientation.
|
inline |
Reset projection matrix.
|
inline |
Reset view matrix.
|
inline |
Rotate the view matrix by a given quaternion.
rotation | Rotation to apply to view matrix. |
|
inline |
Scales the view matrix by given factors.
scale_factors | Scale factors in x, y, and z axis. |
|
inline |
Scales the view matrix by given factor in all axis.
scale_factor | Scale factors in all axis. |
|
inline |
Sets the projection matrix as a orthographic matrix.
Creates an orthographic projection matrix with the given parameters and sets as the projection matrix.
left | Left plane for orthographic view. |
right | Right plane for orthographic view. |
bottom | Bottom plane for orthographic view. |
top | Top lane for orthographic view. |
near_plane | Near plane for orthographic view. |
far_plane | Far plane for orthographic view. |
|
inline |
Sets the projection matrix as a perspective matrix.
Creates a perspective matrix with the given parameters and sets as the projection matrix.
fy | Vertical field of view angle |
in_aspect_ratio | Ratio of width to the height of the viewport |
in_near_plane | Near plane |
in_far_plane | Far plane |
|
inline |
Sets the projection matrix from a given 4x4 matrix.
mat | Given 4x4 matrix to set as projection matrix. |
|
inline |
Sets the view matrix from a given an affine 3x3 matrix.
mat | Given Affine 3x3 matrix to set as view matrix. |
|
inline |
Sets the viewport coordinates.
vp | Viewport coordinates. |
|
inline |
|
inline |
Sets the viewport coordinates considering that the minimum coordinates are zero.
Sets the new viewport as [0, 0, vp[0], vp[1]]
vp | Viewport coordinates. |
|
inline |
Translates the view matrix by a given vector.
translation | Translation to apply to view matrix. |
|
inline |
Returns a pointer to the view matrix as an Affine 3x3 matrix.
|
protected |
Aspect ratio for projection matrix.
|
protected |
|
protected |
Far plane used for projection matrix.
|
protected |
Camera's Focal Length.
|
protected |
Field of view angle in y axis.
|
protected |
Frustum bottom dimension.
|
protected |
Frustum left dimension.
|
protected |
Frustum right dimension.
|
protected |
Frustum top dimension.
|
protected |
Near plane used for projection matrix.
|
protected |
Projection, or intrinsic, matrix.
|
protected |
Flag to indicate if using a perspective or othograpic projection.
|
protected |
View, or extrinsic, matrix.
|
protected |
Viewport dimensions [minX, minY, width, height].