Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Feb 3, 2006, 12:14:32 PM (19 years ago)
Author:
patrick
Message:

trunk: camera frustum culling plane added

Location:
trunk/src/world_entities
Files:
2 edited

Legend:

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

    r6999 r7009  
    145145void Camera::tick(float dt)
    146146{
     147  //update frustum plane
     148  this->viewVector = this->getAbsCoor() -  this->target->getAbsCoor();
     149  this->frustumPlane = Plane(this->viewVector, this->getAbsCoor() + Vector(-70.0,0.0,0.0));
     150
     151  this->upVector =  this->getAbsDirV();
     152
     153
    147154  float tmpFovy = (this->toFovy - this->fovy) ;
    148155  if (tmpFovy > 0.01)
     
    173180  Vector cameraPosition = this->getAbsCoor();
    174181  Vector targetPosition = this->target->getAbsCoor();
    175   Vector up = this->getAbsDirV();
    176   Vector delay = Vector(0, 0, 0);
    177   //if( currentMode != VIEW_FRONT) delay = (this->target->getVelocity()) / 25.0f;
    178182
    179183   // Setting the Camera Eye, lookAt and up Vectors
    180   gluLookAt(cameraPosition.x - delay.x, cameraPosition.y - delay.y, cameraPosition.z - delay.z,
     184  gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
    181185            targetPosition.x, targetPosition.y, targetPosition.z,
    182             up.x, up.y, up.z);
     186            this->upVector.x, this->upVector.y, this->upVector.z);
    183187
    184188
  • trunk/src/world_entities/camera.h

    r6999 r7009  
    99#include "p_node.h"
    1010#include "event_listener.h"
     11#include "plane.h"
    1112
    1213class World;
     
    4344
    4445  void setViewMode(ViewMode mode);
     46  inline const Vector& getViewVector() const { return this->viewVector; }
     47  inline const Vector& getUpVector() const { return this->upVector; }
     48  inline const Plane& getViewFrustum() const { return this->frustumPlane; }
     49
     50
    4551  void tick(float dt);
    4652  void apply ();
     
    6066
    6167  Vector            delay;
     68  Plane             frustumPlane;    //!< plane that marks the view frustum
     69  Vector            viewVector;      //!< the direction of the camera view
     70  Vector            upVector;        //!< direction of the up vector
    6271};
    6372
Note: See TracChangeset for help on using the changeset viewer.