]> Dogcows Code - chaz/yoink/blob - src/moof/camera.hh
configuration cleanup and bugfixes
[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 /**
16 * \file camera.hh
17 * Classes related to managing the modelview and perspective matrices.
18 */
19
20 #include <moof/event.hh>
21 #include <moof/frustum.hh>
22 #include <moof/math.hh>
23 #include <moof/rigid_body.hh>
24
25
26 namespace moof {
27
28
29 class camera : public rigid_body3
30 {
31 public:
32
33 camera()
34 {
35 state_.init();
36 prev_state_.init();
37
38 quaternion_rotation_world_y(state_.orientation, SCALAR(0.0));
39 }
40
41 void position(const vector3& position);
42 void rotation(const quaternion& rotation);
43
44 void look_at(const vector3& point);
45
46 void projection(const matrix4& projection);
47 void projection(scalar fovy, scalar aspect, scalar near, scalar far);
48
49 const matrix4& modelview() const
50 {
51 return modelview_;
52 }
53
54 const matrix4& projection() const
55 {
56 return projection_;
57 }
58
59 const class frustum& frustum() const
60 {
61 return frustum_;
62 }
63
64
65 void upload_to_gl(scalar alpha = 0) const;
66
67 void update(scalar t, scalar dt);
68 void draw(scalar alpha = 0) const;
69 void handle_event(const event& event);
70
71
72 private:
73
74 void calculate(scalar alpha) const;
75
76 mutable matrix4 modelview_;
77 matrix4 projection_;
78
79 mutable class frustum frustum_;
80 };
81
82
83 } // namespace moof
84
85 #endif // _MOOF_CAMERA_HH_
86
This page took 0.032119 seconds and 4 git commands to generate.