|
Last change
on this file since 3721 was
3643,
checked in by bensch, 21 years ago
|
|
orxonox/trunk: better views with Camera
|
|
File size:
1.4 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 "p_node.h" |
|---|
| 10 | #include "vector.h" |
|---|
| 11 | |
|---|
| 12 | class World; |
|---|
| 13 | class CameraTarget; |
|---|
| 14 | |
|---|
| 15 | enum ViewMode{VIEW_NORMAL, VIEW_BEHIND, VIEW_FRONT, VIEW_LEFT, VIEW_RIGHT, VIEW_TOP}; |
|---|
| 16 | |
|---|
| 17 | //! Camera |
|---|
| 18 | /** |
|---|
| 19 | This class controls the viewpoint from which the World is rendered. |
|---|
| 20 | */ |
|---|
| 21 | class Camera : public PNode |
|---|
| 22 | { |
|---|
| 23 | private: |
|---|
| 24 | CameraTarget* target; //!< The Target of the Camera (where this Camera Looks at) |
|---|
| 25 | |
|---|
| 26 | float fovy; //!< The field of view Angle (in degrees). |
|---|
| 27 | float aspectRatio; //!< The aspect ratio (width / height). |
|---|
| 28 | float nearClip; //!< The near clipping plane. |
|---|
| 29 | float farClip; //!< The far clipping plane. |
|---|
| 30 | |
|---|
| 31 | Vector toRelCoor; |
|---|
| 32 | float toFovy; |
|---|
| 33 | |
|---|
| 34 | public: |
|---|
| 35 | Camera(void); |
|---|
| 36 | virtual ~Camera(void); |
|---|
| 37 | |
|---|
| 38 | void lookAt(PNode* target); |
|---|
| 39 | PNode* getTarget(); |
|---|
| 40 | |
|---|
| 41 | void setAspectRatio(float aspectRatio); |
|---|
| 42 | void setFovy(float fovy); |
|---|
| 43 | void setClipRegion(float nearClip, float farClip); |
|---|
| 44 | |
|---|
| 45 | void setViewMode(ViewMode mode); |
|---|
| 46 | void tick(float dt); |
|---|
| 47 | void apply (void); |
|---|
| 48 | }; |
|---|
| 49 | |
|---|
| 50 | //! A CameraTarget is where the Camera is looking at. |
|---|
| 51 | class CameraTarget : public PNode |
|---|
| 52 | { |
|---|
| 53 | friend class Camera; //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it. |
|---|
| 54 | |
|---|
| 55 | private: |
|---|
| 56 | CameraTarget(void); |
|---|
| 57 | |
|---|
| 58 | public: |
|---|
| 59 | virtual ~CameraTarget(void); |
|---|
| 60 | }; |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | #endif /* _CAMERA_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.