3 This file is part of R²C²
4 Copyright © 2010-2011 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>
16 Moves the camera based on keyboard and mouse events. Controls are as follows:
20 Insert - view from top down
21 Wheel - adjust viewing distance
26 Ctrl + RMB - adjust viewing distance
27 Ctrl + MMB - adjust viewing distance
29 class CameraController
41 Msp::Graphics::EventSource &event_source;
42 Msp::GL::Camera &camera;
50 CameraController(R2C2::View3D &, Msp::Graphics::EventSource &);
53 void set_look_direction(const Msp::GL::Vector3 &);
56 void move(float, float);
57 void adjust_distance(float);
63 void button_press(int, int, unsigned, unsigned);
64 void button_release(int, int, unsigned, unsigned);
65 void pointer_motion(int, int);
66 void key_press(unsigned, unsigned, wchar_t);
67 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;