diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-10 21:44:58 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-10 21:44:58 +0000 |
commit | 17e9ce54ee3972b9804174b874652ec0856efcd0 (patch) | |
tree | 33ec140d65fdcf42a467e3903647efc1be0d4e02 /src/client | |
parent | d3afb677b6ea5942c042b8a83aa5d9ace1dec787 (diff) |
interpolation & oscilating debugging
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/camera.cc | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/src/client/camera.cc b/src/client/camera.cc index 28f60c5..c4a60b0 100644 --- a/src/client/camera.cc +++ b/src/client/camera.cc @@ -178,28 +178,43 @@ void draw(float seconds) } if (mode == Track) { - if (core::localcontrol()->state() && core::localcontrol()->model()) - target += core::localcontrol()->model()->maxbbox().x * core::localcontrol()->state()->axis().forward(); + if (core::localcontrol()->state() && core::localcontrol()->model()) { + target -= (core::localcontrol()->model()->maxbbox().x + 0.1f) * core::localcontrol()->state()->axis().forward(); + + target += (core::localcontrol()->model()->maxbbox().z + 0.3f ) * + core::localcontrol()->state()->axis().up(); + } // make the camera swing while turning target_direction = core::localcontrol()->target_direction; - pitch_target = core::localcontrol()->target_pitch; + target_pitch = core::localcontrol()->target_pitch; + + yaw_target = - 30 * target_direction; + pitch_target = - 30 * target_pitch; + //pitch_target = pitch_track - 30 * target_pitch; - yaw_target = - 25 * target_direction; - pitch_target = pitch_track - 25 * target_pitch; + distance = 0.0f; } else if (mode == Free) { yaw_target = yaw_current - 90 * target_direction; pitch_target = pitch_current - 90 * target_pitch; + + if (core::localcontrol()->model()) { + distance = core::localcontrol()->model()->radius(); + } else { + distance = 1.0f; + } } else if (mode == Cockpit) { if (core::localcontrol()->state() && core::localcontrol()->model()) - target += core::localcontrol()->model()->maxbbox().x * core::localcontrol()->state()->axis().forward(); + target += core::localcontrol()->model()->maxbbox().x * + core::localcontrol()->state()->axis().forward(); + + distance = 0.0f; } - if (mode != Cockpit) { // adjust direction d = degrees180f(yaw_current - yaw_target); @@ -210,11 +225,6 @@ void draw(float seconds) d = degrees180f(pitch_current - pitch_target); pitch_current = degrees360f(pitch_current - d *seconds); axis.change_pitch(pitch_current); - - if (core::localcontrol()->model()) - distance = 1+core::localcontrol()->model()->radius(); - else - distance = 1.5f; } } @@ -231,15 +241,13 @@ void draw(float seconds) // match the camera with the current target gl::translate(-1.0f * target); - if (mode != Cockpit) { - // apply camera offset - gl::translate((1.0f+distance) * axis.forward()); + // apply camera offset + gl::translate((1.0 + distance) * axis.forward()); + + // calculate eye position + eye = target - ((1.0f+distance) * axis.forward()); + eye.assign(target); - // calculate eye position - eye = target - ((1.0f+distance) * axis.forward()); - } else { - eye.assign(target); - } } void set_direction(float direction) |