Index: trunk/src/world_entities/camera.cc
===================================================================
--- trunk/src/world_entities/camera.cc	(revision 9869)
+++ trunk/src/world_entities/camera.cc	(revision 10368)
@@ -18,4 +18,6 @@
 #include "key_mapper.h"
 #include "glincl.h"
+//#include "util/loading/load_param.h"
+#include "world_entity.h"
 
 ObjectListDefinition(Camera);
@@ -27,4 +29,24 @@
 {
   this->registerObject(this, Camera::_objectList);
+  this->init();
+}
+
+/*
+Camera::Camera(const TiXmlElement* root)
+{
+  this->registerObject(this, Camera::_objectList);
+  this->init();
+  this->loadParams(root);
+}
+*/
+
+/**
+ *  default destructor
+*/
+Camera::~Camera()
+{}
+
+void Camera::init()
+{
   this->setName("camera");
   this->target = new CameraTarget();
@@ -37,18 +59,27 @@
   this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW5);
 
-  this->setFovy(90);
-  this->setAspectRatio(1.2f);
+  //this->setFovy(90);
+  this->setAspectRatio(1.33f);
   this->setClipRegion(.1, 10000);
+  
+  this->viewTopFovy = 60;
+  this->viewNormalFovy = 90;
+  this->viewFrontFovy = 120;
+  this->viewRightFovy = 90;
+  this->viewLeftFovy = 90;
+
+  this->viewTopDistance = 70;
+  this->viewNormalDistance = 10;
+  this->viewFrontDistance = 4;
+  this->viewRightDistance = 10;
+  this->viewLeftDistance = 10;
+
+  //this->loadParams(doc.RootElement());
 
   this->setViewMode(Camera::ViewNormal);
 
   this->setParentMode(PNODE_ALL);
-}
-
-/**
- *  default destructor
-*/
-Camera::~Camera()
-{}
+  this->eventHandling = true;
+}
 
 /**
@@ -100,29 +131,46 @@
     default:
     case Camera::ViewNormal:
-      this->toFovy = 60.0;
-      this->setRelCoorSoft(-10, 5, 0);
+    {
+      this->fovy = viewNormalFovy;
+      this->toFovy = viewNormalFovy;
+      //this->fovy = 60;
+      //this->toFovy = 60;
+      this->setRelCoorSoft(-2.0/3.0 * this->viewNormalDistance, 1.0/3.0 * this->viewNormalDistance, 0);
       this->target->setRelCoorSoft(0,0,0);
       break;
+    }
     case Camera::ViewBehind:
       break;
     case Camera::ViewFront:
-      this->toFovy = 120.0;
-      this->setRelCoorSoft(4, 0, 0, 5);
+    {
+      this->fovy = viewFrontFovy;
+      this->toFovy = viewFrontFovy;
+      this->setRelCoorSoft(this->viewFrontDistance, 0, 0, 5);
       this->target->setRelCoorSoft(Vector(10,0,0), 5);
       break;
+    }
     case Camera::ViewLeft:
-      this->toFovy = 90;
-      this->setRelCoorSoft(0, 1, -10, .5);
+    {
+      this->fovy = viewLeftFovy;
+      this->toFovy = viewLeftFovy;
+      this->setRelCoorSoft(0, 1, -viewLeftDistance, .5);
       this->target->setRelCoorSoft(0,0,0);
       break;
+    }
     case Camera::ViewRight:
-      this->toFovy = 90;
-      this->setRelCoorSoft(Vector(0, 1, 10));
+    {
+      this->fovy = viewRightFovy;
+      this->toFovy = viewRightFovy;
+      this->setRelCoorSoft(Vector(0, 1, viewRightDistance), 0.5);
       this->target->setRelCoorSoft(0,0,0);
       break;
+    }
     case Camera::ViewTop:
-      this->toFovy= 120;
-      this->setRelCoorSoft(Vector(30, 50, 0));
-      this->target->setRelCoorSoft(35,0,0);
+    {
+      this->fovy= viewTopFovy;
+      this->toFovy = viewTopFovy;
+      this->setRelCoor(Vector(-0.05, this->viewTopDistance , 0));
+      this->target->setRelCoor(0,0,0);
+    }
   }
 }
@@ -143,5 +191,5 @@
 
   float tmpFovy = (this->toFovy - this->fovy);
-  if (tmpFovy > 0.01)
+  if (fabsf(tmpFovy) > 0.01)
     this->fovy += tmpFovy * fabsf(dt);
 }
@@ -192,28 +240,113 @@
 void Camera::process(const Event &event)
 {
-  if( event.type == KeyMapper::PEV_VIEW0)
+  if (eventHandling == true)
   {
-    this->setViewMode(Camera::ViewNormal);
+    if( event.type == KeyMapper::PEV_VIEW0)
+    {
+      this->setViewMode(Camera::ViewNormal);
+    }
+    else if( event.type == KeyMapper::PEV_VIEW1)
+    {
+      this->setViewMode(Camera::ViewBehind);
+    }
+    else if( event.type == KeyMapper::PEV_VIEW2)
+    {
+      this->setViewMode(Camera::ViewFront);
+    }
+    else if( event.type == KeyMapper::PEV_VIEW3)
+    {
+      this->setViewMode(Camera::ViewLeft);
+    }
+    else if( event.type == KeyMapper::PEV_VIEW4)
+    {
+      this->setViewMode(Camera::ViewRight);
+    }
+    else if( event.type == KeyMapper::PEV_VIEW5)
+    {
+      this->setViewMode(Camera::ViewTop);
+    }
   }
-  else if( event.type == KeyMapper::PEV_VIEW1)
-  {
-    this->setViewMode(Camera::ViewBehind);
-  }
-  else if( event.type == KeyMapper::PEV_VIEW2)
-  {
-    this->setViewMode(Camera::ViewFront);
-  }
-  else if( event.type == KeyMapper::PEV_VIEW3)
-  {
-    this->setViewMode(Camera::ViewLeft);
-  }
-  else if( event.type == KeyMapper::PEV_VIEW4)
-  {
-    this->setViewMode(Camera::ViewRight);
-  }
-  else if( event.type == KeyMapper::PEV_VIEW5)
-  {
-    this->setViewMode(Camera::ViewTop);
-  }
+}
+
+/*
+void Camera::loadParams(const TiXmlElement* root)
+{
+  // Do the PNode loading stuff
+  PNode::loadParams(root);
+
+  LoadParam(root, "viewTopFovy", this, Camera, setViewTopFovy);
+  LoadParam(root, "viewFrontFovy", this, Camera, setViewFrontFovy);
+  LoadParam(root, "viewLeftFovy", this, Camera, setViewLeftFovy);
+  LoadParam(root, "viewRightFovy", this, Camera, setViewRightFovy);
+  LoadParam(root, "viewBehindFovy", this, Camera, setViewBehindFovy);
+  LoadParam(root, "viewNormalFovy", this, Camera, setViewNormalFovy);
+
+  LoadParam(root, "viewTopDistance", this, Camera, setViewTopDistance);
+  LoadParam(root, "viewFrontDistance", this, Camera, setViewFrontDistance);
+  LoadParam(root, "viewLeftDistance", this, Camera, setViewLeftDistance);
+  LoadParam(root, "viewRightDistance", this, Camera, setViewRightDistance);
+  LoadParam(root, "viewBehindDistance", this, Camera, setViewBehindDistance);
+  LoadParam(root, "viewNormalDistance", this, Camera, setViewNormalDistance);
+}
+*/
+
+void Camera::setViewTopFovy(float fovy)
+{
+  this->viewTopFovy = fovy;
+}
+
+void Camera::setViewFrontFovy(float fovy)
+{
+  this->viewFrontFovy = fovy;
+}
+
+void Camera::setViewLeftFovy(float fovy)
+{
+  this->viewLeftFovy = fovy;
+}
+
+void Camera::setViewRightFovy(float fovy)
+{
+  this->viewRightFovy = fovy;
+}
+
+void Camera::setViewBehindFovy(float fovy)
+{
+  this->viewBehindFovy = fovy;
+}
+
+void Camera::setViewNormalFovy(float fovy)
+{
+  this->viewNormalFovy = fovy;
+}
+
+void Camera::setViewTopDistance(float Distance)
+{
+  this->viewTopDistance = Distance;
+}
+
+void Camera::setViewFrontDistance(float Distance)
+{
+  this->viewFrontDistance = Distance;
+}
+
+void Camera::setViewLeftDistance(float Distance)
+{
+  this->viewLeftDistance = Distance;
+}
+
+void Camera::setViewRightDistance(float Distance)
+{
+  this->viewRightDistance = Distance;
+}
+
+void Camera::setViewBehindDistance(float Distance)
+{
+  this->viewBehindDistance = Distance;
+}
+
+void Camera::setViewNormalDistance(float Distance)
+{
+  this->viewNormalDistance = Distance;
 }
 
