Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/camera.h')
-rw-r--r--src/render/camera.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/render/camera.h b/src/render/camera.h
new file mode 100644
index 0000000..42bd835
--- /dev/null
+++ b/src/render/camera.h
@@ -0,0 +1,87 @@
+/*
+ render/camera.h
+ This file is part of the Osirion project and is distributed under
+ the terms and conditions of the GNU General Public License version 2
+*/
+
+#ifndef __INCLUDED_RENDER_CAMERA_H__
+#define __INCLUDED_RENDER_CAMERA_H__
+
+#include "math/mathlib.h"
+
+namespace render {
+
+/// camera functions
+class Camera
+{
+public:
+
+ /// enum indicating the camera mode
+ enum Mode {Free, Track, Cockpit, Overview};
+
+ /// initialize the camera
+ static void init();
+
+ /// shutdown the camera
+ static void shutdown();
+
+ /// gameworld coordinates of the camera eye
+ static inline const math::Vector3f & eye() { return camera_eye; }
+
+ /// gameworld coordinates of the camera target
+ static inline const math::Vector3f & target() { return camera_target; }
+
+ /// gameworld camera axis
+ static inline const math::Axis & axis() { return camera_axis; }
+
+ /// current camera mode
+ static inline Mode mode() { return camera_mode; }
+
+ /// current aspect ratio
+ static inline float aspect() { return camera_aspect; }
+
+ /// reset the current mode
+ static void reset();
+
+ /// draw the OpenGL camera transformation
+ static void draw(float elapsed);
+
+ /// set target direction
+ static void set_direction(float direction);
+
+ /// set target pitch
+ static void set_pitch(float pitch);
+
+ /// switch to next camera mode
+ static void next_mode();
+
+ /// set specified camera mode
+ static void set_mode(Mode newmode);
+
+ /// set camera aspect ratio
+ static void set_aspect(float aspect);
+
+private:
+ static math::Vector3f camera_eye;
+ static math::Vector3f camera_target;
+ static math::Axis camera_axis;
+ static Mode camera_mode;
+ static float camera_aspect;
+
+ // current and target yaw angle in XZ plane, positive is looking left
+ static float direction_current;
+ static float direction_target;
+ static float target_direction;
+
+ // current and target pitch angle in XY, positive is looking up
+ static float pitch_current;
+ static float pitch_target;
+ static float target_pitch;
+
+ static float distance;
+
+};
+
+} // namespace client
+
+#endif // __INCLUDED_RENDER_CAMERA_H__