Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/camera.cc')
-rw-r--r--src/client/camera.cc50
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
+