source:
orxonox.OLD/branches/spaceshipcontrol/src/world_entities/camera.h
@
6028
Last change on this file since 6028 was 6001, checked in by bknecht, 19 years ago | |
---|---|
File size: 1.7 KB |
Rev | Line | |
---|---|---|
[4592] | 1 | /*! |
[5005] | 2 | * @file camera.h |
3 | * Viewpoint controlling class definitions | |
[4592] | 4 | */ |
[2068] | 5 | |
[3224] | 6 | #ifndef _CAMERA_H |
7 | #define _CAMERA_H | |
[2068] | 8 | |
[3635] | 9 | #include "p_node.h" |
[3641] | 10 | #include "vector.h" |
[4414] | 11 | #include "event_listener.h" |
[2100] | 12 | |
[2636] | 13 | class World; |
[3635] | 14 | class CameraTarget; |
[4414] | 15 | class Event; |
[2100] | 16 | |
[4490] | 17 | //! an enumerator for different types of view |
[4592] | 18 | typedef enum ViewMode |
19 | { | |
20 | VIEW_NORMAL, | |
21 | VIEW_BEHIND, | |
22 | VIEW_FRONT, | |
23 | VIEW_LEFT, | |
24 | VIEW_RIGHT, | |
25 | VIEW_TOP | |
26 | }; | |
[3635] | 27 | |
[2096] | 28 | //! Camera |
29 | /** | |
[5005] | 30 | * This class controls the viewpoint from which the World is rendered. |
[2096] | 31 | */ |
[4414] | 32 | class Camera : public PNode, public EventListener |
[3635] | 33 | { |
34 | public: | |
[4746] | 35 | Camera(); |
36 | virtual ~Camera(); | |
[3635] | 37 | |
38 | void lookAt(PNode* target); | |
39 | PNode* getTarget(); | |
[3636] | 40 | |
41 | void setAspectRatio(float aspectRatio); | |
42 | void setFovy(float fovy); | |
43 | void setClipRegion(float nearClip, float farClip); | |
44 | ||
[3639] | 45 | void setViewMode(ViewMode mode); |
46 | void tick(float dt); | |
[4746] | 47 | void apply (); |
[4414] | 48 | |
49 | void process(const Event &event); | |
[4490] | 50 | |
51 | private: | |
52 | CameraTarget* target; //!< The Target of the Camera (where this Camera Looks at) | |
53 | ||
54 | float fovy; //!< The field of view Angle (in degrees). | |
55 | float aspectRatio; //!< The aspect ratio (width / height). | |
56 | float nearClip; //!< The near clipping plane. | |
57 | float farClip; //!< The far clipping plane. | |
58 | ||
[4986] | 59 | float toFovy; //!< The fovy-mode to iterate to. |
[6001] | 60 | ViewMode currentMode; //!< The ViewMode the camera is in |
[3635] | 61 | }; |
[2068] | 62 | |
[3635] | 63 | //! A CameraTarget is where the Camera is looking at. |
[4592] | 64 | class CameraTarget : public PNode |
[3635] | 65 | { |
[3636] | 66 | friend class Camera; //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it. |
[4592] | 67 | |
[3635] | 68 | private: |
[4746] | 69 | CameraTarget(); |
[4592] | 70 | |
[2068] | 71 | public: |
[3635] | 72 | }; |
[2068] | 73 | |
74 | ||
[3224] | 75 | #endif /* _CAMERA_H */ |
Note: See TracBrowser
for help on using the repository browser.