Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/camera.h @ 7250

Last change on this file since 7250 was 7173, checked in by bensch, 19 years ago

trunk: minor

File size: 2.6 KB
RevLine 
[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"
[7009]11#include "plane.h"
[2100]12
[2636]13class World;
[3635]14class CameraTarget;
[4414]15class Event;
[2100]16
[4490]17//! an enumerator for different types of view
[4592]18typedef 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]32class Camera : public PNode, public EventListener
[3635]33{
34 public:
[4746]35  Camera();
36  virtual ~Camera();
[3635]37
38  void lookAt(PNode* target);
[7014]39  CameraTarget* getTarget() const { return this->target; };
40  PNode* getTargetNode() const;
[3636]41
42  void setAspectRatio(float aspectRatio);
43  void setClipRegion(float nearClip, float farClip);
44
[7173]45  /** @param fovy new field of view factor (in degrees) */
46  void setFovy(float fovy) { this->fovy = fovy; };
47  /** @param fovy new field of view factor (in degrees) to iterate to */
48  void setToFovy(float toFovy) { this->toFovy = toFovy; };
49
[3639]50  void setViewMode(ViewMode mode);
[7009]51  inline const Vector& getViewVector() const { return this->viewVector; }
52  inline const Vector& getUpVector() const { return this->upVector; }
53  inline const Plane& getViewFrustum() const { return this->frustumPlane; }
54
[7013]55  inline float distance(const Vector& distance) const { return this->frustumPlane.distancePoint(distance); }
56  inline float distance(const PNode* node) const { return distance(node->getAbsCoor()); }
[7009]57
[3639]58  void tick(float dt);
[4746]59  void apply ();
[7108]60  void project();
[4414]61
62  void process(const Event &event);
[4490]63
64 private:
65  CameraTarget*     target;          //!< The Target of the Camera (where this Camera Looks at)
66
67  float             fovy;            //!< The field of view Angle (in degrees).
68  float             aspectRatio;     //!< The aspect ratio (width / height).
69  float             nearClip;        //!< The near clipping plane.
70  float             farClip;         //!< The far clipping plane.
71
[4986]72  float             toFovy;          //!< The fovy-mode to iterate to.
[6034]73  ViewMode          currentMode;     //!< The ViewMode the camera is in
[6999]74
75  Vector            delay;
[7009]76  Plane             frustumPlane;    //!< plane that marks the view frustum
77  Vector            viewVector;      //!< the direction of the camera view
78  Vector            upVector;        //!< direction of the up vector
[3635]79};
[2068]80
[3635]81//! A CameraTarget is where the Camera is looking at.
[4592]82class CameraTarget : public PNode
[3635]83{
[3636]84  friend class Camera;             //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
[4592]85
[3635]86 private:
[4746]87  CameraTarget();
[4592]88
[2068]89 public:
[3635]90};
[2068]91
92
[3224]93#endif /* _CAMERA_H */
Note: See TracBrowser for help on using the repository browser.