SimpleFastOpenAtomicVisualiser
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Camera Class Reference

A 3D projective camera centered on a focus moving on a sphere. More...

#include <camera.h>

Public Member Functions

 Camera (const std::vector< Atom > &atoms, uint16_t resX, uint16_t resY)
 Construct a new Camera focussing on some Atoms.
 
 Camera (glm::vec3 positionSpherical, uint16_t resX, uint16_t resY)
 Construct a new Camera at a given position.
 
void reset ()
 Set the default view.
 
void reset (const std::vector< Atom > &atoms)
 Set the default view.
 
void zoom (float increment)
 Increment the zoom.
 
void incline (float increment)
 Incline about the y OpenGL axis.
 
void rotate (float increment)
 Rotate about the y OpenGL axis.
 
void setPosition (glm::vec3 positionSpherical)
 Set the camera's position.
 
glm::vec3 position (bool spherical=false) const
 Return the cartesian position vector.
 
void setUp (float up)
 Set the up direction.
 
float getUp () const
 Get the up direction.
 
glm::mat4 getProjection () const
 Get the Projection matrix.
 
glm::mat4 getInverseProjection () const
 Get the inverse Projection matrix.
 
glm::mat4 getView () const
 Get the View matrix.
 
glm::mat4 getInverseView () const
 Get the inverse View matrix.
 
glm::mat4 getPV () const
 Get the Projection*View matrix.
 
glm::mat4 getInversePV () const
 Get the inverse Projection*View matrix.
 
uint16_t getResX () const
 
uint16_t getResY () const
 
int lua_cameraPosition (lua_State *lua)
 Get the Camera position.
 
int lua_setCameraPosition (lua_State *lua)
 Set Camera position.
 
int lua_rotateCamera (lua_State *lua)
 Rotate the Camera.
 
int lua_zoomCamera (lua_State *lua)
 Zoom the Camera.
 
int lua_inclineCamera (lua_State *lua)
 Incline the camera.
 

Detailed Description

A 3D projective camera centered on a focus moving on a sphere.

Remarks
The axis are OpenGL form e.g. OpenGL Axes. +y | -z | / |/ -x -—/— +x /| +z / | -y
The spherical coordinates are length, polar angle (resp. +y), and azimuthal angle (resp. +x);

Constructor & Destructor Documentation

◆ Camera() [1/2]

Camera::Camera ( const std::vector< Atom > &  atoms,
uint16_t  resX,
uint16_t  resY 
)
inline

Construct a new Camera focussing on some Atoms.

Parameters
atomsthe atoms to fit into view.
resXthe screen resolution width.
resYthe screen resolution in height.

◆ Camera() [2/2]

Camera::Camera ( glm::vec3  positionSpherical,
uint16_t  resX,
uint16_t  resY 
)
inline

Construct a new Camera at a given position.

Parameters
positionSphericalthe camera's position in spherical coordinates.
resXthe screen resolution width.
resYthe screen resolution in height.

Member Function Documentation

◆ getInverseProjection()

glm::mat4 Camera::getInverseProjection ( ) const
inline

Get the inverse Projection matrix.

Returns
glm::mat4 the current inverse projection.

◆ getInversePV()

glm::mat4 Camera::getInversePV ( ) const
inline

Get the inverse Projection*View matrix.

Returns
glm::mat4 the current inverse Projection*View matrix.

◆ getInverseView()

glm::mat4 Camera::getInverseView ( ) const
inline

Get the inverse View matrix.

Returns
glm::mat4 the current inverse view matrix.

◆ getProjection()

glm::mat4 Camera::getProjection ( ) const
inline

Get the Projection matrix.

Returns
glm::mat4 the current projection.

◆ getPV()

glm::mat4 Camera::getPV ( ) const
inline

Get the Projection*View matrix.

Returns
glm::mat4 the current Projection*View matrix.

◆ getResX()

uint16_t Camera::getResX ( ) const
inline

◆ getResY()

uint16_t Camera::getResY ( ) const
inline

◆ getUp()

float Camera::getUp ( ) const
inline

Get the up direction.

Returns
float

◆ getView()

glm::mat4 Camera::getView ( ) const
inline

Get the View matrix.

Returns
glm::mat4 the current view matrix.

◆ incline()

void Camera::incline ( float  increment)
inline

Incline about the y OpenGL axis.

Parameters
incrementthe inclination increment.

◆ lua_cameraPosition()

int Camera::lua_cameraPosition ( lua_State lua)
inline

Get the Camera position.

Remarks
Lua arguments are:
  1. Whether to return in spherical coordinates.
Parameters
luathe Lua context.
Returns
int the return code.

◆ lua_inclineCamera()

int Camera::lua_inclineCamera ( lua_State lua)
inline

Incline the camera.

Remarks
Lua arguments are:
  1. The polar increment.
Parameters
luathe Lua context.
Returns
int the return code.

◆ lua_rotateCamera()

int Camera::lua_rotateCamera ( lua_State lua)
inline

Rotate the Camera.

Remarks
Lua arguments are:
  1. The azimuthal increment.
Parameters
luathe Lua context.
Returns
int the return code.

◆ lua_setCameraPosition()

int Camera::lua_setCameraPosition ( lua_State lua)
inline

Set Camera position.

Remarks
Lua arguments are:
  1. r
  2. theta
  3. phi
Parameters
luathe Lua context.
Returns
int the return code.

◆ lua_zoomCamera()

int Camera::lua_zoomCamera ( lua_State lua)
inline

Zoom the Camera.

Remarks
Lua arguments are:
  1. The zoom increment.
Parameters
luathe Lua context.
Returns
int the return code.

◆ position()

glm::vec3 Camera::position ( bool  spherical = false) const
inline

Return the cartesian position vector.

Parameters
sphericalif true return the position in spherical coordinates. Otherwise cartesian.
Returns
glm::vec3 the cartesian position of the camera.

◆ reset() [1/2]

void Camera::reset ( )
inline

Set the default view.

◆ reset() [2/2]

void Camera::reset ( const std::vector< Atom > &  atoms)
inline

Set the default view.

Remarks
reset() sets the camera to its default position. Far enough to see all the atoms, focussing on {0,0,0} and up point +tve y.
Parameters
atomsthe Atoms to fit in view.

◆ rotate()

void Camera::rotate ( float  increment)
inline

Rotate about the y OpenGL axis.

Parameters
incrementthe rotation increment.

◆ setPosition()

void Camera::setPosition ( glm::vec3  positionSpherical)
inline

Set the camera's position.

Remarks
Updates the view.
Parameters
positionSphericalthe position in spherical coordinates.

◆ setUp()

void Camera::setUp ( float  up)
inline

Set the up direction.

Remarks
Updates the view.
Parameters
upthe up direction.

◆ zoom()

void Camera::zoom ( float  increment)
inline

Increment the zoom.

Parameters
incrementthe zoom increase or decrease.

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