ViewController Class Referenceabstract

Base class for view controllers. More...

#include <rendering/rendering.hh>

Inherited by FPSViewController, and OrbitViewController.

Public Member Functions

 ViewController (UserCameraPtr _camera)
 Constructor. More...
 
virtual ~ViewController ()
 Destructor. More...
 
std::string GetTypeString () const
 Get the type of view controller. More...
 
virtual void HandleKeyPressEvent (const std::string &_key)=0
 Handle a key press event. More...
 
virtual void HandleKeyReleaseEvent (const std::string &_key)=0
 Handle a key release event. More...
 
virtual void HandleMouseEvent (const common::MouseEvent &_event)=0
 Handle a mouse event. More...
 
virtual void Init ()=0
 Initialize the view controller. More...
 
virtual void Init (const ignition::math::Vector3d &_focalPoint, const double _yaw=0, const double _pitch=0)
 Initialize with a focus point. More...
 
virtual void Resize (const unsigned int _width, const unsigned int _height)
 Called by the UserCamera when a resize event occurs. More...
 
void SetEnabled (bool _value)
 Set whether the controller is enabled. More...
 
virtual void Update ()=0
 Update the controller, which should update the position of the Camera. More...
 

Protected Attributes

UserCameraPtr camera
 Pointer to the camera to control. More...
 
bool enabled
 True if enabled. More...
 
std::string typeString
 Type of view controller. More...
 

Detailed Description

Base class for view controllers.

Constructor & Destructor Documentation

◆ ViewController()

ViewController ( UserCameraPtr  _camera)
explicit

Constructor.

Parameters
[in]_cameraThe user camera to controll.

◆ ~ViewController()

virtual ~ViewController ( )
virtual

Destructor.

Member Function Documentation

◆ GetTypeString()

std::string GetTypeString ( ) const

Get the type of view controller.

Returns
The view controller type string.

◆ HandleKeyPressEvent()

virtual void HandleKeyPressEvent ( const std::string &  _key)
pure virtual

Handle a key press event.

Parameters
[in]_keyThe key that was pressed.

Implemented in OrbitViewController, and FPSViewController.

◆ HandleKeyReleaseEvent()

virtual void HandleKeyReleaseEvent ( const std::string &  _key)
pure virtual

Handle a key release event.

Parameters
[in]_keyThe key that was released.

Implemented in OrbitViewController, and FPSViewController.

◆ HandleMouseEvent()

virtual void HandleMouseEvent ( const common::MouseEvent _event)
pure virtual

Handle a mouse event.

Parameters
[in]_eventThe mouse position.

Implemented in OrbitViewController, OrthoViewController, and FPSViewController.

◆ Init() [1/2]

virtual void Init ( )
pure virtual

Initialize the view controller.

Implemented in OrbitViewController, OrthoViewController, and FPSViewController.

◆ Init() [2/2]

virtual void Init ( const ignition::math::Vector3d &  _focalPoint,
const double  _yaw = 0,
const double  _pitch = 0 
)
virtual

Initialize with a focus point.

Parameters
[in]_focalPointThe point to look at.
[in]_yawInitial yaw angle.
[in]_pitchInitial pitch angle.

Reimplemented in OrbitViewController, and OrthoViewController.

◆ Resize()

virtual void Resize ( const unsigned int  _width,
const unsigned int  _height 
)
virtual

Called by the UserCamera when a resize event occurs.

Parameters
[in]_widthNew width
[in]_heightNew height

Reimplemented in OrthoViewController.

◆ SetEnabled()

void SetEnabled ( bool  _value)

Set whether the controller is enabled.

Parameters
[in]_valueTrue if the controller is enabled.

◆ Update()

virtual void Update ( )
pure virtual

Update the controller, which should update the position of the Camera.

Implemented in OrbitViewController, and FPSViewController.

Member Data Documentation

◆ camera

UserCameraPtr camera
protected

Pointer to the camera to control.

◆ enabled

bool enabled
protected

True if enabled.

◆ typeString

std::string typeString
protected

Type of view controller.


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