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>2007-10-21 23:02:47 +0000
committerStijn Buys <ingar@osirion.org>2007-10-21 23:02:47 +0000
commita237a2d7723b94df6cd3e91401ec28388de6f1a0 (patch)
tree7da376d276d03fced7b94a807c0952fd32bcde08 /src/client/camera.cc
parent084c6212afaa6f996091f36d0ff85ac845803a87 (diff)
namespace cleanup
Diffstat (limited to 'src/client/camera.cc')
-rw-r--r--src/client/camera.cc52
1 files changed, 28 insertions, 24 deletions
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