MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ogl::Camera Class Reference

A camera class that manages viewing and projection matrices. More...

#include <camera.h>

Public Member Functions

 Camera (void)
 Inits with default values but does not calculate the matrices.
 
float get_aspect (void) const
 Sets the viewing parameters and calcualtes view matrices.
 
float get_vertical_fov (void) const
 Returns the vertical FOV of the projection in RAD.
 
void update_inv_proj_mat (void)
 Updates inverse projection matrix from znear, zfar and aspect.
 
void update_inv_view_mat (void)
 Updates the inverse view matrix from pos, viewdir and upvec.
 
void update_matrices (void)
 Updates view, projection and inverse matrices.
 
void update_proj_mat (void)
 Updates the projection matrix from znear, zfar and aspect.
 
void update_view_mat (void)
 Updates the view matrix from pos, viewdir and upvec.
 

Public Attributes

int height
 The viewport height.
 
math::Matrix4f inv_proj
 Inverse projection matrix, use update_matrices() to calculate.
 
math::Matrix4f inv_view
 Inverse view matrix, use update_matrices() to calculate.
 
math::Vec3f pos
 Position of the camera.
 
math::Matrix4f proj
 Projection matrix, use update_matrices() to calculate.
 
float right
 Right and -Left clipping plane of the projection matrix.
 
float top
 Top and -Bottom clipping plane of the projection matrix.
 
math::Vec3f up_vec
 Up-vector of the camera.
 
math::Matrix4f view
 View matrix, use update_matrices() to calculate.
 
math::Vec3f viewing_dir
 Viewing direction of the camera.
 
int width
 The viewport width.
 
float z_far
 Far clipping plane of the projection matrix.
 
float z_near
 Near clipping plane of the projection matrix.
 

Detailed Description

A camera class that manages viewing and projection matrices.

The camera is specified by a viewing matrix that transforms from world to camera coordinates, and a projection matrix that transforms from camera to unit cube coordinates as defined by OpenGL.

Viewing parameters are given by camera position, viewing direction and up-vector. Projection parameters are z-near and far plane scalars as well as top (also -bottom) and right (also -left) scalars, that define the projection into the OpenGL unit cube.

Definition at line 32 of file camera.h.

Constructor & Destructor Documentation

◆ Camera()

ogl::Camera::Camera ( void  )
inline

Inits with default values but does not calculate the matrices.

Definition at line 104 of file camera.h.

Member Function Documentation

◆ get_aspect()

float ogl::Camera::get_aspect ( void  ) const
inline

Sets the viewing parameters and calcualtes view matrices.

Sets the projection parameters and calcualtes the proj matrices. Returns the aspect ratio, right / top, or, width / height.

Definition at line 122 of file camera.h.

◆ get_vertical_fov()

float ogl::Camera::get_vertical_fov ( void  ) const
inline

Returns the vertical FOV of the projection in RAD.

Definition at line 128 of file camera.h.

◆ update_inv_proj_mat()

void ogl::Camera::update_inv_proj_mat ( void  )
inline

Updates inverse projection matrix from znear, zfar and aspect.

Definition at line 164 of file camera.h.

◆ update_inv_view_mat()

void ogl::Camera::update_inv_view_mat ( void  )
inline

Updates the inverse view matrix from pos, viewdir and upvec.

Definition at line 150 of file camera.h.

◆ update_matrices()

void ogl::Camera::update_matrices ( void  )
inline

Updates view, projection and inverse matrices.

Definition at line 134 of file camera.h.

◆ update_proj_mat()

void ogl::Camera::update_proj_mat ( void  )
inline

Updates the projection matrix from znear, zfar and aspect.

Definition at line 157 of file camera.h.

◆ update_view_mat()

void ogl::Camera::update_view_mat ( void  )
inline

Updates the view matrix from pos, viewdir and upvec.

Definition at line 143 of file camera.h.

Member Data Documentation

◆ height

int ogl::Camera::height

The viewport height.

Definition at line 61 of file camera.h.

◆ inv_proj

math::Matrix4f ogl::Camera::inv_proj

Inverse projection matrix, use update_matrices() to calculate.

Definition at line 72 of file camera.h.

◆ inv_view

math::Matrix4f ogl::Camera::inv_view

Inverse view matrix, use update_matrices() to calculate.

Definition at line 68 of file camera.h.

◆ pos

math::Vec3f ogl::Camera::pos

Position of the camera.

Definition at line 39 of file camera.h.

◆ proj

math::Matrix4f ogl::Camera::proj

Projection matrix, use update_matrices() to calculate.

Definition at line 70 of file camera.h.

◆ right

float ogl::Camera::right

Right and -Left clipping plane of the projection matrix.

Definition at line 54 of file camera.h.

◆ top

float ogl::Camera::top

Top and -Bottom clipping plane of the projection matrix.

Definition at line 52 of file camera.h.

◆ up_vec

math::Vec3f ogl::Camera::up_vec

Up-vector of the camera.

Definition at line 43 of file camera.h.

◆ view

math::Matrix4f ogl::Camera::view

View matrix, use update_matrices() to calculate.

Definition at line 66 of file camera.h.

◆ viewing_dir

math::Vec3f ogl::Camera::viewing_dir

Viewing direction of the camera.

Definition at line 41 of file camera.h.

◆ width

int ogl::Camera::width

The viewport width.

Definition at line 59 of file camera.h.

◆ z_far

float ogl::Camera::z_far

Far clipping plane of the projection matrix.

Definition at line 50 of file camera.h.

◆ z_near

float ogl::Camera::z_near

Near clipping plane of the projection matrix.

Definition at line 48 of file camera.h.


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