Direct Graphical Models  v.1.7.0
DirectGraphicalModels::vis::CCameraControl Class Reference

Trackball camera control class. More...

#include <CameraControl.h>

Inheritance diagram for DirectGraphicalModels::vis::CCameraControl:
Collaboration diagram for DirectGraphicalModels::vis::CCameraControl:

Public Member Functions

 CCameraControl (GLFWwindow *window, float theta=0.0f, float phi=-glm::pi< float >()/2, float radius=2.4f, float turnSpeed=0.004f, float scrollSpeed=0.33f, float panSpeed=0.01f)
 Constructor. More...
 
virtual ~CCameraControl (void)
 
- Public Member Functions inherited from DirectGraphicalModels::vis::CTrackballCamera
 CTrackballCamera (float theta, float phi, float radius)
 Constructor. More...
 
virtual ~CTrackballCamera (void)
 
void reset (void)
 Resets the camera position. More...
 
glm::mat4 getViewMatrix (void)
 Returns the view matrix within the camera coordinate. More...
 

Private Types

enum  mouseEvent {
  mouseEvent::none, mouseEvent::start_turn, mouseEvent::turn, mouseEvent::start_pan,
  mouseEvent::pan
}
 

Private Member Functions

void mouseButtonCallback (int button, int action, int mods)
 
void cursorPosCallback (double x, double y)
 
void scrollCallback (double x, double y)
 

Private Attributes

mouseEvent m_mouseEvent
 
glm::vec2 m_mouseLastPos
 
float m_turnSpeed
 
float m_scrollSpeed
 
float m_panSpeed
 

Additional Inherited Members

- Protected Member Functions inherited from DirectGraphicalModels::vis::CTrackballCamera
void rotate (float dTheta, float dPhi)
 
void zoom (float dRadius)
 
void pan (float dx, float dy)
 
glm::vec3 getCameraOrintation (void) const
 
glm::vec3 getCameraPosition (void) const
 
void updateViewMatrix (void)
 

Detailed Description

Trackball camera control class.

This class implements the control of the Trackball camera by capturing GLFW mouse events from the target window

Author
Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de

Definition at line 16 of file CameraControl.h.

Member Enumeration Documentation

◆ mouseEvent

Enumerator
none 
start_turn 
turn 
start_pan 
pan 

Definition at line 42 of file CameraControl.h.

Constructor & Destructor Documentation

◆ CCameraControl()

DirectGraphicalModels::vis::CCameraControl::CCameraControl ( GLFWwindow *  window,
float  theta = 0.0f,
float  phi = -glm::pi<float>() / 2,
float  radius = 2.4f,
float  turnSpeed = 0.004f,
float  scrollSpeed = 0.33f,
float  panSpeed = 0.01f 
)

Constructor.

The camera is defined in polar coordinate system with the parameters theta, phi and radius in point \(P\) and looks at the origin \(O\), which is initially situated at the zero point.

Parameters
windowThe window that received the mouse evenents
thetaThe azimuth (or azimuthal angle) measured from the azimuth reference direction to the orthogonal projection of the line segment \(OP\) on the reference plane
phiThe inclination (or polar angle) between the zenith direction and the line segment \(OP\)
radiusThe radial distance of the camera to origin, i.e. the Euclidian distance between \(O\) and \(P\)
turnSpeedThe rotation speed
scrollSpeedThe zoom speed
panSpeedThe panning speed

Definition at line 6 of file CameraControl.cpp.

Here is the call graph for this function:

◆ ~CCameraControl()

virtual DirectGraphicalModels::vis::CCameraControl::~CCameraControl ( void  )
inlinevirtual

Definition at line 32 of file CameraControl.h.

Member Function Documentation

◆ cursorPosCallback()

void DirectGraphicalModels::vis::CCameraControl::cursorPosCallback ( double  x,
double  y 
)
private

Definition at line 38 of file CameraControl.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouseButtonCallback()

void DirectGraphicalModels::vis::CCameraControl::mouseButtonCallback ( int  button,
int  action,
int  mods 
)
private

Definition at line 26 of file CameraControl.cpp.

Here is the caller graph for this function:

◆ scrollCallback()

void DirectGraphicalModels::vis::CCameraControl::scrollCallback ( double  x,
double  y 
)
private

Definition at line 56 of file CameraControl.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_mouseEvent

mouseEvent DirectGraphicalModels::vis::CCameraControl::m_mouseEvent
private

Definition at line 44 of file CameraControl.h.

◆ m_mouseLastPos

glm::vec2 DirectGraphicalModels::vis::CCameraControl::m_mouseLastPos
private

Definition at line 45 of file CameraControl.h.

◆ m_panSpeed

float DirectGraphicalModels::vis::CCameraControl::m_panSpeed
private

Definition at line 49 of file CameraControl.h.

◆ m_scrollSpeed

float DirectGraphicalModels::vis::CCameraControl::m_scrollSpeed
private

Definition at line 48 of file CameraControl.h.

◆ m_turnSpeed

float DirectGraphicalModels::vis::CCameraControl::m_turnSpeed
private

Definition at line 47 of file CameraControl.h.


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