--- /dev/null
+
+/*] Copyright (c) 2009-2010, Charles McGarvey [**************************
+**] All rights reserved.
+*
+* vi:ts=4 sw=4 tw=75
+*
+* Distributable under the terms and conditions of the 2-clause BSD license;
+* see the file COPYING for a complete text of the license.
+*
+**************************************************************************/
+
+#ifndef _MOOF_CAMERA_HH_
+#define _MOOF_CAMERA_HH_
+
+/**
+ * \file camera.hh
+ * Classes related to managing the modelview and perspective matrices.
+ */
+
+#include <moof/event.hh>
+#include <moof/frustum.hh>
+#include <moof/math.hh>
+#include <moof/rigid_body.hh>
+
+
+namespace moof {
+
+
+class camera : public rigid_body3
+{
+public:
+
+ camera()
+ {
+ state_.init();
+ prev_state_.init();
+
+ quaternion_rotation_world_y(state_.orientation, SCALAR(0.0));
+ }
+
+ void position(const vector3& position);
+ void rotation(const quaternion& rotation);
+
+ void look_at(const vector3& point);
+
+ void projection(const matrix4& projection);
+ void projection(scalar fovy, scalar aspect, scalar near, scalar far);
+
+ const matrix4& modelview() const
+ {
+ return modelview_;
+ }
+
+ const matrix4& projection() const
+ {
+ return projection_;
+ }
+
+ const class frustum& frustum() const
+ {
+ return frustum_;
+ }
+
+
+ void upload_to_gl(scalar alpha = 0) const;
+
+ void update(scalar t, scalar dt);
+ void draw(scalar alpha = 0) const;
+ void handle_event(const event& event);
+
+
+private:
+
+ void calculate(scalar alpha) const;
+
+ mutable matrix4 modelview_;
+ matrix4 projection_;
+
+ mutable class frustum frustum_;
+};
+
+
+} // namespace moof
+
+#endif // _MOOF_CAMERA_HH_
+