diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/camera.cc | 11 | ||||
-rw-r--r-- | src/render/camera.h | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc index 04d899f..4544b75 100644 --- a/src/render/camera.cc +++ b/src/render/camera.cc @@ -32,6 +32,7 @@ math::Vector3f Camera::camera_eye; math::Vector3f Camera::camera_target; math::Axis Camera::camera_axis; Camera::Mode Camera::camera_mode; +Camera::Mode Camera::camera_previous_mode; // current and target yaw angle in XZ plane, positive is looking left float Camera::direction_current; @@ -65,6 +66,8 @@ void Camera::init() distance = 0.4f; + camera_mode = Overview; + camera_previous_mode = Track; set_mode(Track); camera_axis.clear(); @@ -100,6 +103,9 @@ void Camera::set_mode(Mode newmode) { camera_axis.clear(); + if (camera_mode != Overview) + camera_previous_mode = camera_mode; + switch(newmode) { case Track: // switch camera to Track mode @@ -213,7 +219,7 @@ void Camera::frame(float seconds) } } else if (core::localcontrol()) { if (camera_mode == Overview) { - set_mode(Track); + set_mode(camera_previous_mode); } } else { if (camera_mode != Overview) { @@ -230,13 +236,14 @@ void Camera::frame(float seconds) camera_axis.assign(core::localplayer()->view()->axis()); camera_axis.change_direction(180.0f); distance = math::max(core::localplayer()->view()->radius(), 1.0f) * 2.0f; - +/* } else if (core::localplayer()->zone()->default_view()) { // default zone view entity camera_target.assign(core::localplayer()->zone()->default_view()->location()); camera_axis.assign(core::localplayer()->zone()->default_view()->axis()); camera_axis.change_direction(180.0f); distance = math::max(core::localplayer()->zone()->default_view()->radius(), 1.0f) * 2.0f; +*/ } else { // default location (0,0,0) camera_target.clear(); diff --git a/src/render/camera.h b/src/render/camera.h index b19521e..5394d1b 100644 --- a/src/render/camera.h +++ b/src/render/camera.h @@ -89,6 +89,7 @@ private: static math::Vector3f camera_target; static math::Axis camera_axis; static Mode camera_mode; + static Mode camera_previous_mode; static float camera_aspect; static float camera_frustum_size; static float camera_frustum_front; |