Revision: 2549
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2549&view=rev
Author:   ulteq
Date:     2012-05-13 06:19:27 +0000 (Sun, 13 May 2012)
Log Message:
-----------
-Codechange: CameraSystem WIP (not functional)

Modified Paths:
--------------
    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/CameraBehaviorVehicle.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicle.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/ICameraBehavior.h

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

Deleted: trunk/source/main/gfx/camera/CameraBehavior.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehavior.h       2012-05-13 03:22:29 UTC 
(rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehavior.h       2012-05-13 06:19:27 UTC 
(rev 2549)
@@ -1,48 +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_H_
-#define __CAMERA_BEHAVIOR_H_
-
-#include "RoRPrerequisites.h"
-
-#include "CameraManager.h"
-#include <OIS.h>
-
-class CameraBehavior
-{
-public:
-
-       virtual ~CameraBehavior() {};
-
-       virtual void update(CameraManager::cameraContext &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(CameraManager::cameraContext &ctx) = 0;
-       virtual void deactivate(CameraManager::cameraContext &ctx) = 0;
-
-       virtual bool switchBehavior(CameraManager::cameraContext &ctx) = 0;
-
-       virtual bool allowInteraction() = 0;
-};
-
-#endif // __CAMERA_BEHAVIOR_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp    2012-05-13 
03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp    2012-05-13 
06:19:27 UTC (rev 2549)
@@ -23,10 +23,12 @@
 
 using namespace Ogre;
 
-void CameraBehaviorCharacter::update(CameraManager::cameraContext &ctx)
+void CameraBehaviorCharacter::update(const CameraManager::cameraContext_t &ctx)
 {
        Character *person = ctx.mEfl->person;
 
        targetDirection   = -person->getAngle() - Math::HALF_PI;
        camCenterPosition =  person->getPosition() + Vector3(0.0f, 1.1f, 0.0f);
+
+       CameraBehaviorOrbit::update(ctx);
 }

Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacter.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorCharacter.h      2012-05-13 
03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorCharacter.h      2012-05-13 
06:19:27 UTC (rev 2549)
@@ -28,9 +28,7 @@
 {
 public:
 
-       void update(CameraManager::cameraContext &ctx);
-
-       bool switchBehavior(CameraManager::cameraContext &ctx) { return true; };
+       void update(const CameraManager::cameraContext_t &ctx);
 };
 
 #endif // __CAMERA_BEHAVIOR_CHARACTER_ORBIT_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp        2012-05-13 
03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp        2012-05-13 
06:19:27 UTC (rev 2549)
@@ -21,6 +21,6 @@
 
 using namespace Ogre;
 
-void CameraBehaviorFixed::update(CameraManager::cameraContext &ctx)
+void CameraBehaviorFixed::update(const CameraManager::cameraContext_t &ctx)
 {
 }

Modified: trunk/source/main/gfx/camera/CameraBehaviorFixed.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFixed.h  2012-05-13 03:22:29 UTC 
(rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorFixed.h  2012-05-13 06:19:27 UTC 
(rev 2549)
@@ -28,7 +28,7 @@
 {
 public:
 
-       void update(CameraManager::cameraContext &ctx);
+       void update(const CameraManager::cameraContext_t &ctx);
 
        bool mouseMoved(const OIS::MouseEvent& _arg) { return false; };
 };

Modified: trunk/source/main/gfx/camera/CameraBehaviorFree.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-05-13 03:22:29 UTC 
(rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-05-13 06:19:27 UTC 
(rev 2549)
@@ -28,7 +28,7 @@
 
 using namespace Ogre;
 
-void CameraBehaviorFree::activate(CameraManager::cameraContext &ctx)
+void CameraBehaviorFree::activate(const CameraManager::cameraContext_t &ctx)
 {
        if ( ctx.mDOF )
        {
@@ -46,7 +46,7 @@
 #endif // USE_MYGUI
 }
 
-void CameraBehaviorFree::deactivate(CameraManager::cameraContext &ctx)
+void CameraBehaviorFree::deactivate(const CameraManager::cameraContext_t &ctx)
 {
        if ( ctx.mDOF)
        {
@@ -62,7 +62,7 @@
 #endif // USE_MYGUI
 }
 
-void CameraBehaviorFree::update(CameraManager::cameraContext &ctx)
+void CameraBehaviorFree::update(const 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-13 03:22:29 UTC 
(rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorFree.h   2012-05-13 06:19:27 UTC 
(rev 2549)
@@ -22,24 +22,22 @@
 
 #include "RoRPrerequisites.h"
 
-#include "CameraBehavior.h"
+#include "ICameraBehavior.h"
 
-class CameraBehaviorFree : public CameraBehavior
+class CameraBehaviorFree : public ICameraBehavior
 {
 public:
 
-       void activate(CameraManager::cameraContext &ctx);
-       void deactivate(CameraManager::cameraContext &ctx);
+       void activate(const CameraManager::cameraContext_t &ctx);
+       void deactivate(const CameraManager::cameraContext_t &ctx);
 
-       void update(CameraManager::cameraContext &ctx);
+       void update(const 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 switchBehavior(CameraManager::cameraContext &ctx) { return true; };
-
-       bool allowInteraction() { return false; };
+       bool switchBehavior(const CameraManager::cameraContext_t &ctx) { return 
true; };
 };
 
 #endif // __CAMERA_BEHAVIOR_FREE_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp        2012-05-13 
03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorOrbit.cpp        2012-05-13 
06:19:27 UTC (rev 2549)
@@ -40,8 +40,9 @@
 {
 }
 
-void CameraBehaviorOrbit::activate(CameraManager::cameraContext &ctx)
+void CameraBehaviorOrbit::activate(const CameraManager::cameraContext_t &ctx)
 {
+#if 0
        float fov = FSETTING("FOV External", 60);
 
        if ( ctx.mDOF )
@@ -51,13 +52,14 @@
        }
 
        camCenterPosition = Vector3(0.0f, 3.0f, 0.0f);
+#endif
 }
 
-void CameraBehaviorOrbit::deactivate(CameraManager::cameraContext &ctx)
+void CameraBehaviorOrbit::deactivate(const CameraManager::cameraContext_t &ctx)
 {
 }
 
-void CameraBehaviorOrbit::update(CameraManager::cameraContext &ctx)
+void CameraBehaviorOrbit::update(const CameraManager::cameraContext_t &ctx)
 {
        if (INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_LOOKBACK))
        {

Modified: trunk/source/main/gfx/camera/CameraBehaviorOrbit.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorOrbit.h  2012-05-13 03:22:29 UTC 
(rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorOrbit.h  2012-05-13 06:19:27 UTC 
(rev 2549)
@@ -22,24 +22,24 @@
 
 #include "RoRPrerequisites.h"
 
-#include "CameraBehavior.h"
+#include "ICameraBehavior.h"
 
-class CameraBehaviorOrbit : public CameraBehavior
+class CameraBehaviorOrbit : public ICameraBehavior
 {
 public:
 
        CameraBehaviorOrbit();
 
-       void update(CameraManager::cameraContext &ctx);
+       void update(const 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; };
 
-       void activate(CameraManager::cameraContext &ctx);
-       void deactivate(CameraManager::cameraContext &ctx);
+       void activate(const CameraManager::cameraContext_t &ctx);
+       void deactivate(const CameraManager::cameraContext_t &ctx);
 
-       bool allowInteraction() { return false; };
+       bool switchBehavior(const CameraManager::cameraContext_t &ctx) { return 
true; };
 
 protected:
 

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp      2012-05-13 
03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp      2012-05-13 
06:19:27 UTC (rev 2549)
@@ -33,7 +33,7 @@
                externalCameraMode = true;
 }
 
-void CameraBehaviorVehicle::update(CameraManager::cameraContext &ctx)
+void CameraBehaviorVehicle::update(const CameraManager::cameraContext_t &ctx)
 {
        Vector3 dir = 
ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodepos[0]].smoothpos - 
ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodedir[0]].smoothpos;
        dir.normalise();

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicle.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicle.h        2012-05-13 
03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicle.h        2012-05-13 
06:19:27 UTC (rev 2549)
@@ -30,10 +30,8 @@
 
        CameraBehaviorVehicle();
 
-       void update(CameraManager::cameraContext &ctx);
+       void update(const CameraManager::cameraContext_t &ctx);
 
-       bool switchBehavior(CameraManager::cameraContext &ctx) { return true; };
-
 protected:
 
        bool externalCameraMode;

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp       
2012-05-13 03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp       
2012-05-13 06:19:27 UTC (rev 2549)
@@ -25,7 +25,7 @@
 
 using namespace Ogre;
 
-void CameraBehaviorVehicleCineCam::activate(CameraManager::cameraContext &ctx)
+void CameraBehaviorVehicleCineCam::activate(const 
CameraManager::cameraContext_t &ctx)
 {
        float fov = FSETTING("FOV Internal", 75);
 
@@ -38,17 +38,17 @@
        ctx.mCamera->setFOVy(Degree(fov));
 }
 
-void CameraBehaviorVehicleCineCam::deactivate(CameraManager::cameraContext 
&ctx)
+void CameraBehaviorVehicleCineCam::deactivate(const 
CameraManager::cameraContext_t &ctx)
 {
 
 }
 
-bool CameraBehaviorVehicleCineCam::switchBehavior(CameraManager::cameraContext 
&ctx)
+bool CameraBehaviorVehicleCineCam::switchBehavior(const 
CameraManager::cameraContext_t &ctx)
 {
        return true;
 }
 
-void CameraBehaviorVehicleCineCam::update(CameraManager::cameraContext &ctx)
+void CameraBehaviorVehicleCineCam::update(const CameraManager::cameraContext_t 
&ctx)
 {
 
 }

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h 2012-05-13 
03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h 2012-05-13 
06:19:27 UTC (rev 2549)
@@ -28,12 +28,12 @@
 {
 public:
        
-       void update(CameraManager::cameraContext &ctx);
+       void update(const CameraManager::cameraContext_t &ctx);
 
-       void activate(CameraManager::cameraContext &ctx);
-       void deactivate(CameraManager::cameraContext &ctx);
+       void activate(const CameraManager::cameraContext_t &ctx);
+       void deactivate(const CameraManager::cameraContext_t &ctx);
 
-       bool switchBehavior(CameraManager::cameraContext &ctx);
+       bool switchBehavior(const CameraManager::cameraContext_t &ctx);
 };
 
 #endif // __CAMERA_BEHAVIOR_VEHICLE_INTERNAL_H_

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp        
2012-05-13 03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp        
2012-05-13 06:19:27 UTC (rev 2549)
@@ -36,7 +36,7 @@
 {
 }
 
-void CameraBehaviorVehicleSpline::activate(CameraManager::cameraContext &ctx)
+void CameraBehaviorVehicleSpline::activate(const 
CameraManager::cameraContext_t &ctx)
 {
        CameraBehaviorOrbit::activate(ctx);
 
@@ -68,7 +68,7 @@
        myManualObject->end();
 }
 
-void CameraBehaviorVehicleSpline::update(CameraManager::cameraContext &ctx)
+void CameraBehaviorVehicleSpline::update(const CameraManager::cameraContext_t 
&ctx)
 {
        Vector3 dir = 
ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodepos[0]].smoothpos - 
ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodedir[0]].smoothpos;
        dir.normalise();

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h  2012-05-13 
03:22:29 UTC (rev 2548)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.h  2012-05-13 
06:19:27 UTC (rev 2549)
@@ -30,8 +30,8 @@
 
        CameraBehaviorVehicleSpline();
 
-       void activate(CameraManager::cameraContext &ctx);
-       void update(CameraManager::cameraContext &ctx);
+       void activate(const CameraManager::cameraContext_t &ctx);
+       void update(const CameraManager::cameraContext_t &ctx);
 
        void updateSplineDisplay();
 

Modified: trunk/source/main/gfx/camera/CameraManager.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-13 03:22:29 UTC 
(rev 2548)
+++ trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-13 06:19:27 UTC 
(rev 2549)
@@ -42,6 +42,8 @@
 #include "CameraBehaviorVehicle.h"
 #include "CameraBehaviorVehicleSpline.h"
 
+#include "ICameraBehavior.h"
+
 using namespace Ogre;
 
 CameraManager::CameraManager(SceneManager *scm, Camera *cam, RoRFrameListener 
*efl, HeightFinder *hf) : 
@@ -53,42 +55,48 @@
        , mRotateSpeed(100.0f)
 {
        setSingleton(this);
-       
+
+       createGlobalBehaviors();
+
        ctx.mCamera = cam;
        ctx.mEfl = efl;
        ctx.mHfinder = hf;
        ctx.mLastPosition = Vector3::ZERO;
        ctx.mSceneMgr = scm;
-
+       
        if ( BSETTING("DOF", false) )
        {
                ctx.mDOF = new DOFManager(scm, cam->getViewport(), 
Root::getSingletonPtr(), cam);
                ctx.mDOF->setEnabled(true);
        }
 
-       createGlobalBehaviors();
-
-       switchBehavior(CAMERA_CHARACTER);
+       //switchBehavior(CAMERA_CHARACTER);
 }
 
 CameraManager::~CameraManager()
 {
+       for (std::map <int , ICameraBehavior *>::iterator it = 
globalBehaviors.begin(); it != globalBehaviors.end(); ++it)
+       {
+               delete it->second;
+       }
 
+       globalBehaviors.clear();
 }
 
 void CameraManager::createGlobalBehaviors()
 {
-       globalBehaviors.insert(std::pair<int, 
CameraBehavior*>(CAMERA_CHARACTER, new CameraBehaviorCharacter()));
-       globalBehaviors.insert(std::pair<int, CameraBehavior*>(CAMERA_VEHICLE, 
new CameraBehaviorVehicle()));
-       globalBehaviors.insert(std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_FIXED, new CameraBehaviorFixed()));
-       globalBehaviors.insert(std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_SPLINE, new CameraBehaviorVehicleSpline()));
-       globalBehaviors.insert(std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_CINECAM, new CameraBehaviorVehicleCineCam()));
-       globalBehaviors.insert(std::pair<int, CameraBehavior*>(CAMERA_FREE, new 
CameraBehaviorFree()));
+       globalBehaviors.insert(std::pair<int, 
ICameraBehavior*>(CAMERA_CHARACTER, new CameraBehaviorCharacter()));
+       globalBehaviors.insert(std::pair<int, 
ICameraBehavior*>(CAMERA_CHARACTER, new CameraBehaviorCharacter()));
+       globalBehaviors.insert(std::pair<int, ICameraBehavior*>(CAMERA_VEHICLE, 
new CameraBehaviorVehicle()));
+       globalBehaviors.insert(std::pair<int, 
ICameraBehavior*>(CAMERA_VEHICLE_FIXED, new CameraBehaviorFixed()));
+       globalBehaviors.insert(std::pair<int, 
ICameraBehavior*>(CAMERA_VEHICLE_SPLINE, new CameraBehaviorVehicleSpline()));
+       globalBehaviors.insert(std::pair<int, 
ICameraBehavior*>(CAMERA_VEHICLE_CINECAM, new CameraBehaviorVehicleCineCam()));
+       globalBehaviors.insert(std::pair<int, ICameraBehavior*>(CAMERA_FREE, 
new CameraBehaviorFree()));
 }
 
 void CameraManager::switchToNextBehavior()
 {
-       if ( currentBehavior->switchBehavior(ctx) )
+       if ( !currentBehavior || currentBehavior->switchBehavior(ctx) )
        {
                int i = (currentBehaviorID + 1) % CAMERA_END;
                switchBehavior(i);
@@ -103,7 +111,10 @@
        }
 
        // deactivate old
-       currentBehavior->deactivate(ctx);
+       if ( currentBehavior )
+       {
+               currentBehavior->deactivate(ctx);
+       }
 
        // set new
        currentBehavior = globalBehaviors[newBehavior];
@@ -133,28 +144,11 @@
        ctx.mRotScale   = Degree(mRotScale);
        ctx.mTransScale = mTransScale;
 
-       if ( !currentBehavior->allowInteraction() )
+       if ( currentBehavior )
        {
-               if ( INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || 
INPUTENGINE.isKeyDown(OIS::KC_RSHIFT) )
-               {
-                       ctx.mRotScale *= 3;
-                       ctx.mTransScale *= 3;
-               }
-
-               if ( INPUTENGINE.isKeyDown(OIS::KC_LCONTROL) )
-               {
-                       ctx.mRotScale *= 30;
-                       ctx.mTransScale *= 30;
-               }
-               if ( INPUTENGINE.isKeyDown(OIS::KC_LMENU) )
-               {
-                       ctx.mRotScale *= 0.05;
-                       ctx.mTransScale *= 0.05;
-               }
+               currentBehavior->update(ctx);
        }
 
-       currentBehavior->update(ctx);
-
 #ifdef USE_OPENAL
        // update audio listener position
        Vector3 cameraSpeed = (ctx.mCamera->getPosition() - ctx.mLastPosition) 
/ dt;
@@ -177,9 +171,4 @@
 bool CameraManager::mouseReleased(const OIS::MouseEvent& _arg, 
OIS::MouseButtonID _id)
 {
        return currentBehavior->mouseReleased(_arg, _id);
-}
-
-bool CameraManager::allowInteraction()
-{
-       return currentBehavior->allowInteraction();
-}
+}
\ No newline at end of file

Modified: trunk/source/main/gfx/camera/CameraManager.h
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.h        2012-05-13 03:22:29 UTC 
(rev 2548)
+++ trunk/source/main/gfx/camera/CameraManager.h        2012-05-13 06:19:27 UTC 
(rev 2549)
@@ -25,7 +25,7 @@
 #include "OIS.h"
 #include "Singleton.h"
 
-class CameraBehavior;
+class ICameraBehavior;
 
 class CameraManager : public RoRSingletonNoCreation < CameraManager >
 {
@@ -64,21 +64,19 @@
        Ogre::Camera *getCamera() { return ctx.mCamera; };
        int getCameraMode() { return currentBehaviorID; };
 
-       bool allowInteraction();
-
        static const int DEFAULT_INTERNAL_CAM_PITCH = -15;
 
 protected:
-
-       cameraContext_t ctx;
        
+       cameraContext_t ctx;
+
        float mTransScale, mTransSpeed;
        float mRotScale, mRotateSpeed;
 
        int currentBehaviorID;
-       CameraBehavior *currentBehavior;
+       ICameraBehavior *currentBehavior;
 
-       std::map <int , CameraBehavior *> globalBehaviors;
+       std::map <int , ICameraBehavior *> globalBehaviors;
 
        void createGlobalBehaviors();
 

Copied: trunk/source/main/gfx/camera/ICameraBehavior.h (from rev 2548, 
trunk/source/main/gfx/camera/CameraBehavior.h)
===================================================================
--- trunk/source/main/gfx/camera/ICameraBehavior.h                              
(rev 0)
+++ trunk/source/main/gfx/camera/ICameraBehavior.h      2012-05-13 06:19:27 UTC 
(rev 2549)
@@ -0,0 +1,46 @@
+/*
+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 __I_CAMERA_BEHAVIOR_H_
+#define __I_CAMERA_BEHAVIOR_H_
+
+#include "RoRPrerequisites.h"
+
+#include "CameraManager.h"
+#include <OIS.h>
+
+class ICameraBehavior
+{
+public:
+
+       virtual ~ICameraBehavior() {}
+
+       virtual void update(const 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(const CameraManager::cameraContext_t &ctx) = 0;
+       virtual void deactivate(const CameraManager::cameraContext_t &ctx) = 0;
+
+       virtual bool switchBehavior(const CameraManager::cameraContext_t &ctx) 
= 0;
+};
+
+#endif // __I_CAMERA_BEHAVIOR_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