iridescence
Loading...
Searching...
No Matches
guik::CameraControl Class Referenceabstract

Base class for camera control. This class defines the interface for controlling the camera in the viewer. It provides virtual methods for handling mouse input, updating the camera state, and getting the view matrix. Derived classes can implement specific camera control schemes (e.g., orbit, FPV) by overriding these methods. More...

#include <camera_control.hpp>

Inheritance diagram for guik::CameraControl:

Public Member Functions

virtual ~CameraControl ()
virtual void reset_center ()
 Reset the shift of the camera.
virtual void lookat (const Eigen::Vector3f &pt)
 Move the camera to look at the given point. The point is expected to be in world coordinates.
virtual void lookat (const Eigen::Isometry3f &T_world_sensor)
 Move the camera to look at the given transform. The camera will look at the translation part of the transform, and optionally align its orientation with the rotation part.
virtual void lookat (const Eigen::Isometry3d &T_world_sensor)
virtual void mouse (const Eigen::Vector2f &p, int button, bool down)
 Mouse event callback. This method is called when a mouse button is pressed or released.
virtual void drag (const Eigen::Vector2f &p, int button)
 Mouse drag event callback. This method is called when the mouse is moved while a button is pressed.
virtual void scroll (const Eigen::Vector2f &rel)
 Scroll event callback. This method is called when the mouse wheel is scrolled.
virtual void update ()
 Update the camera state. This method can be called every frame to update the camera based on user input or animations.
virtual void updown (double p)
 Keyboard page up/down event callback. This method is called while the user is pressing the page up/down keys.
virtual void arrow (const Eigen::Vector2f &p)
 Keyboard arrow key event callback. This method is called while the user is pressing the arrow keys.
virtual Eigen::Vector2f depth_range () const
 Get the depth range of the camera. This method can be overridden by derived classes to specify a custom depth range for rendering.
virtual Eigen::Matrix4f view_matrix () const =0
 Get the view matrix of the camera. This method must be implemented by derived classes to return the current view transformation matrix.
virtual std::string name () const
virtual void load (std::istream &ist)
virtual void save (std::ostream &ost) const

Detailed Description

Base class for camera control. This class defines the interface for controlling the camera in the viewer. It provides virtual methods for handling mouse input, updating the camera state, and getting the view matrix. Derived classes can implement specific camera control schemes (e.g., orbit, FPV) by overriding these methods.

Note
Many of default camera control methods have an interface that combines a programmatic API (e.g., lookat()) and user input (e.g., mouse dragging). For example, the lookat() method can be used to programmatically set the camera to look at a specific point in the world, while the mouse dragging can be used to shift the camera's center of focus. The reset_center() method can be used to reset any such shifts.

Constructor & Destructor Documentation

◆ ~CameraControl()

virtual guik::CameraControl::~CameraControl ( )
inlinevirtual

Member Function Documentation

◆ arrow()

virtual void guik::CameraControl::arrow ( const Eigen::Vector2f & p)
inlinevirtual

Keyboard arrow key event callback. This method is called while the user is pressing the arrow keys.

Parameters
pThe amount of movement in the x and y directions.

Reimplemented in guik::ArcBallCameraControl, guik::FPSCameraControl, and guik::OrbitCameraControlXY.

◆ depth_range()

virtual Eigen::Vector2f guik::CameraControl::depth_range ( ) const
inlinevirtual

Get the depth range of the camera. This method can be overridden by derived classes to specify a custom depth range for rendering.

Returns
The near and far depth values as a 2D vector (x: near, y: far).

Reimplemented in guik::ArcBallCameraControl, guik::FPSCameraControl, guik::OrbitCameraControlXY, guik::SensorViewCameraControl, guik::StaticCameraControl, and guik::TopDownCameraControl.

◆ drag()

virtual void guik::CameraControl::drag ( const Eigen::Vector2f & p,
int button )
inlinevirtual

Mouse drag event callback. This method is called when the mouse is moved while a button is pressed.

Parameters
pThe current mouse position in screen coordinates (pixels).
buttonThe mouse button index (0: left, 1: right, 2: middle).

Reimplemented in guik::ArcBallCameraControl, guik::FPSCameraControl, guik::OrbitCameraControlXY, guik::OrbitCameraControlXZ, guik::SensorViewCameraControl, and guik::TopDownCameraControl.

◆ load()

virtual void guik::CameraControl::load ( std::istream & ist)
inlinevirtual

◆ lookat() [1/3]

virtual void guik::CameraControl::lookat ( const Eigen::Isometry3d & T_world_sensor)
inlinevirtual

◆ lookat() [2/3]

virtual void guik::CameraControl::lookat ( const Eigen::Isometry3f & T_world_sensor)
inlinevirtual

Move the camera to look at the given transform. The camera will look at the translation part of the transform, and optionally align its orientation with the rotation part.

Parameters
T_world_sensorThe transform to look at, in world coordinates.

Reimplemented in guik::SensorViewCameraControl.

◆ lookat() [3/3]

virtual void guik::CameraControl::lookat ( const Eigen::Vector3f & pt)
inlinevirtual

Move the camera to look at the given point. The point is expected to be in world coordinates.

Parameters
ptThe point to look at, in world coordinates.

Reimplemented in guik::ArcBallCameraControl, guik::FPSCameraControl, guik::OrbitCameraControlXY, and guik::TopDownCameraControl.

◆ mouse()

virtual void guik::CameraControl::mouse ( const Eigen::Vector2f & p,
int button,
bool down )
inlinevirtual

Mouse event callback. This method is called when a mouse button is pressed or released.

Parameters
pThe current mouse position in screen coordinates (pixels).
buttonThe mouse button index (0: left, 1: right, 2: middle).
downTrue if the button is pressed, false if released.

Reimplemented in guik::ArcBallCameraControl, guik::FPSCameraControl, guik::OrbitCameraControlXY, guik::SensorViewCameraControl, and guik::TopDownCameraControl.

◆ name()

◆ reset_center()

virtual void guik::CameraControl::reset_center ( )
inlinevirtual

◆ save()

virtual void guik::CameraControl::save ( std::ostream & ost) const
inlinevirtual

◆ scroll()

virtual void guik::CameraControl::scroll ( const Eigen::Vector2f & rel)
inlinevirtual

Scroll event callback. This method is called when the mouse wheel is scrolled.

Parameters
relThe relative scroll amount.

Reimplemented in guik::ArcBallCameraControl, guik::FPSCameraControl, guik::OrbitCameraControlXY, guik::SensorViewCameraControl, and guik::TopDownCameraControl.

◆ update()

virtual void guik::CameraControl::update ( )
inlinevirtual

Update the camera state. This method can be called every frame to update the camera based on user input or animations.

Reimplemented in guik::FPSCameraControl.

◆ updown()

virtual void guik::CameraControl::updown ( double p)
inlinevirtual

Keyboard page up/down event callback. This method is called while the user is pressing the page up/down keys.

Parameters
pThe amount of movement. Positive for page up, negative for page down.

Reimplemented in guik::ArcBallCameraControl, guik::FPSCameraControl, and guik::OrbitCameraControlXY.

◆ view_matrix()

virtual Eigen::Matrix4f guik::CameraControl::view_matrix ( ) const
pure virtual

Get the view matrix of the camera. This method must be implemented by derived classes to return the current view transformation matrix.

Returns
The 4x4 view matrix as an Eigen::Matrix4f.

Implemented in guik::ArcBallCameraControl, guik::FPSCameraControl, guik::OrbitCameraControlXY, guik::OrbitCameraControlXZ, guik::SensorViewCameraControl, guik::StaticCameraControl, and guik::TopDownCameraControl.


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