3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef CAMERACONTROLLER_H_
9 #define CAMERACONTROLLER_H_
11 #include <msp/gbase/window.h>
12 #include <msp/gl/camera.h>
17 Moves the camera based on keyboard and mouse events. Controls are as follows:
21 Insert - view from top down
22 Wheel - adjust viewing distance
27 Ctrl + RMB - adjust viewing distance
28 Ctrl + MMB - adjust viewing distance
30 class CameraController
42 Msp::Graphics::EventSource &event_source;
43 Msp::GL::Camera &camera;
51 CameraController(Designer &, Msp::Graphics::EventSource &, Msp::GL::Camera &);
54 void set_look_direction(const Msp::GL::Vector3 &);
57 void move(float, float);
58 void adjust_distance(float);
64 void button_press(int, int, unsigned, unsigned);
65 void button_release(int, int, unsigned, unsigned);
66 void pointer_motion(int, int);
67 void key_press(unsigned, unsigned, wchar_t);
68 void key_release(unsigned, unsigned);
70 /** Return the focus point, i.e. where the look ray intersects with ground. */
71 Msp::GL::Vector3 get_focus() const;
73 /** Return distance from the focus point. */
74 float get_distance() const;
76 /** Return the viewport height at focus distance. */
77 float get_view_scale() const;