Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3639 in orxonox.OLD


Ignore:
Timestamp:
Mar 23, 2005, 1:37:54 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now dynamic FOV. still working

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

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

    r3638 r3639  
    3333Camera::Camera(void)
    3434{
     35  this->setClassName("Camera");
    3536  this->target = new CameraTarget();
     37
     38  this->toRelCoor = new Vector;
    3639
    3740  this->setFovy(60);
    3841  this->setAspectRatio(1.2f);
    3942  this->setClipRegion(.1, 2000);
     43  this->setViewMode(VIEW_NORMAL);
     44
    4045}
    4146
     
    4550Camera::~Camera(void)
    4651{
    47 
    4852}
    4953
     
    9599}
    96100
     101void Camera::setViewMode(ViewMode mode)
     102{
     103  switch (mode)
     104    {
     105    default:
     106    case VIEW_NORMAL:
     107      this->toFovy = 60.0;
     108      *this->toRelCoor = Vector (-10, 5, 0);
     109      break;
     110    case VIEW_BEHIND:
     111      this->toFovy = 90.0;
     112      *this->toRelCoor = Vector (-6, 2, 0);
     113      break;
     114    case VIEW_FRONT:
     115      this->toFovy = 95.0;
     116      *this->toRelCoor = Vector (10, 5, 0);
     117      break;
     118    case VIEW_LEFT:
     119      this->toFovy = 90;
     120      *this->toRelCoor = Vector (0, 5, -10);
     121      break;
     122    case VIEW_RIGHT:
     123      this->toFovy = 90;
     124      *this->toRelCoor = Vector (0, 5, 10);
     125      break;
     126    }
     127}
     128
     129
     130/**
     131   \brief Updates the position of the camera.
     132   \param dt The time that elapsed.
     133*/
     134void Camera::tick(float dt)
     135{
     136  dt /= 1000;
     137  this->fovy += (this->toFovy - this->fovy) * dt;
     138}
     139
     140
    97141/**
    98142   \brief initialize rendering perspective according to this camera
     
    137181CameraTarget::CameraTarget()
    138182{
     183  this->setClassName("CameraTarget");
    139184  this->setMode(PNODE_MOVEMENT);
    140185}
  • orxonox/trunk/src/camera.h

    r3636 r3639  
    1212class CameraTarget;
    1313
     14enum ViewMode{VIEW_NORMAL, VIEW_BEHIND, VIEW_FRONT, VIEW_LEFT, VIEW_RIGHT};
    1415
    1516//! Camera
     
    2627  float nearClip;                  //!< The near clipping plane.
    2728  float farClip;                   //!< The far clipping plane.
     29
     30  Vector* toRelCoor;
     31  float toFovy;
    2832 
    2933 public:
     
    3842  void setClipRegion(float nearClip, float farClip);
    3943
     44  void setViewMode(ViewMode mode);
     45  void tick(float dt);
    4046  void apply (void);
    4147};
  • orxonox/trunk/src/story_entities/world.cc

    r3637 r3639  
    372372            this->localCamera->lookAt(LightManager::getInstance()->getLight(0));
    373373            this->localCamera->setParent(this->localPlayer);
    374             Vector* cameraOffset = new Vector (-10, 5, 0);
    375             this->localCamera->setRelCoor (cameraOffset);
    376374
    377375            // Create SkySphere
     
    754752      /* update tick the rest */
    755753      this->trackManager->tick(dt);
     754      this->localCamera->tick(dt);
    756755    }
    757756  this->lastFrame = currentFrame;
Note: See TracChangeset for help on using the changeset viewer.