]> Dogcows Code - chaz/yoink/blob - src/Moof/Camera.hh
more explicit constructors
[chaz/yoink] / src / Moof / Camera.hh
1
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
4 *
5 * vi:ts=4 sw=4 tw=75
6 *
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
9 *
10 **************************************************************************/
11
12 #ifndef _MOOF_CAMERA_HH_
13 #define _MOOF_CAMERA_HH_
14
15 #include <Moof/Event.hh>
16 #include <Moof/Frustum.hh>
17 #include <Moof/Math.hh>
18 #include <Moof/RigidBody.hh>
19
20
21 namespace Mf {
22
23
24 class Camera : public RigidBody3
25 {
26 public:
27
28 Camera()
29 {
30 mState.init();
31 mPrevState.init();
32
33 cml::quaternion_rotation_world_y(mState.orientation, SCALAR(0.0));
34 }
35
36 void setPosition(const Vector3& position);
37 void setRotation(const Quaternion& rotation);
38
39 void lookAt(const Vector3& point);
40
41 void setProjection(const Matrix4& projection);
42 void setProjection(Scalar fovy, Scalar aspect, Scalar near, Scalar far);
43
44 const Matrix4& getModelview() const
45 {
46 return mModelview;
47 }
48
49 const Matrix4& getProjection() const
50 {
51 return mProjection;
52 }
53
54 const Frustum& getFrustum() const
55 {
56 return mFrustum;
57 }
58
59
60 void uploadToGL(Scalar alpha = 0) const;
61
62 void update(Scalar t, Scalar dt);
63 void draw(Scalar alpha = 0) const;
64 void handleEvent(const Event& event);
65
66 private:
67
68 void calculate(Scalar alpha) const;
69
70 mutable Matrix4 mModelview;
71 Matrix4 mProjection;
72
73 mutable Frustum mFrustum;
74 };
75
76
77 } // namespace Mf
78
79 #endif // _MOOF_CAMERA_HH_
80
This page took 0.033627 seconds and 4 git commands to generate.