Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/control/src/world_entities/camera.h @ 7422

Last change on this file since 7422 was 7108, checked in by bensch, 19 years ago

lighting war

File size: 2.4 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#include "plane.h"
12
13class World;
14class CameraTarget;
15class Event;
16
17//! an enumerator for different types of view
18typedef enum ViewMode
19{
20  VIEW_NORMAL,
21  VIEW_BEHIND,
22  VIEW_FRONT,
23  VIEW_LEFT,
24  VIEW_RIGHT,
25  VIEW_TOP
26};
27
28//! Camera
29/**
30 * This class controls the viewpoint from which the World is rendered.
31*/
32class Camera : public PNode, public EventListener
33{
34 public:
35  Camera();
36  virtual ~Camera();
37
38  void lookAt(PNode* target);
39  CameraTarget* getTarget() const { return this->target; };
40  PNode* getTargetNode() const;
41
42  void setAspectRatio(float aspectRatio);
43  void setFovy(float fovy);
44  void setClipRegion(float nearClip, float farClip);
45
46  void setViewMode(ViewMode mode);
47  inline const Vector& getViewVector() const { return this->viewVector; }
48  inline const Vector& getUpVector() const { return this->upVector; }
49  inline const Plane& getViewFrustum() const { return this->frustumPlane; }
50
51  inline float distance(const Vector& distance) const { return this->frustumPlane.distancePoint(distance); }
52  inline float distance(const PNode* node) const { return distance(node->getAbsCoor()); }
53
54  void tick(float dt);
55  void apply ();
56  void project();
57
58  void process(const Event &event);
59
60 private:
61  CameraTarget*     target;          //!< The Target of the Camera (where this Camera Looks at)
62
63  float             fovy;            //!< The field of view Angle (in degrees).
64  float             aspectRatio;     //!< The aspect ratio (width / height).
65  float             nearClip;        //!< The near clipping plane.
66  float             farClip;         //!< The far clipping plane.
67
68  float             toFovy;          //!< The fovy-mode to iterate to.
69  ViewMode          currentMode;     //!< The ViewMode the camera is in
70
71  Vector            delay;
72  Plane             frustumPlane;    //!< plane that marks the view frustum
73  Vector            viewVector;      //!< the direction of the camera view
74  Vector            upVector;        //!< direction of the up vector
75};
76
77//! A CameraTarget is where the Camera is looking at.
78class CameraTarget : public PNode
79{
80  friend class Camera;             //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
81
82 private:
83  CameraTarget();
84
85 public:
86};
87
88
89#endif /* _CAMERA_H */
Note: See TracBrowser for help on using the repository browser.