iridescence
Loading...
Searching...
No Matches
fps_camera_control.hpp
Go to the documentation of this file.
1#ifndef GUIK_FPS_CAMERA_CONTROL_HPP
2#define GUIK_FPS_CAMERA_CONTROL_HPP
3
6
7namespace guik {
8
10public:
11 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
12
13 FPSCameraControl(const Eigen::Vector2i& canvas_size);
15
16 void set_mouse_senstivity(double mouse_sensitivity_pitch = 0.01, double mouse_sensitivity_yaw = 0.01);
17 void set_translation_speed(double speed = 0.05);
18
19 // ProjectionControl
20 void set_size(const Eigen::Vector2i& size) override;
21
22 // FOV
23 void set_fovy_range(double min_fovy_deg, double max_fovy_deg, double default_fovy_deg = 60.0);
24 void reset_fovy();
25 void lock_fovy();
27 void set_fovy(double fovy_deg);
28
29 void set_depth_range(const Eigen::Vector2f& range) override;
30 Eigen::Matrix4f projection_matrix() const override;
31
32 // ViewMatrixControl
33 void set_pose(const Eigen::Vector3f& pos, double yaw_deg, double pitch_deg);
34 void reset_center() override;
35 void lookat(const Eigen::Vector3f& pt) override;
36
37 void mouse(const Eigen::Vector2f& p, int button, bool down) override;
38 void drag(const Eigen::Vector2f& p, int button) override;
39 void scroll(const Eigen::Vector2f& rel) override;
40
41 void updown(double p) override;
42 void arrow(const Eigen::Vector2f& p) override;
43 void update() override;
44
45 Eigen::Vector2f depth_range() const override;
46 Eigen::Matrix4f view_matrix() const override;
47
48private:
49 Eigen::Vector3f pos;
50 double yaw;
51 double pitch;
52
53 bool fovy_locked;
54 double min_fovy;
55 double max_fovy;
56 double default_fovy;
57
58 Eigen::Vector2i size;
59 double fovy;
60 double near_; // near, far are reserved words in MSVC!
61 double far_;
62
63 double mouse_sensitivity_yaw;
64 double mouse_sensitivity_pitch;
65 double translation_speed;
66
67 bool left_button_down;
68 bool right_button_down;
69 bool middle_button_down;
70 Eigen::Vector2f drag_last_pos;
71};
72
73} // namespace guik
74
75#endif
Base class for camera control. This class defines the interface for controlling the camera in the vie...
Definition camera_control.hpp:19
void set_pose(const Eigen::Vector3f &pos, double yaw_deg, double pitch_deg)
void set_translation_speed(double speed=0.05)
void mouse(const Eigen::Vector2f &p, int button, bool down) override
Mouse event callback. This method is called when a mouse button is pressed or released.
void set_size(const Eigen::Vector2i &size) override
void updown(double p) override
Keyboard page up/down event callback. This method is called while the user is pressing the page up/do...
Eigen::Matrix4f view_matrix() const override
Get the view matrix of the camera. This method must be implemented by derived classes to return the c...
void lookat(const Eigen::Vector3f &pt) override
Move the camera to look at the given point. The point is expected to be in world coordinates.
void set_fovy(double fovy_deg)
void set_depth_range(const Eigen::Vector2f &range) override
void update() override
Update the camera state. This method can be called every frame to update the camera based on user inp...
void set_mouse_senstivity(double mouse_sensitivity_pitch=0.01, double mouse_sensitivity_yaw=0.01)
void scroll(const Eigen::Vector2f &rel) override
Scroll event callback. This method is called when the mouse wheel is scrolled.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW FPSCameraControl(const Eigen::Vector2i &canvas_size)
~FPSCameraControl() override
void drag(const Eigen::Vector2f &p, int button) override
Mouse drag event callback. This method is called when the mouse is moved while a button is pressed.
void arrow(const Eigen::Vector2f &p) override
Keyboard arrow key event callback. This method is called while the user is pressing the arrow keys.
Eigen::Vector2f depth_range() const override
Get the depth range of the camera. This method can be overridden by derived classes to specify a cust...
void reset_center() override
Reset the shift of the camera.
void set_fovy_range(double min_fovy_deg, double max_fovy_deg, double default_fovy_deg=60.0)
Eigen::Matrix4f projection_matrix() const override
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ProjectionControl()
Definition projection_control.hpp:12
Definition drawable_container.hpp:9