diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-04 18:42:05 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-04 18:42:05 +0000 |
commit | 151a2ac2434f4b4c23c107d9c21e4a18dd1a3c68 (patch) | |
tree | 18154b52b44327de28d82ff187f25c8369ddc5d9 /src/client/camera.cc | |
parent | 09fb43f3d36847977ac202c10c5a11f34af03a43 (diff) |
converted client:: singleton classes to namespaces
Diffstat (limited to 'src/client/camera.cc')
-rw-r--r-- | src/client/camera.cc | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/src/client/camera.cc b/src/client/camera.cc index a7c3349..a0d3ea0 100644 --- a/src/client/camera.cc +++ b/src/client/camera.cc @@ -15,7 +15,36 @@ using namespace render; namespace client { -Camera::Camera() +namespace camera +{ + +// public variables + +// camera target +math::Vector3f target; +// target yaw, angle in XZ plane, positive is looking left +float yaw_target; +// target pitch, angle in XZ plane, positive is looking left +float pitch_target; +// distance from the camera to the target +float distance; +// current camera mode +Mode mode; + +// private variables + +// current yaw, angle in XZ plane, positive is looking left +float yaw_current; +// current pitch, angle in XY, positive is looking up +float pitch_current; +// default pitch in mode::Track +float pitch_track; +// default pitch in mode::Overview +float pitch_overview; +// default offset increment +float offset_inc; + +void init() { pitch_overview = -60.0f; pitch_track = -15.0f; @@ -32,11 +61,11 @@ Camera::Camera() mode = Track; } -Camera::~Camera() +void shutdown() { } -void Camera::draw(float elapsed) +void draw(float elapsed) { if (mode == Track) { yaw_target = game.ship.yaw(); @@ -71,21 +100,21 @@ void Camera::draw(float elapsed) } } -void Camera::rotate_right() +void rotate_right() { if (mode == Free || mode == Overview) { yaw_target = degrees360f( yaw_target + offset_inc); } } -void Camera::rotate_left() +void rotate_left() { if (mode == Free || mode == Overview) { yaw_target = degrees360f( yaw_target - offset_inc); } } -void Camera::rotate_up() +void rotate_up() { if (mode == Free) { pitch_target = pitch_target - offset_inc; @@ -93,7 +122,7 @@ void Camera::rotate_up() } } -void Camera::rotate_down() +void rotate_down() { if (mode == Free) { pitch_target = pitch_target + offset_inc; @@ -101,7 +130,7 @@ void Camera::rotate_down() } } -void Camera::nextmode() { +void nextmode() { switch(mode) { case Overview: // switch camera to Track mode @@ -134,4 +163,7 @@ void Camera::nextmode() { } } -} //namespace camera +} // namespace camera + +} // namespace client + |