Index: trunk/src/world_entities/Makefile.am
===================================================================
--- trunk/src/world_entities/Makefile.am	(revision 10376)
+++ trunk/src/world_entities/Makefile.am	(revision 10379)
@@ -6,5 +6,5 @@
 
 ## THESE ARE THE BASE CLASSES OF ALL WORLD_ENTITIES
-libORXwe_a_SOURCES = world_entity.cc 				camera.cc 		playable.cc 		player.cc \
+libORXwe_a_SOURCES = world_entity.cc 	cameraman.cc			camera.cc 		playable.cc 		player.cc \
 						npcs/npc.cc 				weapons/weapon_manager.cc 		weapons/crosshair.cc \
 				weapons/weapon.cc 		weapons/ammo_container.cc 		projectiles/projectile.cc \
@@ -14,5 +14,5 @@
 
 
-noinst_HEADERS = world_entity.h 				camera.h 		extendable.h 		playable.h \
+noinst_HEADERS = world_entity.h 	cameraman.h			camera.h 		extendable.h 		playable.h \
 				player.h 				npcs/npc.h 				weapons/weapon_manager.h 		weapons/crosshair.h \
 				weapons/weapon.h 		weapons/ammo_container.h 		projectiles/projectile.h \
Index: trunk/src/world_entities/WorldEntities.am
===================================================================
--- trunk/src/world_entities/WorldEntities.am	(revision 10376)
+++ trunk/src/world_entities/WorldEntities.am	(revision 10379)
@@ -24,4 +24,5 @@
                 world_entities/test_entity.cc \
                 world_entities/test_entity2.cc \
+                world_entities/blackscreen.cc \
                 world_entities/planet.cc \
                 world_entities/bsp_entity.cc \
@@ -151,4 +152,5 @@
                 test_entity.h \
                 test_entity2.h \
+                blackscreen.h \
                 planet.h \
                 bsp_entity.h \
Index: trunk/src/world_entities/blackscreen.cc
===================================================================
--- trunk/src/world_entities/blackscreen.cc	(revision 10379)
+++ trunk/src/world_entities/blackscreen.cc	(revision 10379)
@@ -0,0 +1,177 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific
+   main-programmer: Filip Gospodinov
+   co-programmer:
+*/
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+
+#include "executor/executor.h"
+#include "util/loading/factory.h"
+#include "util/loading/load_param.h"
+#include "blackscreen.h"
+#include "debug.h"
+#include "material.h"
+#include "state.h"
+
+ObjectListDefinition(BlackScreen);
+CREATE_FACTORY(BlackScreen);
+
+
+
+/**
+ *
+ */
+BlackScreen::BlackScreen()
+{
+  this->init();
+
+
+}
+
+
+/**
+ *
+ */
+BlackScreen::BlackScreen(const TiXmlElement* root)
+{
+  this->init();
+
+  if( root != NULL)
+    this->loadParams(root);
+
+}
+
+
+/**
+ *
+ */
+BlackScreen::~BlackScreen()
+{}
+
+
+/**
+ *
+ */
+void BlackScreen::init()
+{
+  this->registerObject(this, BlackScreen::_objectList);
+  this->toList(OM_GROUP_00);
+
+  this->material = new Material();
+  this->material->setDiffuse(0,0,0);
+  this->material->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+  i=0;
+  state=0;
+  fadeSpeed=1;
+
+}
+
+
+/**
+ * loads the Settings of a MD2Creature from an XML-element.
+ * @param root the XML-element to load the MD2Creature's properties from
+ */
+void BlackScreen::loadParams(const TiXmlElement* root)
+{
+  WorldEntity::loadParams(root);
+}
+
+
+
+
+void BlackScreen::draw() const
+{
+  glPushAttrib(GL_ENABLE_BIT);
+  glDisable(GL_LIGHTING);
+  glEnable(GL_BLEND);   // Turn Blending On
+
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+  /* translate */
+  glTranslatef (this->getAbsCoor ().x,
+                this->getAbsCoor ().y,
+                this->getAbsCoor ().z);
+  Vector tmpRot = this->getAbsDir().getSpacialAxis();
+  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
+
+this->material->setTransparency(i);
+this->material->select();
+
+  glBegin(GL_QUADS);
+  glVertex3f(0.,-100.0f,-100.0f);
+  glVertex3f(0., -100.0f,100.0f);
+  glVertex3f(0., 100.0f,100.0f);
+  glVertex3f(0., 100.0f,-100.0f);
+
+  glEnd();
+
+  glPopMatrix();
+  glPopAttrib();
+}
+
+/**
+ *
+ */
+void BlackScreen::tick (float time)
+{
+if (state == true)
+  fadeOut();
+else
+  fadeIn();
+}
+
+void BlackScreen::fadeIn()
+{
+  if (i>0)
+    i=i-0.005*fadeSpeed;
+  else
+    this->toList(OM_DEAD);
+}
+
+void BlackScreen::fadeOut()
+{
+  if (i<=1)
+    i=i+0.005*fadeSpeed;
+}
+
+void  BlackScreen::toggleFade ()
+{
+    this->state= !this->state;
+
+    if(state)
+    {
+      this->toList(OM_COMMON);
+    }
+}
+
+void BlackScreen::changeFadeSpeed(float newSpeed)
+{
+  fadeSpeed=newSpeed;
+}
+
+bool BlackScreen::isBlack()
+{
+if (i==1)
+  return 1;
+else
+  return 0;
+}
+
+bool BlackScreen::isTrans()
+{
+  if (i==0)
+    return 1;
+  else
+    return 0;
+}
Index: trunk/src/world_entities/blackscreen.h
===================================================================
--- trunk/src/world_entities/blackscreen.h	(revision 10379)
+++ trunk/src/world_entities/blackscreen.h	(revision 10379)
@@ -0,0 +1,40 @@
+#ifndef _BLACKSCREEN_H
+#define _BLACKSCREEN_H
+
+#include "world_entity.h"
+
+
+class TiXmlElement;
+class Material;
+
+class BlackScreen : public WorldEntity
+{
+    ObjectListDeclaration(BlackScreen);
+
+  private:
+    float i;
+    bool state;
+    Material*       material;
+    void fadeIn();
+    void fadeOut();
+    float fadeSpeed;
+
+  public:
+    BlackScreen();
+    BlackScreen(const TiXmlElement* root);
+    virtual ~BlackScreen();
+
+    void init();
+    virtual void loadParams(const TiXmlElement* root);
+
+    void toggleFade();
+    void changeFadeSpeed(float newSpeed);
+    bool isBlack();
+    bool isTrans();
+    virtual void tick (float time);
+
+    virtual void draw() const;
+
+};
+
+#endif /* _BLACKSCREEN_H */
Index: trunk/src/world_entities/camera.cc
===================================================================
--- trunk/src/world_entities/camera.cc	(revision 10376)
+++ trunk/src/world_entities/camera.cc	(revision 10379)
@@ -18,8 +18,14 @@
 #include "key_mapper.h"
 #include "glincl.h"
-//#include "util/loading/load_param.h"
+#include "util/loading/load_param.h"
 #include "world_entity.h"
+#include "vector.h"
+#include "targets.h"
+
+
+
 
 ObjectListDefinition(Camera);
+
 
 /**
@@ -51,5 +57,5 @@
   this->setName("camera");
   this->target = new CameraTarget();
-
+  this->target->masta=this;
   this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW0);
   this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW1);
@@ -89,13 +95,18 @@
 void Camera::lookAt(PNode* target)
 {
+  this->target->setParentSoft(target,0.2);
+}
+
+/**
+ * @returns The PNode of the Target (from there you can get position and so on
+*/
+PNode* Camera::getTargetNode() const
+{
+  return (PNode*)this->target;
+}
+
+void Camera::setTargetNode(PNode* target)
+{
   this->target->setParent(target);
-}
-
-/**
- * @returns The PNode of the Target (from there you can get position and so on
-*/
-PNode* Camera::getTargetNode() const
-{
-  return (PNode*)this->target;
 }
 
@@ -186,11 +197,16 @@
   this->viewVector = (this->target->getAbsCoor() - this->getAbsCoor()).getNormalized();
   this->frustumPlane = Plane(this->viewVector, this->getAbsCoor() + this->viewVector * 0.1);
-
   this->upVector =  this->getAbsDirV();
 
-
+  // iteration for fovy
   float tmpFovy = (this->toFovy - this->fovy);
   if (fabsf(tmpFovy) > 0.01)
     this->fovy += tmpFovy * fabsf(dt);
+
+
+
+
+  //iterate(float dt, translate, target)
+  target->translate(dt);
 }
 
@@ -227,5 +243,5 @@
   Vector targetPosition = this->target->getAbsCoor();
 
-       // Setting the Camera Eye, lookAt and up Vectors
+        //Setting the Camera Eye, lookAt and up Vectors
   gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
             targetPosition.x, targetPosition.y, targetPosition.z,
@@ -269,5 +285,5 @@
 }
 
-/*
+
 void Camera::loadParams(const TiXmlElement* root)
 {
@@ -289,5 +305,5 @@
   LoadParam(root, "viewNormalDistance", this, Camera, setViewNormalDistance);
 }
-*/
+
 
 void Camera::setViewTopFovy(float fovy)
@@ -350,4 +366,56 @@
   this->viewNormalDistance = Distance;
 }
+
+
+
+
+void Camera::glLookAt(float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz)
+{
+  //Vector* eye=new Vector(eyex, eyey, eyez);
+  Vector* center=new Vector (centerx, centery, centerz);
+  Vector* up=new Vector(upx, upy, upz);
+
+  center->x-=eyex;
+  center->y-=eyey;
+  center->z-=eyez;
+
+  center->normalize();
+  up->normalize();
+  Vector* s = VectorProd(center, up);
+  Vector* u = VectorProd(s, center);
+  GLfloat Matrix[]={s->x, s->y, s->z, 0, u->x, u->y, u->z, 0, -center->x, -center->y, -center->z, 0, 0, 0, 0, 1};
+
+  glMultMatrixf(Matrix);
+  glTranslated(-eyex, -eyey, -eyez);
+  delete center;
+  delete up;
+  delete s;
+  delete u;
+
+}
+
+
+
+
+Vector* Camera::VectorProd(Vector* v1, Vector* v2)
+{
+Vector* temp= new Vector();
+temp->x=v1->y * v2->z - v1->z * v2->y;
+temp->y=v1->z * v2->x - v1->x * v2->z;
+temp->z=v1->x * v2->y - v1->y * v2->x;
+return temp;
+}
+
+
+
+
+
+
+
+
+
+
+
+
 
 
@@ -355,10 +423,105 @@
 // CAMERA-TARGET //
 ///////////////////
+//REATE_FACTORY(CameraTarget);
+
 
 ObjectListDefinition(CameraTarget);
+
+
 CameraTarget::CameraTarget()
 {
   this->registerObject(this, CameraTarget::_objectList);
   //  this->setParentMode(PNODE_MOVEMENT);
-}
-
+  this->speed=1;
+  translateTo.x=0;
+  translateTo.y=0;
+  translateTo.z=0;
+  rotateBy.x=0;
+  rotateBy.y=0;
+  rotateBy.z=0;
+  target=createStick();
+}
+
+
+void CameraTarget::detach()
+{
+  masta->setParentSoft(target);
+  masta->getTargetNode()->setParentSoft(target);
+}
+
+PNode* CameraTarget::createStick()
+{
+  return new Targets();
+}
+
+
+void CameraTarget::atach(PNode* object)
+{
+  masta->setParentSoft(object);
+  masta->getTargetNode()->setParentSoft(object);
+}
+
+
+
+
+Vector CameraTarget::iterate(float dt, const Vector* Target, const Vector* cam)
+{
+
+
+  Vector tmpVec;
+  tmpVec= (*Target - *cam);
+  tmpVec.normalize();
+  return  tmpVec;
+
+}
+
+
+void CameraTarget::translate(float dt)
+{
+  if (fabs(translateTo.len()  - (target->getAbsCoor()).len()) >= 11 )
+ {
+   printf("translate\n");
+   Vector tmpVec= iterate(dt,  &translateTo,  &(masta->getAbsCoor()));
+   target->shiftCoor(speed*tmpVec.x, speed*tmpVec.y, speed*tmpVec.z);
+  }
+}
+
+Vector * CameraTarget::rotate(Vector* newPos, float speed)
+{
+
+}
+
+void CameraTarget::jump(float x, float y, float z)
+{
+target->setAbsCoor(x,y,z);
+}
+
+
+void CameraTarget::trans(float x, float y, float z)
+{
+  Vector tmpVec=Vector(x,y,z);
+  if( this->getParent())
+    this->getParent()->setRelCoor(this->getParent()->getRelCoor());
+  translateNow(&tmpVec);
+}
+
+void CameraTarget::translateNow(Vector* vec)
+{
+translateTo=*vec;
+}
+
+void CameraTarget::changeSpeed(float speed)
+{
+  if (speed!=0)
+this->speed=speed;
+  return;
+}
+
+
+bool CameraTarget::isDone()
+{
+  if (fabs(translateTo.len()  - (target->getAbsCoor()).len()) >= 11 )
+    return 0;
+  else
+    return 1;
+}
Index: trunk/src/world_entities/camera.h
===================================================================
--- trunk/src/world_entities/camera.h	(revision 10376)
+++ trunk/src/world_entities/camera.h	(revision 10379)
@@ -11,8 +11,8 @@
 #include "plane.h"
 
+
 class World;
 class CameraTarget;
 class Event;
-
 
 //! Camera
@@ -22,4 +22,6 @@
 class Camera : public PNode, public EventListener
 {
+  friend class CameraTarget;
+  friend class CameraMan;
   ObjectListDeclaration(Camera);
 public:
@@ -34,5 +36,5 @@
     ViewTop
   };
-
+  public:
   Camera();
   Camera(const TiXmlElement* root);
@@ -42,5 +44,5 @@
   CameraTarget* getTarget() const { return this->target; };
   PNode* getTargetNode() const;
-
+  void setTargetNode(PNode* target);
   void setAspectRatio(float aspectRatio);
   inline float getAspectRatio() {return this->aspectRatio;};
@@ -70,4 +72,7 @@
   inline bool getEventHandling() {return this->eventHandling;}
 
+  void glLookAt(float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz);
+  Vector* VectorProd(Vector* v1, Vector* v2);
+  void Rotate();
   void tick(float dt);
   void apply ();
@@ -75,6 +80,7 @@
 
   void process(const Event &event);
+  //CameraTarget*     target;          //!< The Target of the Camera (where this Camera Looks at)
 
-  //virtual void loadParams(const TiXmlElement* root);
+  virtual void loadParams(const TiXmlElement* root);
 
   void              setViewTopFovy(float fovy);
@@ -132,13 +138,36 @@
 class CameraTarget : public PNode
 {
-  friend class Camera;             //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
+  friend class Camera;        //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
   ObjectListDeclaration(CameraTarget);
 
 private:
   CameraTarget();
+  virtual ~CameraTarget() {}
+  float speed;
+  PNode* target;
+  PNode* freeTarget;
+  Camera* masta;
+  Vector translateTo;
+  Vector rotateBy;
+
 
 public:
+
+  void detach();
+  void atach(PNode* object);
+  Vector iterate(float dt, const Vector* target, const Vector* cam);
+  void translate(float dt);
+  void changeSpeed(float speed);
+  Vector* rotate(Vector* newPos, float speed);
+  void jump(float x, float y, float z);
+  void translateNow(Vector* vec);
+  PNode* createStick();
+  void trans(float x, float y, float z);
+  bool isDone();
 };
 
 
+
+
 #endif /* _CAMERA_H */
+
Index: trunk/src/world_entities/cameraman.cc
===================================================================
--- trunk/src/world_entities/cameraman.cc	(revision 10379)
+++ trunk/src/world_entities/cameraman.cc	(revision 10379)
@@ -0,0 +1,146 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Filip Gospodinov
+   co-programmer:
+*/
+
+#include "shell_command.h"
+#include "cameraman.h"
+#include "game_world_data.h"
+#include "state.h"
+#include "sound_engine.h"
+#include <string>
+
+ObjectListDefinition(CameraMan);
+
+
+CameraMan::CameraMan()
+{
+  this->registerObject(this, CameraMan::_objectList);
+
+  this->nearClip = 1.0;
+  this->farClip = 1000.0;
+
+  currentCam=State::getCamera();
+  this->cameras.push_back(currentCam);
+  State::setCamera(currentCam, currentCam->getTarget());
+  this->fadeToBlack=new BlackScreen();
+}
+
+
+void CameraMan::createCam()
+{
+ // Camera* newCamera=new Camera();
+  this->cameras.push_back(new Camera());
+  cameras[cameras.size()-1]->target->detach();
+  cameras[cameras.size()-1]->setClipRegion(nearClip, farClip);
+
+}
+
+void CameraMan::setCam(int cameraNo)
+{
+  if (cameraNo<cameras.size())
+  {
+  currentCam=cameras[cameraNo];
+  State::setCamera(currentCam, currentCam->getTarget());
+  OrxSound::SoundEngine::getInstance()->setListener(currentCam);
+
+  this->fadeToBlack->setParent(this->currentCam);
+  this->fadeToBlack->setRelCoor(3., 0., 0.);
+  }
+
+}
+
+
+
+void CameraMan::moveCurrCam(int x, int y, int z)
+{
+currentCam->target->trans(x,y,z);
+}
+
+
+void CameraMan::moveCam(int x, int y, int z, int camNo)
+{
+cameras[camNo]->target->trans(x,y,z);
+}
+
+
+void CameraMan::changeTarget(int camNo, std::string className, std::string objectName)
+{
+  BaseObject* object = ObjectListBase::getBaseObject(className, objectName);
+  if( object != NULL && object->isA(PNode::staticClassID()))
+    cameras[camNo]->lookAt(dynamic_cast<PNode*>(object));
+}
+
+
+void CameraMan::changeCurrTarget(std::string className, std::string objectName)
+{
+  BaseObject* object = ObjectListBase::getBaseObject(className, objectName);
+  if( object != NULL && object->isA(PNode::staticClassID()))
+    currentCam->lookAt(dynamic_cast<PNode*>(object));
+}
+
+void CameraMan::atachCurrTarget(PNode* target)
+{
+  currentCam->target->atach(target);
+}
+
+void CameraMan::jumpCam(int x, int y, int z, int camNo)
+{
+  cameras[camNo]->target->jump(x, y, z);
+}
+
+
+
+void CameraMan::setClipRegion(float nearCli, float farCli)
+{
+  this->nearClip=nearCli;
+  this->farClip=farCli;
+
+  for(int i = 0; i < this->cameras.size(); i++)
+    cameras[i]->setClipRegion(nearCli, farCli);
+}
+
+
+void CameraMan::jumpCurrCam(int x, int y, int z)
+{
+  currentCam->target->jump(x, y, z);
+}
+
+
+
+
+void CameraMan::togglFade()
+{
+  if( this->fadeToBlack)
+    fadeToBlack->toggleFade();
+}
+
+
+
+//how to get a class fkt pointer
+
+//BaseObject* object = ObjectListBase::getBaseObject(className, objectName);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/src/world_entities/cameraman.h
===================================================================
--- trunk/src/world_entities/cameraman.h	(revision 10379)
+++ trunk/src/world_entities/cameraman.h	(revision 10379)
@@ -0,0 +1,37 @@
+#ifndef _CAMERAMAN_H
+#define _CAMERAMAN_H
+
+#include "p_node.h"
+#include "camera.h"
+#include <vector>
+#include "base_object.h"
+#include "blackscreen.h"
+
+class CameraMan : public BaseObject {
+  ObjectListDeclaration(CameraMan);
+
+  private:
+    Camera* currentCam;
+    float nearClip;
+    float farClip;
+    BlackScreen* fadeToBlack;
+
+  public:
+    std::vector<Camera*> cameras;
+    CameraMan();
+    void setCam(int CameraNo);
+    void createCam();
+    void moveCam(int x, int y, int z,  int camNo);
+    void moveCurrCam(int x, int y, int z);
+    void changeTarget(int camNo, std::string className, std::string objectName);
+    void changeCurrTarget(std::string className, std::string objectName);
+    void atachCurrTarget(PNode* target);
+    void jumpCam(int x, int y, int z, int camNo);
+    void jumpCurrCam(int x, int y, int z);
+    void changeSpeed(float speed);
+    void setClipRegion(float nearClip, float farClip);
+    void togglFade();
+
+};
+
+#endif /* _CAMERAMAN_H */
Index: trunk/src/world_entities/targets.h
===================================================================
--- trunk/src/world_entities/targets.h	(revision 10379)
+++ trunk/src/world_entities/targets.h	(revision 10379)
@@ -0,0 +1,19 @@
+#ifndef _TARGETS_H
+#define _TARGETS_H
+
+
+#include "p_node.h"
+
+class Targets : public PNode
+{
+  ObjectListDeclaration(Targets);
+
+  public:
+    Targets() { setRelCoorSoft(0,0,0);};
+
+};
+
+
+
+#endif
+
Index: trunk/src/world_entities/test_entity.h
===================================================================
--- trunk/src/world_entities/test_entity.h	(revision 10376)
+++ trunk/src/world_entities/test_entity.h	(revision 10379)
@@ -3,11 +3,16 @@
 
 #include "world_entity.h"
+#include "cameraman.h"
 
 class TiXmlElement;
-
+class Material;
 
 class TestEntity : public WorldEntity
 {
     ObjectListDeclaration(TestEntity);
+
+  private:
+
+  CameraMan* CM;
 
   public:
@@ -18,6 +23,10 @@
     void init();
     virtual void loadParams(const TiXmlElement* root);
-
-
+    void test();
+    void t2();
+    void t3();
+    void t4();
+    void t5();
+    void changeState (bool);
     virtual void tick (float time);
     virtual void draw() const;
