iridescence
Loading...
Searching...
No Matches
camera_control.hpp
Go to the documentation of this file.
1#ifndef GLK_CAMERA_CONTROL_HPP
2#define GLK_CAMERA_CONTROL_HPP
3
4#include <memory>
5#include <iostream>
6#include <GL/gl3w.h>
7#include <Eigen/Core>
8#include <Eigen/Geometry>
9
10namespace guik {
11
20public:
21 virtual ~CameraControl() {}
22
24 virtual void reset_center() {}
25
28 virtual void lookat(const Eigen::Vector3f& pt) {}
29
33 virtual void lookat(const Eigen::Isometry3f& T_world_sensor) { lookat(T_world_sensor.translation()); }
34
35 virtual void lookat(const Eigen::Isometry3d& T_world_sensor) { lookat(T_world_sensor.cast<float>()); }
36
41 virtual void mouse(const Eigen::Vector2f& p, int button, bool down) {}
42
46 virtual void drag(const Eigen::Vector2f& p, int button) {}
47
50 virtual void scroll(const Eigen::Vector2f& rel) {}
51
53 virtual void update() {}
54
57 virtual void updown(double p) {}
58
61 virtual void arrow(const Eigen::Vector2f& p) {}
62
65 virtual Eigen::Vector2f depth_range() const { return Eigen::Vector2f(0.0f, 1.0f); }
66
69 virtual Eigen::Matrix4f view_matrix() const = 0;
70
71 // io
72 virtual std::string name() const { return "CameraControl"; }
73 virtual void load(std::istream& ist) {}
74 virtual void save(std::ostream& ost) const {}
75};
76
77std::istream& operator>>(std::istream& ist, CameraControl& cam);
78std::ostream& operator<<(std::ostream& ost, const CameraControl& cam);
79
80} // namespace guik
81
82#endif
Base class for camera control. This class defines the interface for controlling the camera in the vie...
Definition camera_control.hpp:19
virtual Eigen::Vector2f depth_range() const
Get the depth range of the camera. This method can be overridden by derived classes to specify a cust...
Definition camera_control.hpp:65
virtual void arrow(const Eigen::Vector2f &p)
Keyboard arrow key event callback. This method is called while the user is pressing the arrow keys.
Definition camera_control.hpp:61
virtual std::string name() const
Definition camera_control.hpp:72
virtual void lookat(const Eigen::Isometry3d &T_world_sensor)
Definition camera_control.hpp:35
virtual void update()
Update the camera state. This method can be called every frame to update the camera based on user inp...
Definition camera_control.hpp:53
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.
Definition camera_control.hpp:46
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 c...
virtual void load(std::istream &ist)
Definition camera_control.hpp:73
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 t...
Definition camera_control.hpp:33
virtual void save(std::ostream &ost) const
Definition camera_control.hpp:74
virtual void reset_center()
Reset the shift of the camera.
Definition camera_control.hpp:24
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.
Definition camera_control.hpp:28
virtual void scroll(const Eigen::Vector2f &rel)
Scroll event callback. This method is called when the mouse wheel is scrolled.
Definition camera_control.hpp:50
virtual ~CameraControl()
Definition camera_control.hpp:21
virtual void updown(double p)
Keyboard page up/down event callback. This method is called while the user is pressing the page up/do...
Definition camera_control.hpp:57
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.
Definition camera_control.hpp:41
Definition drawable_container.hpp:9
std::ostream & operator<<(std::ostream &ost, const CameraControl &cam)
std::istream & operator>>(std::istream &ist, CameraControl &cam)