Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2015-01-06 18:51:37 +0000
committerStijn Buys <ingar@osirion.org>2015-01-06 18:51:37 +0000
commit72ee43e9470c6fdbc6ed7ff92b85dfa5062c5762 (patch)
tree6474fa59066d5212dcd40e3d76652dce35565280 /src/render/camera.cc
parent57d958d40af061e83aa99ca12e375e5345836ecd (diff)
Added separate event handlers for mouse button clicks and mouse wheel movement.
Diffstat (limited to 'src/render/camera.cc')
-rw-r--r--src/render/camera.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc
index 881d9ae..d6cf562 100644
--- a/src/render/camera.cc
+++ b/src/render/camera.cc
@@ -328,12 +328,21 @@ void Camera::frame(float seconds)
distance = math::max(FRUSTUMFRONT / WORLDSCALE, FRUSTUMFRONT / WORLDSCALE + camera_zoom * core::localcontrol()->radius()) + 0.001f;
} else if (mode() == Cockpit) {
+
+ camera_scene_axis.assign(target_axis);
+
+ direction_target = + 90 * target_direction;
+ pitch_target = + 90 * target_pitch;
- // freelook target
- target_axis.change_direction(90 * target_direction);
- target_axis.change_pitch(90 * target_pitch);
+ // adjust direction
+ d = degrees180f(direction_current - direction_target);
+ direction_current = degrees360f(direction_current - d * seconds);
+ camera_scene_axis.change_direction(direction_current);
- camera_scene_axis.assign(target_axis);
+ // adjust pitch
+ d = degrees180f(pitch_current - pitch_target);
+ pitch_current = degrees360f(pitch_current - d * seconds);
+ camera_scene_axis.change_pitch(pitch_current);
if (core::localcontrol()->model()) {
const float modelscale = core::localcontrol()->radius() / core::localcontrol()->model()->radius();