Last change
on this file since 3542 was
3039,
checked in by bensch, 20 years ago
|
orxonox/branches/bezierTrack: camera Has A and not Is A Coordinate: Patrick, I finally got what you ment.
|
File size:
1.9 KB
|
Line | |
---|
1 | /*! |
---|
2 | \file camera.h |
---|
3 | \brief Viewpoint controlling class definitions |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef CAMERA_H |
---|
7 | #define CAMERA_H |
---|
8 | |
---|
9 | #include "stdincl.h" |
---|
10 | |
---|
11 | class WorldEntity; |
---|
12 | class World; |
---|
13 | class CameraTarget; |
---|
14 | |
---|
15 | //! Camera |
---|
16 | /** |
---|
17 | This class controls the viewpoint from which the World is rendered. To use the |
---|
18 | Camera it has to be bound to a WorldEntity which serves as the reference focus |
---|
19 | point. The Camera itself calls the WorldEntity::get_lookat() and |
---|
20 | World::calc_camera_pos() functions to calculate the position it currently should |
---|
21 | be in. |
---|
22 | */ |
---|
23 | |
---|
24 | enum CAMERA_MODE {NORMAL, SMOTH_FOLLOW, STICKY, ELLIPTICAL}; |
---|
25 | |
---|
26 | class Camera |
---|
27 | { |
---|
28 | private: |
---|
29 | WorldEntity* bound; //!< the WorldEntity the Camera is bound to |
---|
30 | Placement actual_place; //!< the Camera's current position |
---|
31 | Placement desired_place; //!< where the Camera should be according to calculations |
---|
32 | World* world; |
---|
33 | |
---|
34 | CameraTarget* target; |
---|
35 | |
---|
36 | /* physical system - not needed yet */ |
---|
37 | float mass; //!< mass |
---|
38 | Vector *acceleration; //!< acceleration |
---|
39 | Vector *velocity; //!< velocity |
---|
40 | |
---|
41 | /* elliptical camera mode variables */ |
---|
42 | Placement plLastBPlace; |
---|
43 | float cameraOffset; |
---|
44 | float cameraOffsetZ; |
---|
45 | float deltaTime; |
---|
46 | float t; |
---|
47 | Vector r; |
---|
48 | float rAbs; |
---|
49 | float ka; |
---|
50 | float a0; |
---|
51 | |
---|
52 | Quaternion *from; |
---|
53 | Quaternion *to; |
---|
54 | Quaternion *res; |
---|
55 | |
---|
56 | |
---|
57 | CAMERA_MODE cameraMode; //!< saves the camera mode: how the camera follows the entity |
---|
58 | |
---|
59 | void update_desired_place (); |
---|
60 | |
---|
61 | public: |
---|
62 | Coordinate* coord; |
---|
63 | |
---|
64 | Camera (World* world); |
---|
65 | ~Camera (); |
---|
66 | |
---|
67 | void time_slice (Uint32 deltaT); |
---|
68 | void apply (); |
---|
69 | void bind (WorldEntity* entity); |
---|
70 | void jump (Placement* plc); |
---|
71 | |
---|
72 | void setWorld(World* world); |
---|
73 | |
---|
74 | }; |
---|
75 | |
---|
76 | //! A Class to handle the Target of a Camera. |
---|
77 | class CameraTarget |
---|
78 | { |
---|
79 | private: |
---|
80 | WorldEntity* lookAt; |
---|
81 | |
---|
82 | |
---|
83 | public: |
---|
84 | Coordinate* coord; |
---|
85 | CameraTarget (); |
---|
86 | CameraTarget (Vector pos); //!< a target only needs a Position and no Rotation |
---|
87 | |
---|
88 | void setLookAt (WorldEntity* lookat); |
---|
89 | |
---|
90 | }; |
---|
91 | |
---|
92 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.