Index: orxonox/trunk/src/camera.cc
===================================================================
--- orxonox/trunk/src/camera.cc	(revision 3634)
+++ orxonox/trunk/src/camera.cc	(revision 3635)
@@ -24,26 +24,14 @@
 using namespace std;
 
+////////////
+// CAMERA //
+////////////
+
 /**
    \brief creates a Camera
-   
-   This standard constructor sets all parameters to zero
 */
-Camera::Camera (World* world)
+Camera::Camera(void)
 {
-  this->world = world;
-  this->bound = NULL;
-  /* give it some physical live */
-  this->m = 10;
-  this->a = new Vector(0.0, 0.0, 0.0);
-  this->v = new Vector(0.0, 0.0, 0.0);
-  this->fs = new Vector(0.0, 0.0, 0.0);
-  this->cameraMode = NORMAL;
-  this->deltaTime = 3000.0;
-  this->cameraOffset = 1.0;
-  this->cameraOffsetZ = 10.0;
-  this->t = 0.0;
-
-
-  this->setDrawable (false);
+  this->target = new CameraTarget();
 }
 
@@ -51,141 +39,21 @@
    \brief default destructor
 */
-Camera::~Camera ()
+Camera::~Camera(void)
 {
-  this->bound = NULL;
-  this->world = NULL;
 
 }
 
 /**
-   \brief time based actualisation of camera parameters
-   \param deltaT: The amount of time that has passed in milliseconds
-   
-   This is called by the World in every time_slice, use it to do fancy time dependant effects (such 
-   as smooth camera movement or swaying).
+   \brief focuses the Camera onto a Target
+   \param target the new PNode the Camera should look at.
 */
-void Camera::tick (Uint32 deltaT)
+void Camera::lookAt(PNode* target)
 {
-  if( this->t <= deltaTime)
-    {this->t += deltaT;}
-  //printf("time is: t=%f\n", t );
-  updateDesiredPlace();
-  //jump(NULL);
+  this->target->setParent(target);
 }
 
-/**
-   \brief this calculates the location where the track wants the camera to be
-   
-   This refreshes the placement the camera should have according to the 
-   bound entity's position on the track.
-*/
-void Camera::updateDesiredPlace ()
+PNode* Camera::getTarget(void)
 {
-  switch(cameraMode)
-    {
-      
-    case ELLIPTICAL:
-      {
-	/*
-	//r = actual_place.r 
-	Orxonox *orx = Orxonox::getInstance();
-	Location lookat;  
-	Placement plFocus;
-	if( bound != NULL)
-	  {
-	    bound->getLookat (&lookat);
-	    orx->getWorld()->calcCameraPos (&lookat, &plFocus);
-	    Quaternion *fr;
-	    if(t < 20.0)
-	      {
-		Vector *start = new Vector(0.0, 1.0, 0.0);
-		r = *(new Vector(0.0, 5.0, 0.0));
-
-		Vector up(0.0, 0.0, 1.0);
-		
-		Vector op(1.0, 0.0, 0.0);
-		float angle = angleDeg(op, *start);
-		printf("angle is: %f\n", angle);
-
-		//if in one plane
-		from = new Quaternion(angle, up);
-
-		//from = new Quaternion(*start, *up);
-		//&from = &plFocus.w;
-		//fr = &plFocus.w; real quaternion use
-		
-
-
-		Vector vDirection(1.0, 0.0, 0.0);
-		//vDirection = plFocus.w.apply(vDirection);
-		to = new Quaternion(vDirection, *start);
-		res = new Quaternion();
-	      }
-	    //printf("vector r = %f, %f, %f\n",r.x, r.y, r.z );
-	    rAbs = r.len();
-	    if(t < 30)
-	      {
-		ka = rAbs / deltaTime*deltaTime;
-	      }
-
-	    res->quatSlerp(to, from, t/deltaTime, res);
-
-	    Vector ursp(0.0, 0.0, 0.0);
-	    desiredPlace.r =  ursp - res->apply(r); 
-
-	    printf("desired place is: %f, %f, %f\n", desiredPlace.r.x, desiredPlace.r.y, desiredPlace.r.z);
-	    //plLastBPlace = *bound->get_placement();
-	    
-	  } 
-      */
-      }
-      break;
-    case SMOTH_FOLLOW:
-      {
-	/*
-	Placement *plBound = bound->getPlacement();
-	Location lcBound;
-	if(bound != null)
-	  {
-	    bound->getLookat(&lcBound);
-	    Vector vDirection(0.0, 0.0, 1.0);
-	    vDirection = plBound->w.apply(vDirection);
-	    desiredPlace.r = (vDirection * ((lcBound.dist-10.0))) + Vector(0,0,5.0);
-	  }
-	*/
-	break;
-      }
-      /* this is a camera mode that tries just to follow the entity. */
-    case STICKY:
-      {
-	/*
-	if(bound != null)
-	  {
-	    Placement *plBound = bound->getPlacement();
-	    Vector vDirection(0.0, 0.0, 1.0);
-	    Vector eclipticOffset(0.0, 0.0, 5.0);
-	    vDirection = plBound->w.apply(vDirection);
-	    desiredPlace.r = plBound->r - vDirection*10 + eclipticOffset;
-	  }
-	*/
-	break;
-      }
-      /* the camera is handled like an entity and rolls on the track */
-    case NORMAL:
-      if( bound != NULL && world != NULL )
-	{
-	  //FIXME: camera should be made via relative coordinates
-	  Vector* cameraOffset = new Vector (-10, 5, 0);
-	  this->setRelCoor (cameraOffset);
-	} 
-      else
-	{
-	  /*
-	  desiredPlace.r = Vector (0,0,0);
-	  desiredPlace.w = Quaternion (); 
-	  */
-	}
-      break;
-    }
+  return (PNode*)this->target;
 }
 
@@ -200,53 +68,14 @@
   glMatrixMode (GL_PROJECTION);
   glLoadIdentity ();
-  // view
-  // TO DO: implement options for frustum generation
-  //glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 250.0);
+
   gluPerspective(60, 1.2f, 0.1, 2000);
-  
-  //Vector up(0,0,1);
-  //Vector dir(1,0,0);
-  //Quaternion q(dir,up);
-  //float matrix[4][4];
-  //q.conjugate().matrix (matrix);
-  //glMultMatrixf ((float*)matrix);
-  //glTranslatef (10,0,-5);
-  //
-  //dir = Vector(-1,-1,0);
-  //q = Quaternion( dir, up);
-  //glMatrixMode (GL_MODELVIEW);
-  //glLoadIdentity ();
-  //q.matrix (matrix);
-  //glMultMatrixf ((float*)matrix);
-  //glTranslatef (2,2,0);
-  //
-  //glBegin(GL_TRIANGLES);
-  //glColor3f(1,0,0);
-  //glVertex3f(0,0,0.5);
-  //glColor3f(0,1,0);
-  //glVertex3f(-0.5,0,-1);
-  //glColor3f(0,0,1);
-  //glVertex3f(0.5,0,-1);
-  //glEnd();	
+  float matrix[4][4];
 
-  // ===== first camera control calculation option
-  // rotation
-  float matrix[4][4];
-  //this->absDirection.conjugate().matrix (matrix);
-  /* orientation and */
-  //glMultMatrixf ((float*)matrix);
+  Vector cameraPosition = this->getAbsCoor();
+  Vector targetPosition = this->target->getAbsCoor();
 
-  /*  translation */
-  //glTranslatef (this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z );
-
-
-  // ===== second camera control calculation option
-
-  Vector r = this->getAbsCoor();
-  gluLookAt(r.x, r.y, r.z, 
-	    this->parent->getAbsCoor ().x, this->parent->getAbsCoor ().y, this->parent->getAbsCoor ().z,
+  gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
+	    targetPosition.x, targetPosition.y, targetPosition.z,
 	    0.0, 1.0, 0.0);
-  
-
   glMatrixMode (GL_MODELVIEW);
   glLoadIdentity ();
@@ -255,29 +84,16 @@
 
 
-/**
-  \brief bind the camera to an entity
-  \param entity: The enitity to bind the camera to
-	
-  This sets the focus of the camera to the given entity. This means that it will use the given WorldEntity's
-  Location and get_lookat() to determine the viewpoint the camera will render from.
-  Note that you cannot bind a camera to a free entity.
-*/
-void Camera::bind (WorldEntity* entity)
+///////////////////
+// CAMERA-TARGET //
+///////////////////
+
+
+CameraTarget::CameraTarget()
 {
-  if( entity != NULL)
-    {
-      if( entity->isFree()) printf("Cannot bind camera to free entity");
-      else 
-	{
-	  this->bound = entity;
-	}
-    } 
+  
 }
 
+CameraTarget::~CameraTarget()
+{
 
-void Camera::setWorld(World* world)
-{
-  this->world = world;
 }
-
-
Index: orxonox/trunk/src/camera.h
===================================================================
--- orxonox/trunk/src/camera.h	(revision 3634)
+++ orxonox/trunk/src/camera.h	(revision 3635)
@@ -7,60 +7,41 @@
 #define _CAMERA_H
 
-#include "world_entity.h"
+#include "p_node.h"
 
 class World;
+class CameraTarget;
+
 
 //! Camera
 /**
-   This class controls the viewpoint from which the World is rendered. To use the 
-   Camera it has to be bound to a WorldEntity which serves as the reference focus 
-   point. The Camera itself calls the WorldEntity::get_lookat() and 
-   World::calc_camera_pos() functions to calculate the position it currently should
-   be in.
+   This class controls the viewpoint from which the World is rendered.
 */
-
-enum CAMERA_MODE {NORMAL, SMOTH_FOLLOW, STICKY, ELLIPTICAL};
-
-class Camera : public WorldEntity {
+class Camera : public PNode 
+{
  private:
-  WorldEntity* bound;		//!< the WorldEntity the Camera is bound to
-  World* world;
-  
-  /* physical system - not needed yet */
-  float m; //!< mass
-  Vector *fs; //!< seil-kraft
-  Vector *a;  //!< acceleration
-  Vector *v;  //!< velocity
-  
-  /* elliptical camera mode variables */
-  float cameraOffset;
-  float cameraOffsetZ;
-  float deltaTime;
-  float t;
-  Vector* r;
-  float rAbs;
-  float ka;
-  float a0;
-
-  Quaternion *from;
-  Quaternion *to;
-  Quaternion *res;
-  
-  
-  CAMERA_MODE cameraMode; //!< saves the camera mode: how the camera follows the entity
-  
-  void updateDesiredPlace ();
+  CameraTarget* target;
   
  public:
-  Camera (World* world);
-  virtual ~Camera ();
+  Camera(void);
+  virtual ~Camera(void);
+
+  void lookAt(PNode* target);
   
-  void tick (Uint32 deltaT);
+  PNode* getTarget();
   void apply ();
-  void bind (WorldEntity* entity);
-
-  void setWorld(World* world);  
-
 };
 
+//! A CameraTarget is where the Camera is looking at.
+class CameraTarget : public PNode 
+{
+  friend class Camera; //! 
+  
+ private:
+  CameraTarget(void);
+  
+ public:
+  virtual ~CameraTarget(void);
+};
+
+
 #endif /* _CAMERA_H */
Index: orxonox/trunk/src/story_entities/world.cc
===================================================================
--- orxonox/trunk/src/story_entities/world.cc	(revision 3634)
+++ orxonox/trunk/src/story_entities/world.cc	(revision 3635)
@@ -302,7 +302,8 @@
 	    
 	    // bind camera
-	    this->localCamera = new Camera(this);
+	    this->localCamera = new Camera();
 	    this->localCamera->setName ("camera");
-	    this->localCamera->bind (this->localPlayer);
+	    this->localCamera->lookAt(this->localPlayer);
+
 	    /*monitor progress*/
 	    this->glmis->step();	    
@@ -366,7 +367,7 @@
 	    
 	    // bind camera
-	    this->localCamera = new Camera (this);
+	    this->localCamera = new Camera ();
 	    this->localCamera->setName ("camera");
-	    this->localCamera->bind (myPlayer);	
+	    this->localCamera->lookAt(this->localPlayer);
 	    this->localPlayer->addChild (this->localCamera);
 
@@ -749,5 +750,4 @@
       
       /* update tick the rest */
-      this->localCamera->tick(dt);
       this->trackManager->tick(dt);
     }
