10#ifndef OGL_CAMERA_HEADER
11#define OGL_CAMERA_HEADER
85 float get_aspect (
void)
const;
87 float get_vertical_fov (
void)
const;
90 void update_matrices (
void);
92 void update_view_mat (
void);
94 void update_inv_view_mat (
void);
96 void update_proj_mat (
void);
98 void update_inv_proj_mat (
void);
105 : pos(0.0f, 0.0f, 5.0f)
106 , viewing_dir(0.0f, 0.0f, -1.0f)
107 , up_vec(0.0f, 1.0f, 0.0f)
130 return 2.0f * std::atan(this->
top / this->
z_near);
Matrix class for arbitrary dimensions and types.
Vector class for arbitrary dimensions and types.
A camera class that manages viewing and projection matrices.
float top
Top and -Bottom clipping plane of the projection matrix.
math::Vec3f pos
Position of the camera.
math::Vec3f up_vec
Up-vector of the camera.
math::Vec3f viewing_dir
Viewing direction of the camera.
math::Matrix4f inv_proj
Inverse projection matrix, use update_matrices() to calculate.
float get_vertical_fov(void) const
Returns the vertical FOV of the projection in RAD.
void update_view_mat(void)
Updates the view matrix from pos, viewdir and upvec.
void update_proj_mat(void)
Updates the projection matrix from znear, zfar and aspect.
math::Matrix4f inv_view
Inverse view matrix, use update_matrices() to calculate.
void update_matrices(void)
Updates view, projection and inverse matrices.
math::Matrix4f view
View matrix, use update_matrices() to calculate.
int width
The viewport width.
void update_inv_view_mat(void)
Updates the inverse view matrix from pos, viewdir and upvec.
float z_near
Near clipping plane of the projection matrix.
int height
The viewport height.
math::Matrix4f proj
Projection matrix, use update_matrices() to calculate.
float get_aspect(void) const
Sets the viewing parameters and calcualtes view matrices.
float right
Right and -Left clipping plane of the projection matrix.
void update_inv_proj_mat(void)
Updates inverse projection matrix from znear, zfar and aspect.
float z_far
Far clipping plane of the projection matrix.
Matrix< T, 4, 4 > matrix_inverse_gl_projection(T const &znear, T const &zfar, T const &top, T const &right)
Creates a symmetric inverse projection matrix as used in OpenGL.
Matrix< T, 4, 4 > matrix_inverse_viewtrans(Vector< T, 3 > const &campos, Vector< T, 3 > const &viewdir, Vector< T, 3 > const &upvec)
Creates an inverse view transformation matrix.
Matrix< T, 4, 4 > matrix_viewtrans(Vector< T, 3 > const &campos, Vector< T, 3 > const &viewdir, Vector< T, 3 > const &upvec)
Creates a view transformation matrix for camera parameters given as camera position,...
Matrix< T, 4, 4 > matrix_gl_projection(T const &znear, T const &zfar, T const &top, T const &right)
Creates a symmetric projection matrix as used in OpenGL.
#define OGL_NAMESPACE_END
#define OGL_NAMESPACE_BEGIN