Molecular Vis
Improving perception of molecular visualization
Camera Class Reference

A class for an arc-ball camera. More...

#include <Camera.h>

Public Member Functions

 Camera (float fov, float aspect, float near, float far)
 
glm::mat4 getInverseProjectionViewMatrix ()
 
glm::mat4 getProjectionViewMatrix ()
 
glm::mat4 getViewMatrix ()
 
glm::vec3 getPosition ()
 
glm::vec3 getDirection ()
 
void update (int x, int y, float zoom, bool dragging, bool strafing)
 

Detailed Description

A class for an arc-ball camera.

This class defines a camera and calculates the needed transformations, projections and vectors derived from the camera. The camera is an arc ball camera.

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( float  fov,
float  aspect,
float  near,
float  far 
)

Creates a camera with given parameter, which define the projection matrix.

Parameters
fovField of view of projection in degrees.
aspectAspect ratio of projection.
nearNear plane z.
farFar plane z.

Member Function Documentation

◆ getDirection()

glm::vec3 Camera::getDirection ( )

Return the normalized view axis direction.

Returns
glm::vec3 Normalized view direction. Has length 1.

◆ getInverseProjectionViewMatrix()

glm::mat4 Camera::getInverseProjectionViewMatrix ( )

Gets the inverse of the projection view matrix. Transforms from screen space to world space.

Returns
glm::mat4 inverse of the projection view matrix

◆ getPosition()

glm::vec3 Camera::getPosition ( )

Gets the position of the camera.

Returns
glm::vec3 Pposition of camera.

◆ getProjectionViewMatrix()

mat4 Camera::getProjectionViewMatrix ( )

Gets the the projection view matrix. Transforms from world space to screen space.

Returns
glm::mat4 the projection view matrix

◆ getViewMatrix()

glm::mat4 Camera::getViewMatrix ( )

Gets the the view matrix. Transforms from world space to camera space.

Returns
glm::mat4 the view matrix

◆ update()

void Camera::update ( int  x,
int  y,
float  zoom,
bool  dragging,
bool  strafing 
)

Updates the camera position and direction. Has to be updated often as relative movement is used, therefor if the camera wasn't updated for some time the position and direction can jump by a lot.

Parameters
xx coordinate of mouse in pixel
yy coordinates of mouse in pixel
zoomzoom radius, corresponds to the distance from the focus point to the camera.
draggingif the movement should change the orientation (dragging the camera around on a ball)
strafingif the camera position should be moved in the tangential plane on the sphere where the camera is placed. (strafing movement)

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