Last change
on this file since 3050 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
|
Rev | Line | |
---|
[2096] | 1 | /*! |
---|
| 2 | \file camera.h |
---|
| 3 | \brief Viewpoint controlling class definitions |
---|
| 4 | */ |
---|
[2068] | 5 | |
---|
| 6 | #ifndef CAMERA_H |
---|
| 7 | #define CAMERA_H |
---|
| 8 | |
---|
[2100] | 9 | #include "stdincl.h" |
---|
| 10 | |
---|
| 11 | class WorldEntity; |
---|
[2636] | 12 | class World; |
---|
[3028] | 13 | class CameraTarget; |
---|
[2100] | 14 | |
---|
[2096] | 15 | //! Camera |
---|
| 16 | /** |
---|
[2636] | 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. |
---|
[2096] | 22 | */ |
---|
[2551] | 23 | |
---|
| 24 | enum CAMERA_MODE {NORMAL, SMOTH_FOLLOW, STICKY, ELLIPTICAL}; |
---|
| 25 | |
---|
[3039] | 26 | class Camera |
---|
[3023] | 27 | { |
---|
[2068] | 28 | private: |
---|
[2551] | 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 |
---|
[2636] | 32 | World* world; |
---|
[3039] | 33 | |
---|
[3028] | 34 | CameraTarget* target; |
---|
[2551] | 35 | |
---|
| 36 | /* physical system - not needed yet */ |
---|
[3023] | 37 | float mass; //!< mass |
---|
| 38 | Vector *acceleration; //!< acceleration |
---|
| 39 | Vector *velocity; //!< velocity |
---|
[2551] | 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; |
---|
[2068] | 51 | |
---|
[2551] | 52 | Quaternion *from; |
---|
| 53 | Quaternion *to; |
---|
| 54 | Quaternion *res; |
---|
| 55 | |
---|
[2636] | 56 | |
---|
[2551] | 57 | CAMERA_MODE cameraMode; //!< saves the camera mode: how the camera follows the entity |
---|
[2636] | 58 | |
---|
| 59 | void update_desired_place (); |
---|
| 60 | |
---|
[2068] | 61 | public: |
---|
[3039] | 62 | Coordinate* coord; |
---|
| 63 | |
---|
[2636] | 64 | Camera (World* world); |
---|
[2068] | 65 | ~Camera (); |
---|
[2636] | 66 | |
---|
| 67 | void time_slice (Uint32 deltaT); |
---|
| 68 | void apply (); |
---|
| 69 | void bind (WorldEntity* entity); |
---|
| 70 | void jump (Placement* plc); |
---|
[2068] | 71 | |
---|
[2636] | 72 | void setWorld(World* world); |
---|
[2068] | 73 | |
---|
| 74 | }; |
---|
| 75 | |
---|
[3028] | 76 | //! A Class to handle the Target of a Camera. |
---|
[3039] | 77 | class CameraTarget |
---|
[3028] | 78 | { |
---|
| 79 | private: |
---|
| 80 | WorldEntity* lookAt; |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | public: |
---|
[3039] | 84 | Coordinate* coord; |
---|
[3028] | 85 | CameraTarget (); |
---|
| 86 | CameraTarget (Vector pos); //!< a target only needs a Position and no Rotation |
---|
| 87 | |
---|
| 88 | void setLookAt (WorldEntity* lookat); |
---|
| 89 | |
---|
| 90 | }; |
---|
| 91 | |
---|
[2068] | 92 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.