From a237a2d7723b94df6cd3e91401ec28388de6f1a0 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 21 Oct 2007 23:02:47 +0000 Subject: namespace cleanup --- src/client/camera.cc | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'src/client/camera.cc') diff --git a/src/client/camera.cc b/src/client/camera.cc index 42d686a..87e00fc 100644 --- a/src/client/camera.cc +++ b/src/client/camera.cc @@ -1,30 +1,34 @@ -/* client/camera.cc +/* + client/camera.cc This file is part of the Osirion project and is distributed under the terms and conditions of the GNU General Public License version 2 */ -#include "common/functions.h" -#include "game/game.h" +#include "camera.h" + #include "gl/osiriongl.h" +#include "game/game.h" +#include "common/functions.h" -namespace camera -{ -enum Mode {Free, Track}; -Mode mode = Track; +using namespace common; -const float track_pitch = -15.0f; // default tracking pitch -const float offset_inc = 5.0f; // default offset increment +namespace client +{ + +Camera::Mode Camera::mode = Camera::Track; -float yaw = 0; // current yaw, angle in XZ plane, positive is looking left -float yaw_target = 0; // target yaw +const float Camera::track_pitch = -15.0f; // default tracking pitch +const float Camera::offset_inc = 5.0f; // default offset increment -float pitch = -45.0f; // current pitch, angle in XY, positive is looking up -float pitch_target = track_pitch; // target pitch +float Camera::yaw = 0; // current yaw, angle in XZ plane, positive is looking left +float Camera::yaw_target = 0; // target yaw -float distance = 0.4f; // distance from the eye to the target +float Camera::pitch = -45.0f; // current pitch, angle in XY, positive is looking up +float Camera::pitch_target = Camera::track_pitch; // target pitch +float Camera::distance = 0.4f; // distance from the eye to the target -void draw(float elapsed) +void Camera::draw(float elapsed) { if (mode == Track) { yaw_target = game::ship.yaw; @@ -54,37 +58,37 @@ void draw(float elapsed) } } -void rotate_right() +void Camera::rotate_right() { if (mode == Free ) { yaw_target = degreesf( yaw_target + offset_inc); } } -void rotate_left() +void Camera::rotate_left() { if (mode == Free ) { yaw_target = degreesf( yaw_target - offset_inc); } } -void rotate_up() +void Camera::rotate_up() { if (mode == Free ) { - pitch_target = pitch_target + offset_inc; - if (pitch_target > 90.0f) pitch_target = 90.0f; + pitch_target = pitch_target - offset_inc; + if (pitch_target < -90.0f) pitch_target = -90.0f; } } -void rotate_down() +void Camera::rotate_down() { if (mode == Free ) { - pitch_target = pitch_target - offset_inc; - if (pitch_target < -90.0f) pitch_target = -90.0f; + pitch_target = pitch_target + offset_inc; + if (pitch_target > 90.0f) pitch_target = 90.0f; } } -void nextmode() { +void Camera::nextmode() { switch(mode) { case Free: // switch camera to Track mode -- cgit v1.2.3