Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7347 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Apr 19, 2006, 1:38:23 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some more stuff (now one can play around with them using the Shell →
GameWorld Urban Playmode …. Vertical/Full3D/Horizontal

Location:
trunk/src/world_entities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/camera.cc

    r7173 r7347  
    4242  this->setClipRegion(.1, 2000);
    4343
    44   this->setViewMode(VIEW_NORMAL);
     44  this->setViewMode(Camera::ViewNormal);
    4545
    4646  this->setParentMode(PNODE_ALL);
     
    100100  {
    101101    default:
    102     case VIEW_NORMAL:
     102    case Camera::ViewNormal:
    103103      this->toFovy = 60.0;
    104104      this->setRelCoorSoft(-10, 5, 0);
    105105      this->target->setRelCoorSoft(0,0,0);
    106106      break;
    107     case VIEW_BEHIND:
    108       break;
    109     case VIEW_FRONT:
     107    case Camera::ViewBehind:
     108      break;
     109    case Camera::ViewFront:
    110110      this->toFovy = 120.0;
    111111      this->setRelCoorSoft(4, 0, 0, 5);
    112112      this->target->setRelCoorSoft(Vector(10,0,0), 5);
    113113      break;
    114     case VIEW_LEFT:
     114    case Camera::ViewLeft:
    115115      this->toFovy = 90;
    116116      this->setRelCoorSoft(0, 1, -10, .5);
    117117      this->target->setRelCoorSoft(0,0,0);
    118118      break;
    119     case VIEW_RIGHT:
     119    case Camera::ViewRight:
    120120      this->toFovy = 90;
    121121      this->setRelCoorSoft(Vector(0, 1, 10));
    122122      this->target->setRelCoorSoft(0,0,0);
    123123      break;
    124     case VIEW_TOP:
     124    case Camera::ViewTop:
    125125      this->toFovy= 120;
    126126      this->setRelCoorSoft(Vector(30, 50, 0));
     
    195195  if( event.type == KeyMapper::PEV_VIEW0)
    196196  {
    197     this->setViewMode(VIEW_NORMAL);
     197    this->setViewMode(Camera::ViewNormal);
    198198  }
    199199  else if( event.type == KeyMapper::PEV_VIEW1)
    200200  {
    201     this->setViewMode(VIEW_BEHIND);
     201    this->setViewMode(Camera::ViewBehind);
    202202  }
    203203  else if( event.type == KeyMapper::PEV_VIEW2)
    204204  {
    205     this->setViewMode(VIEW_FRONT);
     205    this->setViewMode(Camera::ViewFront);
    206206  }
    207207  else if( event.type == KeyMapper::PEV_VIEW3)
    208208  {
    209     this->setViewMode(VIEW_LEFT);
     209    this->setViewMode(Camera::ViewLeft);
    210210  }
    211211  else if( event.type == KeyMapper::PEV_VIEW4)
    212212  {
    213     this->setViewMode(VIEW_RIGHT);
     213    this->setViewMode(Camera::ViewRight);
    214214  }
    215215  else if( event.type == KeyMapper::PEV_VIEW5)
    216216  {
    217     this->setViewMode(VIEW_TOP);
     217    this->setViewMode(Camera::ViewTop);
    218218  }
    219219}
  • trunk/src/world_entities/camera.h

    r7173 r7347  
    1515class Event;
    1616
    17 //! an enumerator for different types of view
    18 typedef enum ViewMode
    19 {
    20   VIEW_NORMAL,
    21   VIEW_BEHIND,
    22   VIEW_FRONT,
    23   VIEW_LEFT,
    24   VIEW_RIGHT,
    25   VIEW_TOP
    26 };
    2717
    2818//! Camera
     
    3222class Camera : public PNode, public EventListener
    3323{
    34  public:
     24public:
     25  //! an enumerator for different types of view
     26  typedef enum ViewMode
     27  {
     28    ViewNormal,
     29    ViewBehind,
     30    ViewFront,
     31    ViewLeft,
     32    ViewRight,
     33    ViewTop
     34  };
     35
    3536  Camera();
    3637  virtual ~Camera();
     
    4849  void setToFovy(float toFovy) { this->toFovy = toFovy; };
    4950
    50   void setViewMode(ViewMode mode);
     51  void setViewMode(Camera::ViewMode mode);
    5152  inline const Vector& getViewVector() const { return this->viewVector; }
    5253  inline const Vector& getUpVector() const { return this->upVector; }
     
    6263  void process(const Event &event);
    6364
    64  private:
     65private:
    6566  CameraTarget*     target;          //!< The Target of the Camera (where this Camera Looks at)
    6667
     
    7172
    7273  float             toFovy;          //!< The fovy-mode to iterate to.
    73   ViewMode          currentMode;     //!< The ViewMode the camera is in
     74  Camera::ViewMode  currentMode;     //!< The ViewMode the camera is in
    7475
    7576  Vector            delay;
     
    8485  friend class Camera;             //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
    8586
    86  private:
     87private:
    8788  CameraTarget();
    8889
    89  public:
     90public:
    9091};
    9192
  • trunk/src/world_entities/playable.cc

    r7346 r7347  
    2121#include "player.h"
    2222#include "state.h"
     23#include "camera.h"
     24
    2325#include "util/loading/load_param.h"
    2426
     
    251253 */
    252254void Playable::setCameraMode(unsigned int cameraMode)
    253 {}
     255{
     256  State::getCamera()->setViewMode((Camera::ViewMode)cameraMode);
     257}
    254258
    255259
     
    265269  else
    266270  {
     271    this->enterPlaymode(playmode);
    267272    this->playmode = playmode;
    268273    return true;
     
    289294 * In this function all the actions that are required to enter the Playmode are described.
    290295 * e.g: camera, rotation, wait cycle and so on...
     296 *
     297 * on enter of this function the playmode is still the old playmode.
    291298 */
    292299void Playable::enterPlaymode(Playable::Playmode playmode)
    293300{
    294 
    295 }
    296 
     301  switch(playmode)
     302  {
     303    default:
     304      this->attachCamera();
     305      break;
     306    case Playable::Horizontal:
     307      this->setCameraMode(Camera::ViewTop);
     308      break;
     309    case Playable::Vertical:
     310      this->setCameraMode(Camera::ViewLeft);
     311      break;
     312    case Playable::FromBehind:
     313      this->setCameraMode(Camera::ViewBehind);
     314      break;
     315  }
     316}
    297317/**
    298318 * @brief helps us colliding Playables
  • trunk/src/world_entities/playable.h

    r7346 r7347  
    6060  void attachCamera();
    6161  void detachCamera();
    62   virtual void setCameraMode(unsigned int cameraMode = 0);
     62  void setCameraMode(unsigned int cameraMode = 0);
    6363  bool playmodeSupported(Playable::Playmode playmode) const { return this->supportedPlaymodes & playmode; };
    6464  bool setPlaymode(Playable::Playmode playmode);
Note: See TracChangeset for help on using the changeset viewer.