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