Revision: 2487
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2487&view=rev
Author:   ulteq
Date:     2012-04-29 15:24:49 +0000 (Sun, 29 Apr 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/CameraBehaviorCharacterOrbit.cpp
    trunk/source/main/gfx/camera/CameraBehaviorCharacterOrbit.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/CameraBehaviorVehicleOrbit.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.h
    trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h
    trunk/source/main/gfx/camera/CameraBehaviorWheelChase.cpp
    trunk/source/main/gfx/camera/CameraBehaviorWheelChase.h
    trunk/source/main/gfx/camera/CameraManager.cpp
    trunk/source/main/gfx/camera/CameraManager.h

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

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-04-28 20:00:49 UTC 
(rev 2486)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-04-29 15:24:49 UTC 
(rev 2487)
@@ -5243,20 +5243,7 @@
                        else
                                
OverlayManager::getSingleton().getOverlayElement("tracks/tacho")->setMaterialName("tracks/Tacho");
                }
-
-               //lastangle=0;
-#if 0
-               camRotX=0;
-               camRotY=Degree(12);
-               camDist=20;
-               if (cameramode==CAMERA_VEHICLE_INTERNAL)
-               {
-                       currentTruck->prepareInside(true);
-                       if(ow) ow->showDashboardOverlays(false, currentTruck);
-                       camRotY=DEFAULT_INTERNAL_CAM_PITCH;
-                       //if(bigMap) bigMap->setVisibility(false);
-               }
-#endif // 0
+               
                TRIGGER_EVENT(SE_TRUCK_ENTER, 
currentTruck?currentTruck->trucknum:-1);
        }
 }

Modified: trunk/source/main/gfx/camera/CameraBehavior.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehavior.h       2012-04-28 20:00:49 UTC 
(rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehavior.h       2012-04-29 15:24:49 UTC 
(rev 2487)
@@ -17,8 +17,8 @@
 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 CAMERABEHAVIOR_H__
-#define CAMERABEHAVIOR_H__
+#ifndef __CAMERA_BEHAVIOR_H_
+#define __CAMERA_BEHAVIOR_H_
 
 #include "RoRPrerequisites.h"
 #include <OIS.h>
@@ -34,9 +34,11 @@
 class CameraBehavior
 {
 protected:
+
        float mMoveScale, mRotScale, mMoveSpeed, mRotateSpeed;
 
 public:
+
        virtual ~CameraBehavior() {};
 
        virtual void update(cameraContext_t &ctx) = 0;
@@ -51,4 +53,4 @@
        virtual bool allowInteraction() = 0;
 };
 
-#endif // CAMERABEHAVIOR_H__
+#endif // __CAMERA_BEHAVIOR_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacterOrbit.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorCharacterOrbit.cpp       
2012-04-28 20:00:49 UTC (rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorCharacterOrbit.cpp       
2012-04-29 15:24:49 UTC (rev 2487)
@@ -26,7 +26,7 @@
        Character *person = RoRFrameListener::eflsingleton->person;
 
        targetDirection = -person->getAngle() - Math::HALF_PI;
-       camCenterPoint  =  person->getPosition() + Vector3(0.0f, 1.1f, 0.0f);
+       camCenterPosition  =  person->getPosition() + Vector3(0.0f, 1.1f, 0.0f);
 
        CameraBehaviorOrbit::update(ctx);
 }

Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacterOrbit.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorCharacterOrbit.h 2012-04-28 
20:00:49 UTC (rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorCharacterOrbit.h 2012-04-29 
15:24:49 UTC (rev 2487)
@@ -17,8 +17,8 @@
 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 CAMERABEHAVIORPERSONORBIT_H__
-#define CAMERABEHAVIORPERSONORBIT_H__
+#ifndef __CAMERA_BEHAVIOR_CHARACTER_ORBIT_H_
+#define __CAMERA_BEHAVIOR_CHARACTER_ORBIT_H_
 
 #include "RoRPrerequisites.h"
 #include "CameraBehaviorOrbit.h"
@@ -26,9 +26,8 @@
 class CameraBehaviorCharacterOrbit : public CameraBehaviorOrbit
 {
 public:
+
        void update(cameraContext_t &ctx);
 };
 
-#endif // CAMERABEHAVIORPERSONORBIT_H__
-
-
+#endif // __CAMERA_BEHAVIOR_CHARACTER_ORBIT_H_

Added: trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp                        
        (rev 0)
+++ trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp        2012-04-29 
15:24:49 UTC (rev 2487)
@@ -0,0 +1,32 @@
+/*
+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 "CameraBehaviorFixed.h"
+
+void CameraBehaviorFixed::activate(cameraContext_t &ctx)
+{
+}
+
+void CameraBehaviorFixed::deactivate(cameraContext_t &ctx)
+{
+}
+
+void CameraBehaviorFixed::update(cameraContext_t &ctx)
+{
+}

Added: trunk/source/main/gfx/camera/CameraBehaviorFixed.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFixed.h                          
(rev 0)
+++ trunk/source/main/gfx/camera/CameraBehaviorFixed.h  2012-04-29 15:24:49 UTC 
(rev 2487)
@@ -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_FIXEd_H_
+#define __CAMERA_BEHAVIOR_FIXEd_H_
+
+#include "RoRPrerequisites.h"
+#include "CameraBehavior.h"
+
+class CameraBehaviorFixed : public CameraBehavior
+{
+public:
+
+       void activate(cameraContext_t &ctx);
+       void deactivate(cameraContext_t &ctx);
+
+       void update(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; };
+};
+
+#endif // __CAMERA_BEHAVIOR_FIXEd_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorFree.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-04-28 20:00:49 UTC 
(rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-04-29 15:24:49 UTC 
(rev 2487)
@@ -22,6 +22,7 @@
 #include "CameraManager.h"
 #include "Console.h"
 #include "InputEngine.h"
+#include "Settings.h"
 #include "language.h"
 #include <Ogre.h>
 
@@ -29,9 +30,11 @@
 
 void CameraBehaviorFree::activate(cameraContext_t &ctx)
 {
-       // enter free camera mode
        DOFManager *dof = CameraManager::getSingleton().getDOFManager();
-       if(dof) dof->setFocusMode(DOFManager::Auto);
+       if ( dof )
+       {
+               dof->setFocusMode(DOFManager::Auto);
+       }
 
        ctx.cam->setFixedYawAxis(true, Vector3::UNIT_Y);
 
@@ -46,9 +49,11 @@
 
 void CameraBehaviorFree::deactivate(cameraContext_t &ctx)
 {
-       // change back to normal camera
        DOFManager *dof = CameraManager::getSingleton().getDOFManager();
-       if(dof) dof->setFocusMode(DOFManager::Manual);
+       if ( dof )
+       {
+               dof->setFocusMode(DOFManager::Manual);
+       }
 
        LOG("exiting free camera mode");
 
@@ -61,9 +66,9 @@
 
 void CameraBehaviorFree::update(cameraContext_t &ctx)
 {
+       Vector3 mTranslateVector = Vector3::ZERO;
        Degree mRotX(0.0f);
        Degree mRotY(0.0f);
-       Vector3 mTranslateVector = Vector3::ZERO;
 
        if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_SIDESTEP_LEFT))
                mTranslateVector.x -= ctx.translationScale;     // Move camera 
left
@@ -114,13 +119,3 @@
 
        return true;
 }
-
-bool CameraBehaviorFree::mousePressed(const OIS::MouseEvent& _arg, 
OIS::MouseButtonID _id)
-{
-       return false;
-}
-
-bool CameraBehaviorFree::mouseReleased(const OIS::MouseEvent& _arg, 
OIS::MouseButtonID _id)
-{
-       return false;
-}

Modified: trunk/source/main/gfx/camera/CameraBehaviorFree.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFree.h   2012-04-28 20:00:49 UTC 
(rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorFree.h   2012-04-29 15:24:49 UTC 
(rev 2487)
@@ -17,8 +17,8 @@
 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 CAMERABEHAVIORFREE_H__
-#define CAMERABEHAVIORFREE_H__
+#ifndef __CAMERA_BEHAVIOR_FREE_H_
+#define __CAMERA_BEHAVIOR_FREE_H_
 
 #include "RoRPrerequisites.h"
 #include "CameraBehavior.h"
@@ -26,18 +26,17 @@
 class CameraBehaviorFree : public CameraBehavior
 {
 public:
+
        void activate(cameraContext_t &ctx);
        void deactivate(cameraContext_t &ctx);
 
        void update(cameraContext_t &ctx);
 
        bool mouseMoved(const OIS::MouseEvent& _arg);
-       bool mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id);
-       bool mouseReleased(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id);
+       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; };
 };
 
-#endif // CAMERABEHAVIORFREE_H__
-
-
+#endif // __CAMERA_BEHAVIOR_FREE_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp        2012-04-28 
20:00:49 UTC (rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp        2012-04-29 
15:24:49 UTC (rev 2487)
@@ -30,12 +30,12 @@
 
 CameraBehaviorOrbit::CameraBehaviorOrbit() :
          camRotX(0.0f)
-       , camRotY(0.35f)
+       , camRotY(0.4f)
        , camDist(5.0f)
        , minCamDist(3.0f)
        , camRatio(11.0f)
        , camIdealPosition(Vector3::ZERO)
-       , camCenterPoint(Vector3::ZERO)
+       , camCenterPosition(Vector3::ZERO)
        , camTranslation(Vector3::ZERO)
        , targetDirection(0.0f)
        , targetPitch(0.0f)
@@ -47,16 +47,16 @@
        float fov = FSETTING("FOV External", 60);
 
        DOFManager *dof = CameraManager::getSingleton().getDOFManager();
-       if(dof)
+       if ( dof )
        {
                dof->setFocusMode(DOFManager::Manual);
                dof->setLensFOV(Degree(fov));
        }
 
-       camCenterPoint = Vector3(0, 3, 0);
-
        Camera *cam = CameraManager::getSingleton().getCamera();
        cam->setFOVy(Degree(fov));
+
+       camCenterPosition = Vector3(0.0f, 3.0f, 0.0f);
 }
 
 void CameraBehaviorOrbit::deactivate(cameraContext_t &ctx)
@@ -82,7 +82,7 @@
 
        if (INPUTENGINE.getEventBoolValue(EV_CAMERA_ROTATE_RIGHT))
        {
-               // Move camera RIGHT
+               // Move camera right
                camRotX += ctx.rotationScale;
        }
        if ((INPUTENGINE.getEventBoolValue(EV_CAMERA_ROTATE_UP)) && 
camRotY<Degree(88))
@@ -135,7 +135,7 @@
 
        float real_camdist = camIdealPosition.length();
 
-       camIdealPosition = camIdealPosition + camCenterPoint + camTranslation;
+       camIdealPosition = camIdealPosition + camCenterPosition + 
camTranslation;
        Vector3 newPosition = ( camIdealPosition + camRatio * 
cam->getPosition() ) / (camRatio+1.0f);
 
        /*
@@ -149,7 +149,7 @@
        */
 
        cam->setPosition(newPosition);
-       cam->lookAt(camCenterPoint);
+       cam->lookAt(camCenterPosition);
 
        DOFManager *dof = CameraManager::getSingleton().getDOFManager();
        if(dof)
@@ -173,13 +173,3 @@
        }
        return false;
 }
-
-bool CameraBehaviorOrbit::mousePressed(const OIS::MouseEvent& _arg, 
OIS::MouseButtonID _id)
-{
-       return false;
-}
-
-bool CameraBehaviorOrbit::mouseReleased(const OIS::MouseEvent& _arg, 
OIS::MouseButtonID _id)
-{
-       return false;
-}

Modified: trunk/source/main/gfx/camera/CameraBehaviorOrbit.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorOrbit.h  2012-04-28 20:00:49 UTC 
(rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorOrbit.h  2012-04-29 15:24:49 UTC 
(rev 2487)
@@ -17,8 +17,8 @@
 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 CAMERABEHAVIORORBIT_H__
-#define CAMERABEHAVIORORBIT_H__
+#ifndef __CAMERA_BEHAVIOR_ORBIT_H_
+#define __CAMERA_BEHAVIOR_ORBIT_H_
 
 #include "RoRPrerequisites.h"
 #include "CameraBehavior.h"
@@ -26,9 +26,10 @@
 class CameraBehaviorOrbit : public CameraBehavior
 {
 protected:
+
        Ogre::Radian camRotX, camRotY;
+       Ogre::Vector3 camIdealPosition, camCenterPosition, camTranslation;
        float camDist, minCamDist, camRatio;
-       Ogre::Vector3 camIdealPosition, camCenterPoint, camTranslation;
        float targetDirection, targetPitch;
 
 public:
@@ -41,12 +42,10 @@
        void update(cameraContext_t &ctx);
 
        bool mouseMoved(const OIS::MouseEvent& _arg);
-       bool mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id);
-       bool mouseReleased(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id);
+       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; };
 };
 
-#endif // CAMERABEHAVIORORBIT_H__
-
-
+#endif // __CAMERA_BEHAVIOR_ORBIT_H_

Added: trunk/source/main/gfx/camera/CameraBehaviorVehicleInternal.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleInternal.cpp              
                (rev 0)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleInternal.cpp      
2012-04-29 15:24:49 UTC (rev 2487)
@@ -0,0 +1,48 @@
+/*
+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 "CameraBehaviorVehicleInternal.h"
+
+#include "CameraManager.h"
+#include "Settings.h"
+
+using namespace Ogre;
+
+void CameraBehaviorVehicleInternal::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 CameraBehaviorVehicleInternal::deactivate(cameraContext_t &ctx)
+{
+}
+
+void CameraBehaviorVehicleInternal::update(cameraContext_t &ctx)
+{
+}

Added: trunk/source/main/gfx/camera/CameraBehaviorVehicleInternal.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleInternal.h                
                (rev 0)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleInternal.h        
2012-04-29 15:24:49 UTC (rev 2487)
@@ -0,0 +1,36 @@
+/*
+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_INTERNAL_H_
+#define __CAMERA_BEHAVIOR_VEHICLE_INTERNAL_H_
+
+#include "RoRPrerequisites.h"
+#include "CameraBehaviorVehicleOrbit.h"
+
+class CameraBehaviorVehicleInternal : public CameraBehaviorVehicleOrbit
+{
+public:
+
+       void activate(cameraContext_t &ctx);
+       void deactivate(cameraContext_t &ctx);
+
+       void update(cameraContext_t &ctx);
+};
+
+#endif // __CAMERA_BEHAVIOR_VEHICLE_INTERNAL_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.cpp 2012-04-28 
20:00:49 UTC (rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.cpp 2012-04-29 
15:24:49 UTC (rev 2487)
@@ -49,7 +49,7 @@
 
        camRatio = 1.0f / (curr_truck->tdt * 4.0f);
 
-       camCenterPoint = curr_truck->getPosition();
+       camCenterPosition = curr_truck->getPosition();
 
        CameraBehaviorOrbit::update(ctx);
 }

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.h   2012-04-28 
20:00:49 UTC (rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleOrbit.h   2012-04-29 
15:24:49 UTC (rev 2487)
@@ -17,8 +17,8 @@
 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 CAMERABEHAVIORVEHICLEORBIT_H__
-#define CAMERABEHAVIORVEHICLEORBIT_H__
+#ifndef __CAMERA_BEHAVIOR_VEHICLE_ORBIT_H_
+#define __CAMERA_BEHAVIOR_VEHICLE_ORBIT_H_
 
 #include "RoRPrerequisites.h"
 #include "CameraBehaviorOrbit.h"
@@ -26,12 +26,13 @@
 class CameraBehaviorVehicleOrbit : public CameraBehaviorOrbit
 {
 protected:
+
        bool externalCameraMode;
+
 public:
+
        CameraBehaviorVehicleOrbit();
        void update(cameraContext_t &ctx);
 };
 
-#endif // CAMERABEHAVIORVEHICLEORBIT_H__
-
-
+#endif // __CAMERA_BEHAVIOR_VEHICLE_ORBIT_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp        
2012-04-28 20:00:49 UTC (rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp        
2012-04-29 15:24:49 UTC (rev 2487)
@@ -31,15 +31,17 @@
 using namespace Ogre;
 
 CameraBehaviorVehicleSpline::CameraBehaviorVehicleSpline() :
-         splinePos(0.5f)
-       , myManualObject(0)
+         myManualObject(0)
        , myManualObjectNode(0)
        , spline(new SimpleSpline())
+       , splinePos(0.5f)
 {
 }
 
 void CameraBehaviorVehicleSpline::activate(cameraContext_t &ctx)
 {
+       CameraBehaviorOrbit::activate(ctx);
+
        if(!myManualObject)
        {
                myManualObject =  ctx.scm->createManualObject();
@@ -52,7 +54,6 @@
 
                myManualObjectNode->attachObject(myManualObject);
        }
-
 }
 
 void CameraBehaviorVehicleSpline::updateSplineDisplay()
@@ -89,11 +90,11 @@
 
                updateSplineDisplay();
 
-               camCenterPoint = spline->interpolate(splinePos);
+               camCenterPosition = spline->interpolate(splinePos);
        } else
        {
                // fallback :-/
-               camCenterPoint = curr_truck->getPosition();
+               camCenterPosition = curr_truck->getPosition();
        }
 
        CameraBehaviorOrbit::update(ctx);
@@ -120,4 +121,3 @@
        }
        return false;
 }
-

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h  2012-04-28 
20:00:49 UTC (rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h  2012-04-29 
15:24:49 UTC (rev 2487)
@@ -17,8 +17,8 @@
 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 CAMERABEHAVIORVEHICLESPLINE_H__
-#define CAMERABEHAVIORVEHICLESPLINE_H__
+#ifndef __CAMERA_BEHAVIOR_VEHICLE_SPLINE_H_
+#define __CAMERA_BEHAVIOR_VEHICLE_SPLINE_H_
 
 #include "RoRPrerequisites.h"
 #include "CameraBehaviorOrbit.h"
@@ -26,13 +26,15 @@
 class CameraBehaviorVehicleSpline : public CameraBehaviorOrbit
 {
 protected:
-       float splinePos;
+
        Ogre::ManualObject *myManualObject;
        Ogre::SceneNode* myManualObjectNode;
        Ogre::SimpleSpline *spline;
+       float splinePos;
        static const int splineDrawResolution = 20;
 
 public:
+
        CameraBehaviorVehicleSpline();
 
        void activate(cameraContext_t &ctx);
@@ -43,6 +45,4 @@
        bool mouseMoved(const OIS::MouseEvent& _arg);
 };
 
-#endif // CAMERABEHAVIORVEHICLESPLINE_H__
-
-
+#endif // __CAMERA_BEHAVIOR_VEHICLE_SPLINE_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorWheelChase.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorWheelChase.cpp   2012-04-28 
20:00:49 UTC (rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorWheelChase.cpp   2012-04-29 
15:24:49 UTC (rev 2487)
@@ -19,18 +19,29 @@
 */
 #include "CameraBehaviorWheelChase.h"
 
-#include <Ogre.h>
+#include "BeamFactory.h"
 #include "CameraManager.h"
 #include "Console.h"
 #include "InputEngine.h"
+#include "Settings.h"
 #include "language.h"
+#include <Ogre.h>
 
-#include "BeamFactory.h"
-
 using namespace Ogre;
 
 void CameraBehaviorWheelChase::activate(cameraContext_t &ctx)
 {
+       float fov = FSETTING("FOV External", 60);
+
+       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 CameraBehaviorWheelChase::deactivate(cameraContext_t &ctx)

Modified: trunk/source/main/gfx/camera/CameraBehaviorWheelChase.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorWheelChase.h     2012-04-28 
20:00:49 UTC (rev 2486)
+++ trunk/source/main/gfx/camera/CameraBehaviorWheelChase.h     2012-04-29 
15:24:49 UTC (rev 2487)
@@ -17,8 +17,8 @@
 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 CAMERABEHAVIORWHEELCHASE_H__
-#define CAMERABEHAVIORWHEELCHASE_H__
+#ifndef __CAMERA_BEHAVIOR_WHEELCHASE_H_
+#define __CAMERA_BEHAVIOR_WHEELCHASE_H_
 
 #include "RoRPrerequisites.h"
 #include "CameraBehavior.h"
@@ -26,6 +26,7 @@
 class CameraBehaviorWheelChase : public CameraBehavior
 {
 public:
+
        void activate(cameraContext_t &ctx);
        void deactivate(cameraContext_t &ctx);
 
@@ -38,6 +39,4 @@
        bool allowInteraction() { return false; };
 };
 
-#endif // CAMERABEHAVIORWHEELCHASE_H__
-
-
+#endif // __CAMERA_BEHAVIOR_WHEELCHASE_H_

Modified: trunk/source/main/gfx/camera/CameraManager.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.cpp      2012-04-28 20:00:49 UTC 
(rev 2486)
+++ trunk/source/main/gfx/camera/CameraManager.cpp      2012-04-29 15:24:49 UTC 
(rev 2487)
@@ -24,20 +24,21 @@
 #include "Console.h"
 #include "InputEngine.h"
 #include "Ogre.h"
+#include "RoRFrameListener.h"
 #include "Settings.h"
 #include "SoundScriptManager.h"
 #include "language.h"
 
-#include "OverlayWrapper.h"
+#include "CameraBehaviorCharacterOrbit.h"
+#include "CameraBehaviorFixed.h"
 #include "CameraBehaviorFree.h"
 #include "CameraBehaviorOrbit.h"
-#include "CameraBehaviorCharacterOrbit.h"
+#include "CameraBehaviorVehicleInternal.h"
 #include "CameraBehaviorVehicleOrbit.h"
-#include "CameraBehaviorWheelChase.h"
 #include "CameraBehaviorVehicleSpline.h"
+#include "CameraBehaviorWheelChase.h"
+#include "OverlayWrapper.h"
 
-#include "RoRFrameListener.h"
-
 using namespace Ogre;
 
 CameraManager::CameraManager(Ogre::SceneManager *scm, Ogre::Camera *cam) : 
@@ -77,18 +78,15 @@
 void CameraManager::createGlobalBehaviors()
 {
        globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_CHARACTER_ORBIT, new CameraBehaviorCharacterOrbit()) );
+       globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_INTERNAL, new CameraBehaviorVehicleInternal()) 
);
        globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_ORBIT, new CameraBehaviorVehicleOrbit()) );
        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()) );
 
-       // TODO: Create a CameraBehavior for internal camera perspectives (e.g. 
cockpit, rear seats, ...)
-       globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_INTERNAL, new CameraBehaviorCharacterOrbit()) );
-
-       // TODO: Think about this. Do we really need this CameraBehavior? Or 
can it be part of the CAMERA_VEHICLE_INTERNAL behavior?
+       // TODO: Think about this. Do we really need this CameraBehavior, or 
could it be part of the CAMERA_VEHICLE_INTERNAL behavior?
        globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_WHEELCHASE, new CameraBehaviorWheelChase()) );
        
-       // TODO: Create a CameraBehavior for a fixed camera perspective
-       globalBehaviors.insert( std::pair<int, CameraBehavior*>(CAMERA_FIX, new 
CameraBehaviorFree()) );
 }
 
 #if 0

Modified: trunk/source/main/gfx/camera/CameraManager.h
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.h        2012-04-28 20:00:49 UTC 
(rev 2486)
+++ trunk/source/main/gfx/camera/CameraManager.h        2012-04-29 15:24:49 UTC 
(rev 2487)
@@ -17,8 +17,8 @@
 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 CAMERAMANAGER_H__
-#define CAMERAMANAGER_H__
+#ifndef __CAMERA_MANAGER_H_
+#define __CAMERA_MANAGER_H_
 
 #include "RoRPrerequisites.h"
 
@@ -75,7 +75,7 @@
          , CAMERA_VEHICLE_SPLINE
          , CAMERA_END
          , CAMERA_FREE
-         , CAMERA_FIX
+         , CAMERA_FIXED
        };
        
        void triggerFOVUpdate() { /*TODO: Think about this*/ };
@@ -88,4 +88,4 @@
        inline DOFManager *getDOFManager() { return mDOF; }
 };
 
-#endif // CAMERAMANAGER_H__
+#endif // __CAMERA_MANAGER_H_

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