1 #ifndef CAMERACONTROLLER_H_
2 #define CAMERACONTROLLER_H_
4 #include <msp/graphics/window.h>
5 #include <msp/gl/camera.h>
9 Moves the camera based on keyboard and mouse events. Controls are as follows:
13 Insert - view from top down
14 Wheel - adjust viewing distance
19 Ctrl + RMB - adjust viewing distance
20 Ctrl + MMB - adjust viewing distance
22 class CameraController
34 Msp::Graphics::EventSource &event_source;
35 Msp::GL::Camera &camera;
43 CameraController(R2C2::View3D &, Msp::Graphics::EventSource &);
46 void set_look_direction(const Msp::GL::Vector3 &);
49 void move(float, float);
50 void adjust_distance(float);
56 void button_press(int, int, unsigned, unsigned);
57 void button_release(int, int, unsigned, unsigned);
58 void pointer_motion(int, int);
59 void key_press(unsigned, unsigned, wchar_t);
60 void key_release(unsigned, unsigned);
63 /** Return the focus point, i.e. where the look ray intersects with ground. */
64 Msp::GL::Vector3 get_focus() const;
66 /** Return distance from the focus point. */
67 float get_distance() const;
69 /** Return the viewport height at focus distance. */
70 float get_view_scale() const;