Last change
on this file since 6520 was
6139,
checked in by patrick, 19 years ago
|
trunk: merged branche network with trunk using command: svn merge -r5999:HEAD, conflicts resolved in favor of the trunk bla
|
File size:
1.6 KB
|
Line | |
---|
1 | /*! |
---|
2 | * @file camera.h |
---|
3 | * Viewpoint controlling class definitions |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _CAMERA_H |
---|
7 | #define _CAMERA_H |
---|
8 | |
---|
9 | #include "p_node.h" |
---|
10 | #include "event_listener.h" |
---|
11 | |
---|
12 | class World; |
---|
13 | class CameraTarget; |
---|
14 | class Event; |
---|
15 | |
---|
16 | //! an enumerator for different types of view |
---|
17 | typedef enum ViewMode |
---|
18 | { |
---|
19 | VIEW_NORMAL, |
---|
20 | VIEW_BEHIND, |
---|
21 | VIEW_FRONT, |
---|
22 | VIEW_LEFT, |
---|
23 | VIEW_RIGHT, |
---|
24 | VIEW_TOP |
---|
25 | }; |
---|
26 | |
---|
27 | //! Camera |
---|
28 | /** |
---|
29 | * This class controls the viewpoint from which the World is rendered. |
---|
30 | */ |
---|
31 | class Camera : public PNode, public EventListener |
---|
32 | { |
---|
33 | public: |
---|
34 | Camera(); |
---|
35 | virtual ~Camera(); |
---|
36 | |
---|
37 | void lookAt(PNode* target); |
---|
38 | PNode* getTarget(); |
---|
39 | |
---|
40 | void setAspectRatio(float aspectRatio); |
---|
41 | void setFovy(float fovy); |
---|
42 | void setClipRegion(float nearClip, float farClip); |
---|
43 | |
---|
44 | void setViewMode(ViewMode mode); |
---|
45 | void tick(float dt); |
---|
46 | void apply (); |
---|
47 | |
---|
48 | void process(const Event &event); |
---|
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 | |
---|
58 | float toFovy; //!< The fovy-mode to iterate to. |
---|
59 | ViewMode currentMode; //!< The ViewMode the camera is in |
---|
60 | }; |
---|
61 | |
---|
62 | //! A CameraTarget is where the Camera is looking at. |
---|
63 | class CameraTarget : public PNode |
---|
64 | { |
---|
65 | friend class Camera; //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it. |
---|
66 | |
---|
67 | private: |
---|
68 | CameraTarget(); |
---|
69 | |
---|
70 | public: |
---|
71 | }; |
---|
72 | |
---|
73 | |
---|
74 | #endif /* _CAMERA_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.