Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3639 in orxonox.OLD for orxonox/trunk/src/camera.cc


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

orxonox/trunk: now dynamic FOV. still working

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.