Revision: 2547
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2547&view=rev
Author:   ulteq
Date:     2012-05-12 23:02:29 +0000 (Sat, 12 May 2012)
Log Message:
-----------
-Codechange: CameraSystem WIP

Modified Paths:
--------------
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/gfx/camera/CameraBehavior.h
    trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp
    trunk/source/main/gfx/camera/CameraBehaviorCharacter.h
    trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp
    trunk/source/main/gfx/camera/CameraBehaviorFixed.h
    trunk/source/main/gfx/camera/CameraBehaviorFree.cpp
    trunk/source/main/gfx/camera/CameraBehaviorFree.h
    trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp
    trunk/source/main/gfx/camera/CameraBehaviorOrbit.h
    trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h
    trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h
    trunk/source/main/gfx/camera/CameraManager.cpp
    trunk/source/main/gfx/camera/CameraManager.h

Added Paths:
-----------
    trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicle.h

Removed Paths:
-------------
    trunk/source/main/gfx/camera/CameraBehavior.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.h

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-12 22:14:09 UTC 
(rev 2546)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-12 23:02:29 UTC 
(rev 2547)
@@ -3041,7 +3041,7 @@
                                if (mapMode==0)
                                {
                                        bigMap->setVisibility(true);
-                                       if (CAMERA_MODE != 
CameraManager::CAMERA_VEHICLE_INTERNAL)
+                                       if (CAMERA_MODE != 
CameraManager::CAMERA_VEHICLE_CINECAM)
                                        {
                                                //make it small again
                                                
bigMap->updateRenderMetrics(mWindow);
@@ -5667,7 +5667,7 @@
        }
        else
        {
-               if (curr_truck && CAMERA_MODE != 
CameraManager::CAMERA_VEHICLE_INTERNAL)
+               if (curr_truck && CAMERA_MODE != 
CameraManager::CAMERA_VEHICLE_CINECAM)
                {
                        if (ow) ow->showDashboardOverlays(true, curr_truck);
                        //if (bigMap) bigMap->setVisibility(true);

Deleted: trunk/source/main/gfx/camera/CameraBehavior.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehavior.cpp     2012-05-12 22:14:09 UTC 
(rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehavior.cpp     2012-05-12 23:02:29 UTC 
(rev 2547)
@@ -1,30 +0,0 @@
-/*
-This source file is part of Rigs of Rods
-Copyright 2005-2012 Pierre-Michel Ricordel
-Copyright 2007-2012 Thomas Fischer
-
-For more information, see http://www.rigsofrods.com/
-
-Rigs of Rods is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 3, as
-published by the Free Software Foundation.
-
-Rigs of Rods is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "CameraBehavior.h"
-
-#include <Ogre.h>
-#include "CameraManager.h"
-#include "Console.h"
-#include "InputEngine.h"
-#include "language.h"
-#include "Settings.h"
-
-using namespace Ogre;
-

Modified: trunk/source/main/gfx/camera/CameraBehavior.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehavior.h       2012-05-12 22:14:09 UTC 
(rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehavior.h       2012-05-12 23:02:29 UTC 
(rev 2547)
@@ -21,32 +21,27 @@
 #define __CAMERA_BEHAVIOR_H_
 
 #include "RoRPrerequisites.h"
+
+#include "CameraManager.h"
 #include <OIS.h>
 
-typedef struct cameraContext_t {
-       float dt;
-       Ogre::Degree rotationScale;
-       float translationScale;
-       Ogre::Camera *cam;
-       Ogre::SceneManager *scm;
-} cameraContext_t;
-
 class CameraBehavior
 {
 public:
 
        virtual ~CameraBehavior() {};
 
-       virtual void update(cameraContext_t &ctx) = 0;
+       virtual void update(CameraManager::cameraContext_t &ctx) = 0;
 
        virtual bool mouseMoved(const OIS::MouseEvent& _arg) = 0;
        virtual bool mousePressed(const OIS::MouseEvent& _arg, 
OIS::MouseButtonID _id) = 0;
        virtual bool mouseReleased(const OIS::MouseEvent& _arg, 
OIS::MouseButtonID _id) = 0;
 
-       virtual void activate(cameraContext_t &ctx) = 0;
-       virtual void deactivate(cameraContext_t &ctx) = 0;
+       virtual void activate(CameraManager::cameraContext_t &ctx) = 0;
+       virtual void deactivate(CameraManager::cameraContext_t &ctx) = 0;
 
        virtual bool allowInteraction() = 0;
+       virtual bool switchBehavior() = 0;
 
 protected:
 

Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp    2012-05-12 
22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp    2012-05-12 
23:02:29 UTC (rev 2547)
@@ -23,7 +23,7 @@
 
 using namespace Ogre;
 
-void CameraBehaviorCharacter::update(cameraContext_t &ctx)
+void CameraBehaviorCharacter::update(CameraManager::cameraContext_t &ctx)
 {
        Character *person = RoRFrameListener::eflsingleton->person;
 

Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacter.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorCharacter.h      2012-05-12 
22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorCharacter.h      2012-05-12 
23:02:29 UTC (rev 2547)
@@ -27,7 +27,10 @@
 {
 public:
 
-       void update(cameraContext_t &ctx);
+       void update(CameraManager::cameraContext_t &ctx);
+
+       bool allowInteraction() { return false; }
+       bool switchBehavior() { return true; }
 };
 
 #endif // __CAMERA_BEHAVIOR_CHARACTER_ORBIT_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp        2012-05-12 
22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp        2012-05-12 
23:02:29 UTC (rev 2547)
@@ -21,14 +21,14 @@
 
 using namespace Ogre;
 
-void CameraBehaviorFixed::activate(cameraContext_t &ctx)
+void CameraBehaviorFixed::activate(CameraManager::cameraContext_t &ctx)
 {
 }
 
-void CameraBehaviorFixed::deactivate(cameraContext_t &ctx)
+void CameraBehaviorFixed::deactivate(CameraManager::cameraContext_t &ctx)
 {
 }
 
-void CameraBehaviorFixed::update(cameraContext_t &ctx)
+void CameraBehaviorFixed::update(CameraManager::cameraContext_t &ctx)
 {
 }

Modified: trunk/source/main/gfx/camera/CameraBehaviorFixed.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFixed.h  2012-05-12 22:14:09 UTC 
(rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorFixed.h  2012-05-12 23:02:29 UTC 
(rev 2547)
@@ -27,16 +27,17 @@
 {
 public:
 
-       void activate(cameraContext_t &ctx);
-       void deactivate(cameraContext_t &ctx);
+       void activate(CameraManager::cameraContext_t &ctx);
+       void deactivate(CameraManager::cameraContext_t &ctx);
 
-       void update(cameraContext_t &ctx);
+       void update(CameraManager::cameraContext_t &ctx);
 
        bool mouseMoved(const OIS::MouseEvent& _arg) { return false; };
        bool mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) 
{ return false; };
        bool mouseReleased(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) 
{ return false; };
 
        bool allowInteraction() { return false; };
+       bool switchBehavior() { return true; }
 };
 
 #endif // __CAMERA_BEHAVIOR_FIXEd_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorFree.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-05-12 22:14:09 UTC 
(rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-05-12 23:02:29 UTC 
(rev 2547)
@@ -21,6 +21,7 @@
 
 #include "CameraManager.h"
 #include "Console.h"
+#include "DepthOfFieldEffect.h"
 #include "InputEngine.h"
 #include "Settings.h"
 #include "language.h"
@@ -28,7 +29,7 @@
 
 using namespace Ogre;
 
-void CameraBehaviorFree::activate(cameraContext_t &ctx)
+void CameraBehaviorFree::activate(CameraManager::cameraContext_t &ctx)
 {
        DOFManager *dof = CameraManager::getSingleton().getDOFManager();
        if ( dof )
@@ -47,7 +48,7 @@
 #endif // USE_MYGUI
 }
 
-void CameraBehaviorFree::deactivate(cameraContext_t &ctx)
+void CameraBehaviorFree::deactivate(CameraManager::cameraContext_t &ctx)
 {
        DOFManager *dof = CameraManager::getSingleton().getDOFManager();
        if ( dof )
@@ -64,7 +65,7 @@
 #endif // USE_MYGUI
 }
 
-void CameraBehaviorFree::update(cameraContext_t &ctx)
+void CameraBehaviorFree::update(CameraManager::cameraContext_t &ctx)
 {
        Vector3 mTranslateVector = Vector3::ZERO;
        Degree mRotX(0.0f);

Modified: trunk/source/main/gfx/camera/CameraBehaviorFree.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFree.h   2012-05-12 22:14:09 UTC 
(rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorFree.h   2012-05-12 23:02:29 UTC 
(rev 2547)
@@ -27,16 +27,17 @@
 {
 public:
 
-       void activate(cameraContext_t &ctx);
-       void deactivate(cameraContext_t &ctx);
+       void activate(CameraManager::cameraContext_t &ctx);
+       void deactivate(CameraManager::cameraContext_t &ctx);
 
-       void update(cameraContext_t &ctx);
+       void update(CameraManager::cameraContext_t &ctx);
 
        bool mouseMoved(const OIS::MouseEvent& _arg);
        bool mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) 
{ return false; };
        bool mouseReleased(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) 
{ return false; };
 
-       bool allowInteraction() { return false; };
+       bool allowInteraction() { return false; }
+       bool switchBehavior() { return true; }
 };
 
 #endif // __CAMERA_BEHAVIOR_FREE_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp        2012-05-12 
22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp        2012-05-12 
23:02:29 UTC (rev 2547)
@@ -21,6 +21,7 @@
 
 #include "CameraManager.h"
 #include "Console.h"
+#include "DepthOfFieldEffect.h"
 #include "InputEngine.h"
 #include "Settings.h"
 #include "language.h"
@@ -42,7 +43,7 @@
 {
 }
 
-void CameraBehaviorOrbit::activate(cameraContext_t &ctx)
+void CameraBehaviorOrbit::activate(CameraManager::cameraContext_t &ctx)
 {
        float fov = FSETTING("FOV External", 60);
 
@@ -59,11 +60,11 @@
        camCenterPosition = Vector3(0.0f, 3.0f, 0.0f);
 }
 
-void CameraBehaviorOrbit::deactivate(cameraContext_t &ctx)
+void CameraBehaviorOrbit::deactivate(CameraManager::cameraContext_t &ctx)
 {
 }
 
-void CameraBehaviorOrbit::update(cameraContext_t &ctx)
+void CameraBehaviorOrbit::update(CameraManager::cameraContext_t &ctx)
 {
        Camera *cam = CameraManager::getSingleton().getCamera();
 
@@ -120,7 +121,7 @@
        if (INPUTENGINE.getEventBoolValue(EV_CAMERA_RESET))
        {
                camRotX = 0;
-               camRotY = DEFAULT_INTERNAL_CAM_PITCH;
+               camRotY = CameraManager::DEFAULT_INTERNAL_CAM_PITCH;
                camDist = 20;
        }
 
@@ -138,16 +139,6 @@
        camIdealPosition = camIdealPosition + camCenterPosition + 
camTranslation;
        Vector3 newPosition = ( camIdealPosition + camRatio * 
cam->getPosition() ) / (camRatio+1.0f);
 
-       /*
-       Real h=hfinder->getHeightAt(newposition.x,newposition.z);
-
-       if (w && !w->allowUnderWater() && w->getHeightWaves(newposition) > h)
-               h=w->getHeightWaves(newposition);
-
-       h+=1.0;
-       if (newposition.y<h) newposition.y=h;
-       */
-
        cam->setPosition(newPosition);
        cam->lookAt(camCenterPosition);
 

Modified: trunk/source/main/gfx/camera/CameraBehaviorOrbit.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorOrbit.h  2012-05-12 22:14:09 UTC 
(rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorOrbit.h  2012-05-12 23:02:29 UTC 
(rev 2547)
@@ -29,16 +29,14 @@
 
        CameraBehaviorOrbit();
 
-       void activate(cameraContext_t &ctx);
-       void deactivate(cameraContext_t &ctx);
+       void update(CameraManager::cameraContext_t &ctx);
 
-       void update(cameraContext_t &ctx);
-
        bool mouseMoved(const OIS::MouseEvent& _arg);
        bool mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) 
{ return false; };
        bool mouseReleased(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) 
{ return false; };
 
-       bool allowInteraction() { return false; };
+       void activate(CameraManager::cameraContext_t &ctx);
+       void deactivate(CameraManager::cameraContext_t &ctx);
 
 protected:
 

Added: trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp                      
        (rev 0)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp      2012-05-12 
23:02:29 UTC (rev 2547)
@@ -0,0 +1,57 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2012 Pierre-Michel Ricordel
+Copyright 2007-2012 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "CameraBehaviorVehicle.h"
+
+#include "BeamFactory.h"
+#include "Settings.h"
+
+using namespace Ogre;
+
+CameraBehaviorVehicle::CameraBehaviorVehicle() :
+         externalCameraMode(false)
+{
+       minCamDist = 8.0f;
+
+       if (SSETTING("External Camera Mode", "Pitching") == "Static")
+               externalCameraMode = true;
+}
+
+void CameraBehaviorVehicle::update(CameraManager::cameraContext_t &ctx)
+{
+       Beam *curr_truck = BeamFactory::getSingleton().getCurrentTruck();
+       if(!curr_truck) return;
+
+       Vector3 dir = curr_truck->nodes[curr_truck->cameranodepos[0]].smoothpos 
- curr_truck->nodes[curr_truck->cameranodedir[0]].smoothpos;
+       dir.normalise();
+
+       targetDirection = -atan2(dir.dotProduct(Vector3::UNIT_X), 
dir.dotProduct(-Vector3::UNIT_Z));
+       targetPitch     = 0.0f;
+
+       if(!externalCameraMode)
+       {
+               targetPitch = -asin(dir.dotProduct(Vector3::UNIT_Y));
+       }
+
+       camRatio = 1.0f / (curr_truck->tdt * 5.0f);
+
+       camCenterPosition = curr_truck->getPosition();
+
+       CameraBehaviorOrbit::update(ctx);
+}

Added: trunk/source/main/gfx/camera/CameraBehaviorVehicle.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicle.h                        
        (rev 0)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicle.h        2012-05-12 
23:02:29 UTC (rev 2547)
@@ -0,0 +1,42 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2012 Pierre-Michel Ricordel
+Copyright 2007-2012 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef __CAMERA_BEHAVIOR_VEHICLE_ORBIT_H_
+#define __CAMERA_BEHAVIOR_VEHICLE_ORBIT_H_
+
+#include "RoRPrerequisites.h"
+#include "CameraBehaviorOrbit.h"
+
+class CameraBehaviorVehicle : public CameraBehaviorOrbit
+{
+public:
+
+       CameraBehaviorVehicle();
+
+       void update(CameraManager::cameraContext_t &ctx);
+
+       bool allowInteraction() { return false; }
+       bool switchBehavior() { return true; }
+
+protected:
+
+       bool externalCameraMode;
+};
+
+#endif // __CAMERA_BEHAVIOR_VEHICLE_ORBIT_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp       
2012-05-12 22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp       
2012-05-12 23:02:29 UTC (rev 2547)
@@ -1,49 +1,90 @@
-/*
-This source file is part of Rigs of Rods
-Copyright 2005-2012 Pierre-Michel Ricordel
-Copyright 2007-2012 Thomas Fischer
-
-For more information, see http://www.rigsofrods.com/
-
-Rigs of Rods is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 3, as
-published by the Free Software Foundation.
-
-Rigs of Rods is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "CameraBehaviorVehicleCineCam.h"
-
-#include "BeamFactory.h"
-#include "CameraManager.h"
-#include "Settings.h"
-
-using namespace Ogre;
-
-void CameraBehaviorVehicleCineCam::activate(cameraContext_t &ctx)
-{
-       float fov = FSETTING("FOV Internal", 75);
-
-       DOFManager *dof = CameraManager::getSingleton().getDOFManager();
-       if ( dof )
-       {
-               dof->setFocusMode(DOFManager::Manual);
-               dof->setLensFOV(Degree(fov));
-       }
-
-       Camera *cam = CameraManager::getSingleton().getCamera();
-       cam->setFOVy(Degree(fov));
-}
-
-void CameraBehaviorVehicleCineCam::deactivate(cameraContext_t &ctx)
-{
-}
-
-void CameraBehaviorVehicleCineCam::update(cameraContext_t &ctx)
-{
-}
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2012 Pierre-Michel Ricordel
+Copyright 2007-2012 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "CameraBehaviorVehicleCineCam.h"
+
+#include "BeamFactory.h"
+#include "CameraManager.h"
+#include "DepthOfFieldEffect.h"
+#include "Settings.h"
+
+using namespace Ogre;
+
+void CameraBehaviorVehicleCineCam::activate(CameraManager::cameraContext_t 
&ctx)
+{
+       float fov = FSETTING("FOV Internal", 75);
+
+       DOFManager *dof = CameraManager::getSingleton().getDOFManager();
+       if ( dof )
+       {
+               dof->setFocusMode(DOFManager::Manual);
+               dof->setLensFOV(Degree(fov));
+       }
+
+       Camera *cam = CameraManager::getSingleton().getCamera();
+       cam->setFOVy(Degree(fov));
+}
+
+void CameraBehaviorVehicleCineCam::deactivate(CameraManager::cameraContext_t 
&ctx)
+{
+}
+
+bool CameraBehaviorVehicleCineCam::switchBehavior()
+{
+
+       return true;
+}
+
+
+void CameraBehaviorVehicleCineCam::update(CameraManager::cameraContext_t &ctx)
+{
+#if 0
+                       int currentcamera=curr_truck->currentcamera;
+
+                       float fov = FSETTING("FOV Internal", 75);
+
+                       if (changeCamMode)
+                               mCamera->setFOVy(Degree(fov));
+
+                       if (curr_truck->cinecameranodepos>=0) 
lastPosition=curr_truck->nodes[curr_truck->cinecameranodepos[currentcamera]].smoothpos;
+                       else 
lastPosition=curr_truck->nodes[curr_truck->cameranodepos[currentcamera]].smoothpos;
+                       mCamera->setPosition(lastPosition);
+                       if (curr_truck->cablightNode)
+                               
curr_truck->cablightNode->setPosition(lastPosition);
+                       //old direction code
+                       /*
+                       Vector3 
dir=curr_truck->nodes[curr_truck->cameranodepos[currentcamera]].smoothpos-curr_truck->nodes[curr_truck->cameranoderoll[currentcamera]].smoothpos;
+                       dir.normalise();
+                       
mCamera->lookAt(lastPosition+curr_truck->nodes[curr_truck->cameranodepos[currentcamera]].smoothpos-curr_truck->nodes[curr_truck->cameranodedir[currentcamera]].smoothpos);
+                       
mCamera->roll(Radian(asin(dir.dotProduct(Vector3::UNIT_Y))));
+                       mCamera->yaw(-camRotX);
+                       mCamera->pitch(camRotY);
+                       */
+                       Vector3 
dir=curr_truck->nodes[curr_truck->cameranodepos[currentcamera]].smoothpos-curr_truck->nodes[curr_truck->cameranodedir[currentcamera]].smoothpos;
+                       dir.normalise();
+                       Vector3 
side=curr_truck->nodes[curr_truck->cameranodepos[currentcamera]].smoothpos-curr_truck->nodes[curr_truck->cameranoderoll[currentcamera]].smoothpos;
+                       side.normalise();
+                       if (curr_truck->revroll[currentcamera]) side=-side; 
//to fix broken vehicles
+                       Vector3 up=dir.crossProduct(side);
+                       //we recompute the side vector to be sure we make an 
orthonormal system
+                       side=up.crossProduct(dir);
+                       Quaternion cdir=Quaternion(camRotX, 
up)*Quaternion(Degree(180.0)+camRotY, side)*Quaternion(side, up, dir);
+                       mCamera->setOrientation(cdir);
+#endif
+}

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h 2012-05-12 
22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h 2012-05-12 
23:02:29 UTC (rev 2547)
@@ -21,16 +21,21 @@
 #define __CAMERA_BEHAVIOR_VEHICLE_INTERNAL_H_
 
 #include "RoRPrerequisites.h"
-#include "CameraBehaviorVehicleOrbit.h"
+#include "CameraBehaviorVehicle.h"
 
-class CameraBehaviorVehicleCineCam : public CameraBehaviorVehicleOrbit
+class CameraBehaviorVehicleCineCam : public CameraBehaviorVehicle
 {
 public:
 
-       void activate(cameraContext_t &ctx);
-       void deactivate(cameraContext_t &ctx);
+       void update(CameraManager::cameraContext_t &ctx);
 
-       void update(cameraContext_t &ctx);
+       void activate(CameraManager::cameraContext_t &ctx);
+       void deactivate(CameraManager::cameraContext_t &ctx);
+
+       bool switchBehavior();
+
+protected:
+       int cameraPos;
 };
 
 #endif // __CAMERA_BEHAVIOR_VEHICLE_INTERNAL_H_

Deleted: trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.cpp 2012-05-12 
22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.cpp 2012-05-12 
23:02:29 UTC (rev 2547)
@@ -1,57 +0,0 @@
-/*
-This source file is part of Rigs of Rods
-Copyright 2005-2012 Pierre-Michel Ricordel
-Copyright 2007-2012 Thomas Fischer
-
-For more information, see http://www.rigsofrods.com/
-
-Rigs of Rods is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 3, as
-published by the Free Software Foundation.
-
-Rigs of Rods is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "CameraBehaviorVehicleOrbit.h"
-
-#include "BeamFactory.h"
-#include "Settings.h"
-
-using namespace Ogre;
-
-CameraBehaviorVehicleOrbit::CameraBehaviorVehicleOrbit() :
-         externalCameraMode(false)
-{
-       minCamDist = 8.0f;
-
-       if (SSETTING("External Camera Mode", "Pitching") == "Static")
-               externalCameraMode = true;
-}
-
-void CameraBehaviorVehicleOrbit::update(cameraContext_t &ctx)
-{
-       Beam *curr_truck = BeamFactory::getSingleton().getCurrentTruck();
-       if(!curr_truck) return;
-
-       Vector3 dir = curr_truck->nodes[curr_truck->cameranodepos[0]].smoothpos 
- curr_truck->nodes[curr_truck->cameranodedir[0]].smoothpos;
-       dir.normalise();
-
-       targetDirection = -atan2(dir.dotProduct(Vector3::UNIT_X), 
dir.dotProduct(-Vector3::UNIT_Z));
-       targetPitch     = 0.0f;
-
-       if(!externalCameraMode)
-       {
-               targetPitch = -asin(dir.dotProduct(Vector3::UNIT_Y));
-       }
-
-       camRatio = 1.0f / (curr_truck->tdt * 4.0f);
-
-       camCenterPosition = curr_truck->getPosition();
-
-       CameraBehaviorOrbit::update(ctx);
-}

Deleted: trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.h   2012-05-12 
22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.h   2012-05-12 
23:02:29 UTC (rev 2547)
@@ -1,38 +0,0 @@
-/*
-This source file is part of Rigs of Rods
-Copyright 2005-2012 Pierre-Michel Ricordel
-Copyright 2007-2012 Thomas Fischer
-
-For more information, see http://www.rigsofrods.com/
-
-Rigs of Rods is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 3, as
-published by the Free Software Foundation.
-
-Rigs of Rods is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef __CAMERA_BEHAVIOR_VEHICLE_ORBIT_H_
-#define __CAMERA_BEHAVIOR_VEHICLE_ORBIT_H_
-
-#include "RoRPrerequisites.h"
-#include "CameraBehaviorOrbit.h"
-
-class CameraBehaviorVehicleOrbit : public CameraBehaviorOrbit
-{
-public:
-
-       CameraBehaviorVehicleOrbit();
-       void update(cameraContext_t &ctx);
-
-protected:
-
-       bool externalCameraMode;
-};
-
-#endif // __CAMERA_BEHAVIOR_VEHICLE_ORBIT_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp        
2012-05-12 22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp        
2012-05-12 23:02:29 UTC (rev 2547)
@@ -19,15 +19,13 @@
 */
 #include "CameraBehaviorVehicleSpline.h"
 
-#include <Ogre.h>
+#include "BeamFactory.h"
 #include "CameraManager.h"
 #include "Console.h"
 #include "InputEngine.h"
 #include "language.h"
 #include "Settings.h"
 
-#include "BeamFactory.h"
-
 using namespace Ogre;
 
 CameraBehaviorVehicleSpline::CameraBehaviorVehicleSpline() :
@@ -38,7 +36,7 @@
 {
 }
 
-void CameraBehaviorVehicleSpline::activate(cameraContext_t &ctx)
+void CameraBehaviorVehicleSpline::activate(CameraManager::cameraContext_t &ctx)
 {
        CameraBehaviorOrbit::activate(ctx);
 
@@ -69,7 +67,7 @@
        myManualObject->end();
 }
 
-void CameraBehaviorVehicleSpline::update(cameraContext_t &ctx)
+void CameraBehaviorVehicleSpline::update(CameraManager::cameraContext_t &ctx)
 {
        Beam *curr_truck = BeamFactory::getSingleton().getCurrentTruck();
        if(!curr_truck) return;

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h  2012-05-12 
22:14:09 UTC (rev 2546)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h  2012-05-12 
23:02:29 UTC (rev 2547)
@@ -21,16 +21,16 @@
 #define __CAMERA_BEHAVIOR_VEHICLE_SPLINE_H_
 
 #include "RoRPrerequisites.h"
-#include "CameraBehaviorOrbit.h"
+#include "CameraBehaviorVehicle.h"
 
-class CameraBehaviorVehicleSpline : public CameraBehaviorOrbit
+class CameraBehaviorVehicleSpline : public CameraBehaviorVehicle
 {
 public:
 
        CameraBehaviorVehicleSpline();
 
-       void activate(cameraContext_t &ctx);
-       void update(cameraContext_t &ctx);
+       void activate(CameraManager::cameraContext_t &ctx);
+       void update(CameraManager::cameraContext_t &ctx);
 
        void updateSplineDisplay();
 

Modified: trunk/source/main/gfx/camera/CameraManager.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-12 22:14:09 UTC 
(rev 2546)
+++ trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-12 23:02:29 UTC 
(rev 2547)
@@ -22,6 +22,7 @@
 
 #include "BeamFactory.h"
 #include "Console.h"
+#include "DepthOfFieldEffect.h"
 #include "envmap.h"
 #include "heightfinder.h"
 #include "InputEngine.h"
@@ -38,9 +39,8 @@
 #include "CameraBehaviorFree.h"
 #include "CameraBehaviorOrbit.h"
 #include "CameraBehaviorVehicleCineCam.h"
-#include "CameraBehaviorVehicleOrbit.h"
+#include "CameraBehaviorVehicle.h"
 #include "CameraBehaviorVehicleSpline.h"
-#include "OverlayWrapper.h"
 
 using namespace Ogre;
 
@@ -71,7 +71,7 @@
        ctx.scm = mSceneMgr;
        
        switchBehavior(CAMERA_CHARACTER);
-       switchBehavior(CAMERA_VEHICLE_ORBIT);
+       switchBehavior(CAMERA_VEHICLE);
        //switchBehavior(CAMERA_VEHICLE_SPLINE);
 }
 
@@ -83,8 +83,8 @@
 void CameraManager::createGlobalBehaviors()
 {
        globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_CHARACTER, new CameraBehaviorCharacter()) );
-       globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_INTERNAL, new CameraBehaviorVehicleCineCam()) );
-       globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_ORBIT, new CameraBehaviorVehicleOrbit()) );
+       globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_CINECAM, new CameraBehaviorVehicleCineCam()) );
+       globalBehaviors.insert( std::pair<int, CameraBehavior*>(CAMERA_VEHICLE, 
new CameraBehaviorVehicle()) );
        globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_SPLINE, new CameraBehaviorVehicleSpline()) );
        globalBehaviors.insert( std::pair<int, CameraBehavior*>(CAMERA_FREE, 
new CameraBehaviorFree()) );
        globalBehaviors.insert( std::pair<int, CameraBehavior*>(CAMERA_FIXED, 
new CameraBehaviorFixed()) );
@@ -98,13 +98,13 @@
 
 void CameraManager::switchBehavior(int newBehavior)
 {
-       if ( globalBehaviors.find(newBehavior) == globalBehaviors.end() )
+       if (globalBehaviors.find(newBehavior) == globalBehaviors.end())
        {
                return;
        }
 
        // deactivate old
-       if ( currentBehavior )
+       if (currentBehavior)
        {
                currentBehavior->deactivate(ctx);
        }
@@ -124,7 +124,7 @@
        mMoveScale = mMoveSpeed   * dt;
        mRotScale  = mRotateSpeed * dt;
 
-       if(INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_CHANGE))
+       if (INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_CHANGE))
        {
                switchToNextBehavior();
        }
@@ -136,20 +136,20 @@
        ctx.translationScale = mMoveScale;
        ctx.rotationScale    = Degree(mRotScale);
 
-       if(!currentBehavior->allowInteraction())
+       if (!currentBehavior->allowInteraction())
        {
-               if(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || 
INPUTENGINE.isKeyDown(OIS::KC_RSHIFT))
+               if (INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || 
INPUTENGINE.isKeyDown(OIS::KC_RSHIFT))
                {
                        ctx.rotationScale *= 3;
                        ctx.translationScale *= 3;
                }
 
-               if(INPUTENGINE.isKeyDown(OIS::KC_LCONTROL))
+               if (INPUTENGINE.isKeyDown(OIS::KC_LCONTROL))
                {
                        ctx.rotationScale *= 30;
                        ctx.translationScale *= 30;
                }
-               if(INPUTENGINE.isKeyDown(OIS::KC_LMENU))
+               if (INPUTENGINE.isKeyDown(OIS::KC_LMENU))
                {
                        ctx.rotationScale *= 0.05;
                        ctx.translationScale *= 0.05;
@@ -157,7 +157,7 @@
        }
 
        // update current behavior
-       if(currentBehavior)
+       if (currentBehavior)
        {
                currentBehavior->update(ctx);
        }
@@ -187,10 +187,10 @@
                                mCamera->setPosition(collisions->forcecampos);
                                
mCamera->lookAt(person->getPosition()+Vector3(0.0,1.0,0.0));
                                float fov = FSETTING("FOV External", 60);
-                               if(changeCamMode)
+                               if (changeCamMode)
                                        mCamera->setFOVy(Degree(fov+20));
                                collisions->forcecam=false;
-                               if(mDOF) mDOF->setFocusMode(DOFManager::Auto);
+                               if (mDOF) mDOF->setFocusMode(DOFManager::Auto);
                        }
                }
                else if (cameramode==CAMERA_FIX)
@@ -200,7 +200,7 @@
                        pz=((int)(person->getPosition().z)/100)*100;
                        Real h=hfinder->getHeightAt(px+50.0,pz+50.0);
                        Real random = Math::RangeRandom(0.0f, 1.0f);
-                       if(w && random > 0.3f && !w->allowUnderWater())
+                       if (w && random > 0.3f && !w->allowUnderWater())
                        {
                                // chance of 30% to get an underwater view?
                                if (w && 
w->getHeightWaves(Vector3(px+50.0,0,pz+50.0)) > h)
@@ -215,7 +215,7 @@
                        Radian fov = Radian(atan2(20.0f,real_camDist));
                        mCamera->setFOVy(fov);
 
-                       if(mDOF)
+                       if (mDOF)
                        {
                                mDOF->setFocusMode(DOFManager::Manual);
                                mDOF->setFocus(real_camDist);
@@ -226,7 +226,7 @@
                else if (cameramode==CAMERA_VEHICLE_INTERNAL)
                {
                        float fov = FSETTING("FOV Internal", 75);
-                       if(changeCamMode)
+                       if (changeCamMode)
                                mCamera->setFOVy(Degree(fov));
                        
mCamera->setPosition(person->getPosition()+Vector3(0,1.7,0));
                        Vector3 dir=Vector3(cos(person->getAngle()), 0.0, 
sin(person->getAngle()));
@@ -239,7 +239,7 @@
                                camRotX=pushcamRotX;
                                camRotY=pushcamRotY;
                        }
-                       if(mDOF)
+                       if (mDOF)
                        {
                                mDOF->setFocusMode(DOFManager::Auto);
                                mDOF->setLensFOV(Degree(fov));
@@ -256,11 +256,11 @@
                        {
                                mCamera->setPosition(collisions->forcecampos);
                                mCamera->lookAt(curr_truck->getPosition());
-                               if(changeCamMode)
+                               if (changeCamMode)
                                        mCamera->setFOVy(Degree(80));
                                collisions->forcecam=false;
 
-                               if(mDOF)
+                               if (mDOF)
                                {
                                        mDOF->setFocusMode(DOFManager::Auto);
                                        mDOF->setLensFOV(Degree(80));
@@ -279,7 +279,7 @@
                                        
newposition=newposition+dir*450.0+Vector3(5.0, 0.0, 5.0);
                                        Real 
h=hfinder->getHeightAt(newposition.x,newposition.z);
                                        Real random = Math::RangeRandom(0.0f, 
1.0f);
-                                       if(w && random > 0.3f && 
!w->allowUnderWater())
+                                       if (w && random > 0.3f && 
!w->allowUnderWater())
                                        {
                                                // chance of 30% to get an 
underwater view?
                                                if (w && 
w->getHeightWaves(newposition)>h)
@@ -296,7 +296,7 @@
                                float real_camDist = 
(mCamera->getPosition()-curr_truck->getPosition()).length();
                                Radian fov = Radian(atan2(100.0f,real_camDist));
                                mCamera->setFOVy(fov);
-                               if(mDOF)
+                               if (mDOF)
                                {
                                        mDOF->setFocusMode(DOFManager::Manual);
                                        mDOF->setFocus(real_camDist);
@@ -317,7 +317,7 @@
                                float real_camDist = 
(mCamera->getPosition()-curr_truck->getPosition()).length();
                                Radian fov = Radian(atan2(20.0f,real_camDist));
                                mCamera->setFOVy(fov);
-                               if(mDOF)
+                               if (mDOF)
                                {
                                        mDOF->setFocusMode(DOFManager::Manual);
                                        mDOF->setFocus(real_camDist);
@@ -331,13 +331,13 @@
 
                        float fov = FSETTING("FOV Internal", 75);
 
-                       if(changeCamMode)
+                       if (changeCamMode)
                                mCamera->setFOVy(Degree(fov));
 
                        if (curr_truck->cinecameranodepos>=0) 
lastPosition=curr_truck->nodes[curr_truck->cinecameranodepos[currentcamera]].smoothpos;
                        else 
lastPosition=curr_truck->nodes[curr_truck->cameranodepos[currentcamera]].smoothpos;
                        mCamera->setPosition(lastPosition);
-                       if(curr_truck->cablightNode)
+                       if (curr_truck->cablightNode)
                                
curr_truck->cablightNode->setPosition(lastPosition);
                        //old direction code
                        /*
@@ -400,10 +400,10 @@
                                camRotX=pushcamRotX;
                                camRotY=pushcamRotY;
                                curr_truck->prepareInside(false);
-                               if(ow) ow->showDashboardOverlays(true, 
curr_truck);
+                               if (ow) ow->showDashboardOverlays(true, 
curr_truck);
                        }
 
-                               if(mDOF)
+                               if (mDOF)
                                {
                                        mDOF->setFocusMode(DOFManager::Manual);
                                        mDOF->setFocus(2);
@@ -418,7 +418,7 @@
        // TODO: XXX: fix below
        for (int i=0; i<free_truck; i++)
        {
-               if(!trucks[i]) continue;
+               if (!trucks[i]) continue;
                
trucks[i]->setDetailLevel((mCamera->getPosition()-trucks[i]->getPosition()).length()>trucks[i]->fadeDist);
        }
        */
@@ -491,9 +491,9 @@
                                camRotX=pushcamRotX;
                                camRotY=pushcamRotY;
                                curr_truck->prepareInside(false);
-                               if(ow) ow->showDashboardOverlays(true, 
curr_truck);
+                               if (ow) ow->showDashboardOverlays(true, 
curr_truck);
                                curr_truck->currentcamera=-1;
-                               //if(bigMap) bigMap->setVisibility(true);
+                               //if (bigMap) bigMap->setVisibility(true);
                                curr_truck->changedCamera();
                        }
                        cameramode++;
@@ -505,11 +505,11 @@
                                camRotX=0;
                                camRotY=DEFAULT_INTERNAL_CAM_PITCH;
                                curr_truck->prepareInside(true);
-                               //if(bigMap) bigMap->setVisibility(false);
+                               //if (bigMap) bigMap->setVisibility(false);
                                // airplane dashboard in the plane visible
-                               if(ow)
+                               if (ow)
                                {
-                                       if(curr_truck->driveable == AIRPLANE)
+                                       if (curr_truck->driveable == AIRPLANE)
                                                ow->showDashboardOverlays(true, 
curr_truck);
                                        else
                                                
ow->showDashboardOverlays(false, curr_truck);
@@ -525,14 +525,14 @@
        if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_FOV_LESS))
        {
                int fov = mCamera->getFOVy().valueDegrees();
-               if(fov>10)
+               if (fov>10)
                        fov -= 2;
                mCamera->setFOVy(Degree(fov));
 #ifdef USE_MYGUI
                
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("FOV: ") + TOSTRING(fov), "camera_edit.png", 
2000);
 #endif // USE_MYGUI
                // save the settings
-               if (cameramode == CAMERA_VEHICLE_INTERNAL)
+               if (cameramode == CAMERA_VEHICLE_CINECAM)
                        SETTINGS.setSetting("FOV Internal", TOSTRING(fov));
                else if (cameramode == CAMERA_EXT)
                        SETTINGS.setSetting("FOV External", TOSTRING(fov));
@@ -541,14 +541,14 @@
        if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_FOV_MORE))
        {
                int fov = mCamera->getFOVy().valueDegrees();
-               if(fov<160)
+               if (fov<160)
                        fov += 2;
                mCamera->setFOVy(Degree(fov));
 #ifdef USE_MYGUI
                
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("FOV: ") + TOSTRING(fov), "camera_edit.png", 
2000);
 #endif // USE_MYGUI
                // save the settings
-               if (cameramode == CAMERA_VEHICLE_INTERNAL)
+               if (cameramode == CAMERA_VEHICLE_CINECAM)
                        SETTINGS.setSetting("FOV Internal", TOSTRING(fov));
                else if (cameramode == CAMERA_EXT)
                        SETTINGS.setSetting("FOV External", TOSTRING(fov));
@@ -560,19 +560,19 @@
        }
        if (INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_FREE_MODE_FIX))
        {
-               if(cameramode == CAMERA_FREE)
+               if (cameramode == CAMERA_FREE)
                {
                        // change to fixed free camera: that is working like 
fixed cam
                        cameramode = CAMERA_FREE_FIXED;
-                       if(mDOF) mDOF->setFocusMode(DOFManager::Auto);
+                       if (mDOF) mDOF->setFocusMode(DOFManager::Auto);
                        LOG("switching to fixed free camera mode");
 #ifdef USE_MYGUI
                        
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("fixed free camera"), "camera_link.png", 
3000);
 #endif // USE_MYGUI
-               } else if(cameramode == CAMERA_FREE_FIXED)
+               } else if (cameramode == CAMERA_FREE_FIXED)
                {
                        cameramode = CAMERA_FREE;
-                       if(mDOF) mDOF->setFocusMode(DOFManager::Auto);
+                       if (mDOF) mDOF->setFocusMode(DOFManager::Auto);
                        LOG("switching to free camera mode from fixed mode");
 #ifdef USE_MYGUI
                        
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("free camera"), "camera_go.png", 3000);

Modified: trunk/source/main/gfx/camera/CameraManager.h
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.h        2012-05-12 22:14:09 UTC 
(rev 2546)
+++ trunk/source/main/gfx/camera/CameraManager.h        2012-05-12 23:02:29 UTC 
(rev 2547)
@@ -22,17 +22,14 @@
 
 #include "RoRPrerequisites.h"
 
-#include "DepthOfFieldEffect.h"
 #include "OIS.h"
-#include "Ogre.h"
 #include "Singleton.h"
 
-#include "CameraBehavior.h"
-
 #define MAIN_CAMERA CameraManager::getSingleton().getCamera()
 #define CAMERA_MODE CameraManager::getSingleton().getCameraMode()
-#define DEFAULT_INTERNAL_CAM_PITCH Ogre::Degree(-15)
 
+class CameraBehavior;
+
 class CameraManager : public RoRSingletonNoCreation < CameraManager >
 {
        friend class SceneMouse;
@@ -42,11 +39,19 @@
        CameraManager(Ogre::SceneManager *scm, Ogre::Camera *cam, 
RoRFrameListener *efl,  HeightFinder *hf);
        ~CameraManager();
 
+       typedef struct cameraContext_t {
+               float dt;
+               Ogre::Degree rotationScale;
+               float translationScale;
+               Ogre::Camera *cam;
+               Ogre::SceneManager *scm;
+       } cameraContext_t;
+
        enum CameraBehaviors
        {
                CAMERA_CHARACTER=0
-         , CAMERA_VEHICLE_INTERNAL
-         , CAMERA_VEHICLE_ORBIT
+         , CAMERA_VEHICLE_CINECAM
+         , CAMERA_VEHICLE
          , CAMERA_VEHICLE_SPLINE
          , CAMERA_END
          , CAMERA_FREE
@@ -60,12 +65,13 @@
        bool allowInteraction();
 
        Ogre::Camera *getCamera() { return mCamera; };
-       int getCameraMode() { return mCamera->getPolygonMode(); };
+       int getCameraMode() { return currentBehaviorID; };
        inline DOFManager *getDOFManager() { return mDOF; }
 
+       static const int DEFAULT_INTERNAL_CAM_PITCH = -15;
+
 protected:
 
-       cameraContext_t ctx;
        DOFManager *mDOF;
        HeightFinder *mHfinder;
        Ogre::Camera *mCamera;
@@ -73,6 +79,7 @@
        Ogre::SceneManager *mSceneMgr;
        Ogre::Vector3 mLastPosition;
        RoRFrameListener *mEfl;
+       cameraContext_t ctx;
        float mMoveScale, mRotScale;
        float mMoveSpeed, mRotateSpeed;
        

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to