Revision: 2586 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2586&view=rev Author: ulteq Date: 2012-05-17 16:30:32 +0000 (Thu, 17 May 2012) Log Message: ----------- -Codechange: CameraSystem WIP first preparations for re-enabling depth of field added reset() to the Camera Behavior interface
Modified Paths: -------------- trunk/source/main/gameplay/RoRFrameListener.cpp trunk/source/main/gameplay/RoRFrameListener.h trunk/source/main/gfx/camera/CameraBehavior.cpp trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp trunk/source/main/gfx/camera/CameraBehaviorCharacter.h trunk/source/main/gfx/camera/CameraBehaviorFree.cpp trunk/source/main/gfx/camera/CameraBehaviorFree.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/CameraManager.cpp trunk/source/main/gfx/camera/CameraManager.h trunk/source/main/gfx/camera/ICameraBehavior.h Modified: trunk/source/main/gameplay/RoRFrameListener.cpp =================================================================== --- trunk/source/main/gameplay/RoRFrameListener.cpp 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gameplay/RoRFrameListener.cpp 2012-05-17 16:30:32 UTC (rev 2586) @@ -40,6 +40,7 @@ #include "CollisionTools.h" #include "dashboard.h" #include "DashBoardManager.h" +#include "DepthOfFieldEffect.h" #include "DustManager.h" #include "editor.h" #include "envmap.h" @@ -172,8 +173,6 @@ return RoRFrameListener::hfinder->getHeightAt(x, z); } - - void RoRFrameListener::startTimer() { raceStartTime = (int)rtime; @@ -744,6 +743,7 @@ editor(0), editorfd(0), envmap(0), + dof(0), flaresMode(3), // on by default forcefeedback(0), freeTruckPosition(false), @@ -929,7 +929,6 @@ else if (lightsMode == "All vehicles, all lights") flaresMode = 4; - // heathaze effect if (BSETTING("HeatHaze", false)) { @@ -937,9 +936,14 @@ heathaze->setEnable(true); } - // no more force feedback - // useforce=(SSETTING("Controler Force Feedback")=="Enable"); - // force feedback is ...back :) + // depth of field effect + if (BSETTING("DOF", false)) + { + //dof = new DOFManager(mSceneMgr, mCamera->getViewport(), mRoot, mCamera); + //dof->setEnabled(true); + } + + // force feedback if (BSETTING("Force Feedback", true)) { //check if a device has been detected @@ -1128,7 +1132,7 @@ person = (Character *)CharacterFactory::getSingleton().createLocal(-1); // init camera manager after mygui and after we have a character - new CameraManager(mSceneMgr, mCamera, this, hfinder, person, ow); + new CameraManager(mSceneMgr, mCamera, this, hfinder, person, ow, dof); person->setVisible(false); @@ -4110,12 +4114,11 @@ // first compositor: HDR! // HDR if wished - bool useHDR = (BSETTING("HDR", false)); - if (useHDR) + if (BSETTING("HDR", false)) + { initHDR(); + } - - if (BSETTING("Glow", false)) { CompositorManager::getSingleton().addCompositor(mCamera->getViewport(), "Glow"); Modified: trunk/source/main/gameplay/RoRFrameListener.h =================================================================== --- trunk/source/main/gameplay/RoRFrameListener.h 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gameplay/RoRFrameListener.h 2012-05-17 16:30:32 UTC (rev 2586) @@ -146,6 +146,7 @@ AppState *parentState; Collisions *collisions; Dashboard *dashboard; + DOFManager *dof; Editor *editor; Envmap *envmap; FILE *editorfd; Modified: trunk/source/main/gfx/camera/CameraBehavior.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehavior.cpp 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehavior.cpp 2012-05-17 16:30:32 UTC (rev 2586) @@ -86,9 +86,7 @@ if ( INPUTENGINE.getEventBoolValue(EV_CAMERA_RESET) ) { - camRotX = 0.0f; - camRotY = 0.0f; - camDist = 5.0f; + reset(ctx); } if ( camDistMin > 0.0f ) Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp 2012-05-17 16:30:32 UTC (rev 2586) @@ -20,6 +20,7 @@ #include "CameraBehaviorCharacter.h" #include "Character.h" +#include "mygui/BaseLayout.h" using namespace Ogre; @@ -56,9 +57,8 @@ return CameraBehavior::mouseMoved(ctx, _arg); } -bool CameraBehaviorCharacter::switchBehavior(const CameraManager::cameraContext_t &ctx) +void CameraBehaviorCharacter::reset(const CameraManager::cameraContext_t &ctx) { - camMode = (camMode + 1) % CHARACTER_END; camRotX = 0.0f; if ( camMode == CHARACTER_FIRST_PERSON ) @@ -67,13 +67,26 @@ camDist = 0.1f; camIntertia = 0.0f; camPositionOffset = Vector3(0.0f, 1.82f, 0.0f); +#ifdef USE_MYGUI + MyGUI::PointerManager::getInstance().setVisible(false); +#endif // USE_MYGUI } else if ( camMode == CHARACTER_THIRD_PERSON ) { camRotY = 0.3f; camDist = 5.0f; camIntertia = 11.0f; camPositionOffset = Vector3(0.0f, 1.1f, 0.0f); +#ifdef USE_MYGUI + MyGUI::PointerManager::getInstance().setVisible(true); +#endif // USE_MYGUI } +} +bool CameraBehaviorCharacter::switchBehavior(const CameraManager::cameraContext_t &ctx) +{ + camMode = (camMode + 1) % CHARACTER_END; + + reset(ctx); + return false; } Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacter.h =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorCharacter.h 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehaviorCharacter.h 2012-05-17 16:30:32 UTC (rev 2586) @@ -34,6 +34,8 @@ bool mouseMoved(const CameraManager::cameraContext_t &ctx, const OIS::MouseEvent& _arg); + void reset(const CameraManager::cameraContext_t &ctx); + bool switchBehavior(const CameraManager::cameraContext_t &ctx); protected: Modified: trunk/source/main/gfx/camera/CameraBehaviorFree.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-05-17 16:30:32 UTC (rev 2586) @@ -19,62 +19,71 @@ */ #include "CameraBehaviorFree.h" -#include "Console.h" #include "InputEngine.h" -#include "language.h" +#include "mygui/BaseLayout.h" #include "Ogre.h" using namespace Ogre; void CameraBehaviorFree::update(const CameraManager::cameraContext_t &ctx) { - Vector3 mTranslateVector = Vector3::ZERO; + Vector3 mTrans = Vector3::ZERO; Degree mRotX(0.0f); Degree mRotY(0.0f); - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_SIDESTEP_LEFT)) - mTranslateVector.x -= ctx.mTransScale; // Move camera left + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_SIDESTEP_LEFT) ) + { + mTrans.x -= ctx.mTransScale; + } + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_SIDESTEP_RIGHT) ) + { + mTrans.x += ctx.mTransScale; + } - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_SIDESTEP_RIGHT)) - mTranslateVector.x += ctx.mTransScale; // Move camera RIGHT + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_FORWARD) ) + { + mTrans.z -= ctx.mTransScale; + } + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_BACKWARDS) ) + { + mTrans.z += ctx.mTransScale; + } - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_FORWARD)) - mTranslateVector.z -= ctx.mTransScale; // Move camera forward - - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_BACKWARDS)) - mTranslateVector.z += ctx.mTransScale; // Move camera backward - - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_ROT_UP)) + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_ROT_UP) ) + { mRotY += ctx.mRotScale; - - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_ROT_DOWN)) + } + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_ROT_DOWN) ) + { mRotY -= ctx.mRotScale; + } - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_UP)) - mTranslateVector.y += ctx.mTransScale; // Move camera up - - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_DOWN)) - mTranslateVector.y -= ctx.mTransScale; // Move camera down - - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_RIGHT)) + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_UP) ) + { + mTrans.y += ctx.mTransScale; + } + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_DOWN) ) + { + mTrans.y -= ctx.mTransScale; + } + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_RIGHT) ) + { mRotX -= ctx.mRotScale; - - if(INPUTENGINE.getEventBoolValue(EV_CHARACTER_LEFT)) + } + if ( INPUTENGINE.getEventBoolValue(EV_CHARACTER_LEFT) ) + { mRotX += ctx.mRotScale; + } ctx.mCamera->yaw(mRotX); ctx.mCamera->pitch(mRotY); - Vector3 trans = ctx.mCamera->getOrientation() * mTranslateVector; - ctx.mCamera->setPosition(ctx.mCamera->getPosition() + trans); + ctx.mCamera->setPosition(ctx.mCamera->getPosition() + ctx.mCamera->getOrientation() * mTrans); } void CameraBehaviorFree::activate(const CameraManager::cameraContext_t &ctx) { ctx.mCamera->setFixedYawAxis(true, Vector3::UNIT_Y); - - CONSOLE_PUTMESSAGE(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_NOTICE, _L("free camera"), "camera_go.png", 3000, false); - #ifdef USE_MYGUI MyGUI::PointerManager::getInstance().setVisible(false); #endif // USE_MYGUI @@ -83,9 +92,6 @@ void CameraBehaviorFree::deactivate(const CameraManager::cameraContext_t &ctx) { ctx.mCamera->setFixedYawAxis(false); - - CONSOLE_PUTMESSAGE(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_NOTICE, _L("normal camera"), "camera.png", 3000, false); - #ifdef USE_MYGUI MyGUI::PointerManager::getInstance().setVisible(true); #endif // USE_MYGUI @@ -95,8 +101,8 @@ { const OIS::MouseState ms = _arg.state; - ctx.mCamera->yaw(Degree(-(float)ms.X.rel * 0.13f)); - ctx.mCamera->pitch(Degree(-(float)ms.Y.rel * 0.13f)); + ctx.mCamera->yaw(Degree(-ms.X.rel * 0.13f)); + ctx.mCamera->pitch(Degree(-ms.Y.rel * 0.13f)); return true; } Modified: trunk/source/main/gfx/camera/CameraBehaviorFree.h =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorFree.h 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehaviorFree.h 2012-05-17 16:30:32 UTC (rev 2586) @@ -28,15 +28,16 @@ { public: - void activate(const CameraManager::cameraContext_t &ctx); - void deactivate(const CameraManager::cameraContext_t &ctx); - void update(const CameraManager::cameraContext_t &ctx); bool mouseMoved(const CameraManager::cameraContext_t &ctx, const OIS::MouseEvent& _arg); bool mousePressed(const CameraManager::cameraContext_t &ctx, const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) { return false; }; bool mouseReleased(const CameraManager::cameraContext_t &ctx, const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) { return false; }; + void activate(const CameraManager::cameraContext_t &ctx); + void deactivate(const CameraManager::cameraContext_t &ctx); + void reset(const CameraManager::cameraContext_t &ctx) {}; + bool switchBehavior(const CameraManager::cameraContext_t &ctx) { return true; }; }; Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp 2012-05-17 16:30:32 UTC (rev 2586) @@ -28,16 +28,16 @@ CameraBehavior() , camPitching(true) { - camRotY = 0.5f; - if ( SSETTING("External Camera Mode", "Pitching") == "Static" ) + { camPitching = false; + } } 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).normalisedCopy(); + Vector3 dir = (currTruck->nodes[currTruck->cameranodepos[0]].smoothpos + - currTruck->nodes[currTruck->cameranodedir[0]].smoothpos).normalisedCopy(); targetDirection = -atan2(dir.dotProduct(Vector3::UNIT_X), dir.dotProduct(-Vector3::UNIT_Z)); targetPitch = 0.0f; @@ -46,16 +46,22 @@ { targetPitch = -asin(dir.dotProduct(Vector3::UNIT_Y)); } - - camIntertia = 1.0f / (ctx.mDt * 4.0f); - camLookAt = ctx.mCurrTruck->getPosition(); + camLookAt = currTruck->getPosition(); CameraBehavior::update(ctx); } void CameraBehaviorVehicle::activate(const CameraManager::cameraContext_t &ctx) { - camDistMin = ctx.mCurrTruck->getMinimalCameraRadius() * 2.0f; + currTruck = ctx.mCurrTruck; + camDistMin = currTruck->getMinimalCameraRadius() * 2.0f; + reset(ctx); +} + +void CameraBehaviorVehicle::reset(const CameraManager::cameraContext_t &ctx) +{ + camRotX = 0.0f; + camRotY = 0.5f; camDist = camDistMin * 1.5f; } Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicle.h =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorVehicle.h 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehaviorVehicle.h 2012-05-17 16:30:32 UTC (rev 2586) @@ -33,11 +33,13 @@ void update(const CameraManager::cameraContext_t &ctx); void activate(const CameraManager::cameraContext_t &ctx); + void reset(const CameraManager::cameraContext_t &ctx); bool switchBehavior(const CameraManager::cameraContext_t &ctx) { return true; }; protected: + Beam *currTruck; bool camPitching; }; Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp 2012-05-17 16:30:32 UTC (rev 2586) @@ -36,11 +36,11 @@ { CameraBehavior::update(ctx); - Vector3 dir = (ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodepos[ctx.mCurrTruck->currentcamera]].smoothpos - - ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodedir[ctx.mCurrTruck->currentcamera]].smoothpos).normalisedCopy(); + Vector3 dir = (currTruck->nodes[currTruck->cameranodepos[currTruck->currentcamera]].smoothpos + - currTruck->nodes[currTruck->cameranodedir[currTruck->currentcamera]].smoothpos).normalisedCopy(); - Vector3 roll = (ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodepos[ctx.mCurrTruck->currentcamera]].smoothpos - - ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranoderoll[ctx.mCurrTruck->currentcamera]].smoothpos).normalisedCopy(); + Vector3 roll = (currTruck->nodes[currTruck->cameranodepos[currTruck->currentcamera]].smoothpos + - currTruck->nodes[currTruck->cameranoderoll[currTruck->currentcamera]].smoothpos).normalisedCopy(); Vector3 up = dir.crossProduct(roll); @@ -48,13 +48,15 @@ Quaternion orientation = Quaternion(camRotX, up) * Quaternion(Degree(180.0) + camRotY, roll) * Quaternion(roll, up, dir); - ctx.mCamera->setPosition(ctx.mCurrTruck->nodes[ctx.mCurrTruck->cinecameranodepos[ctx.mCurrTruck->currentcamera]].smoothpos); + ctx.mCamera->setPosition(currTruck->nodes[currTruck->cinecameranodepos[currTruck->currentcamera]].smoothpos); ctx.mCamera->setOrientation(orientation); } void CameraBehaviorVehicleCineCam::activate(const CameraManager::cameraContext_t &ctx) { - if (ctx.mCurrTruck->freecinecamera <= 0) + CameraBehaviorVehicle::activate(ctx); + + if ( currTruck->freecinecamera <= 0 ) { CameraManager::getSingleton().switchToNextBehavior(); return; @@ -62,46 +64,50 @@ ctx.mCamera->setFOVy(Degree(fovInternal)); - camRotX = 0.0f; - camRotY = Degree(DEFAULT_INTERNAL_CAM_PITCH); + reset(ctx); - ctx.mCurrTruck->prepareInside(true); + currTruck->prepareInside(true); if ( ctx.mOverlayWrapper ) { - if(ctx.mCurrTruck->driveable == AIRPLANE) - ctx.mOverlayWrapper->showDashboardOverlays(true, ctx.mCurrTruck); + if ( currTruck->driveable == AIRPLANE ) + ctx.mOverlayWrapper->showDashboardOverlays(true, currTruck); else - ctx.mOverlayWrapper->showDashboardOverlays(false, ctx.mCurrTruck); + ctx.mOverlayWrapper->showDashboardOverlays(false, currTruck); } - ctx.mCurrTruck->currentcamera = 0; - ctx.mCurrTruck->changedCamera(); + currTruck->currentcamera = 0; + currTruck->changedCamera(); } void CameraBehaviorVehicleCineCam::deactivate(const CameraManager::cameraContext_t &ctx) { ctx.mCamera->setFOVy(Degree(fovExternal)); - ctx.mCurrTruck->prepareInside(false); + currTruck->prepareInside(false); if ( ctx.mOverlayWrapper ) { - ctx.mOverlayWrapper->showDashboardOverlays(true, ctx.mCurrTruck); + ctx.mOverlayWrapper->showDashboardOverlays(true, currTruck); } - ctx.mCurrTruck->currentcamera= - 1; - ctx.mCurrTruck->changedCamera(); + currTruck->currentcamera = -1; + currTruck->changedCamera(); } +void CameraBehaviorVehicleCineCam::reset(const CameraManager::cameraContext_t &ctx) +{ + camRotX = 0.0f; + camRotY = Degree(DEFAULT_INTERNAL_CAM_PITCH); +} + bool CameraBehaviorVehicleCineCam::switchBehavior(const CameraManager::cameraContext_t &ctx) { - if ( ctx.mCurrTruck->currentcamera < ctx.mCurrTruck->freecinecamera-1 ) + if ( currTruck->currentcamera < currTruck->freecinecamera-1 ) { - ctx.mCurrTruck->currentcamera++; - ctx.mCurrTruck->changedCamera(); + currTruck->currentcamera++; + currTruck->changedCamera(); return false; } - return true; } Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h 2012-05-17 16:30:32 UTC (rev 2586) @@ -34,6 +34,7 @@ void activate(const CameraManager::cameraContext_t &ctx); void deactivate(const CameraManager::cameraContext_t &ctx); + void reset(const CameraManager::cameraContext_t &ctx); bool switchBehavior(const CameraManager::cameraContext_t &ctx); Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp 2012-05-17 16:30:32 UTC (rev 2586) @@ -20,7 +20,6 @@ #include "CameraBehaviorVehicleSpline.h" #include "Beam.h" -#include "Console.h" #include "InputEngine.h" #include "language.h" #include "Ogre.h" @@ -40,9 +39,9 @@ { Vector3 dir = ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodepos[0]].smoothpos - ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodedir[0]].smoothpos; dir.normalise(); - //targetDirection = -atan2(dir.dotProduct(Vector3::UNIT_X), dir.dotProduct(-Vector3::UNIT_Z)); - //targetPitch = 0; - //camRatio = 1.0f / (ctx.mCurrTruck->tdt * 4.0f); + targetDirection = -atan2(dir.dotProduct(Vector3::UNIT_X), dir.dotProduct(-Vector3::UNIT_Z)); + targetPitch = 0; + camIntertia = 1.0f / (ctx.mDt * 4.0f); if ( ctx.mCurrTruck->free_camerarail > 0 ) { @@ -54,11 +53,11 @@ updateSplineDisplay(); - //camCenterPosition = spline->interpolate(splinePos); + camLookAt = spline->interpolate(splinePos); } else { // fallback :-/ - //camCenterPosition = ctx.mCurrTruck->getPosition(); + camLookAt = ctx.mCurrTruck->getPosition(); } CameraBehavior::update(ctx); @@ -90,15 +89,15 @@ if ( INPUTENGINE.isKeyDown(OIS::KC_LCONTROL) && ms.buttonDown(OIS::MB_Right) ) { - splinePos += (float)ms.X.rel * 0.001f; - if (splinePos < 0) splinePos = 0; - if (splinePos > 1) splinePos = 1; + splinePos += ms.X.rel * 0.001f; + splinePos = std::max(0.0f, splinePos); + splinePos = std::min(splinePos, 1.0f); return true; } else if ( ms.buttonDown(OIS::MB_Right) ) { - camRotX += Degree( (float)ms.X.rel * 0.13f); - camRotY += Degree(-(float)ms.Y.rel * 0.13f); - camDist += -(float)ms.Z.rel * 0.02f; + camRotX += Degree( ms.X.rel * 0.13f); + camRotY += Degree(-ms.Y.rel * 0.13f); + camDist += -ms.Z.rel * 0.02f; return true; } return false; Modified: trunk/source/main/gfx/camera/CameraManager.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraManager.cpp 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraManager.cpp 2012-05-17 16:30:32 UTC (rev 2586) @@ -34,7 +34,7 @@ using namespace Ogre; -CameraManager::CameraManager(SceneManager *scm, Camera *cam, RoRFrameListener *efl, HeightFinder *hf, Character *ps, OverlayWrapper *ow) : +CameraManager::CameraManager(SceneManager *scm, Camera *cam, RoRFrameListener *efl, HeightFinder *hf, Character *ps, OverlayWrapper *ow, DOFManager *dof) : currentBehavior(0) , currentBehaviorID(-1) , mTransScale(1.0f) @@ -49,6 +49,7 @@ ctx.mCamera = cam; ctx.mCharacter = ps; ctx.mCurrTruck = 0; + ctx.mDof = dof; ctx.mEfl = efl; ctx.mHfinder = hf; ctx.mOverlayWrapper = ow; @@ -127,7 +128,7 @@ ctx.mRotScale = Degree(mRotScale); ctx.mTransScale = mTransScale; - if ( !ctx.mCurrTruck && dynamic_cast<CameraBehaviorVehicle*>(currentBehavior)) + if ( !ctx.mCurrTruck && dynamic_cast<CameraBehaviorVehicle*>(currentBehavior) ) { switchBehavior(CAMERA_BEHAVIOR_CHARACTER); } else if ( ctx.mCurrTruck && !dynamic_cast<CameraBehaviorVehicle*>(currentBehavior) ) Modified: trunk/source/main/gfx/camera/CameraManager.h =================================================================== --- trunk/source/main/gfx/camera/CameraManager.h 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/CameraManager.h 2012-05-17 16:30:32 UTC (rev 2586) @@ -33,12 +33,13 @@ public: - CameraManager(Ogre::SceneManager *scm, Ogre::Camera *cam, RoRFrameListener *efl, HeightFinder *hf, Character *ps, OverlayWrapper *ow); + CameraManager(Ogre::SceneManager *scm, Ogre::Camera *cam, RoRFrameListener *efl, HeightFinder *hf, Character *ps, OverlayWrapper *ow, DOFManager *dof); ~CameraManager(); typedef struct cameraContext { Beam *mCurrTruck; Character *mCharacter; + DOFManager *mDof; HeightFinder *mHfinder; Ogre::Camera *mCamera; Ogre::Degree mRotScale; Modified: trunk/source/main/gfx/camera/ICameraBehavior.h =================================================================== --- trunk/source/main/gfx/camera/ICameraBehavior.h 2012-05-17 14:09:29 UTC (rev 2585) +++ trunk/source/main/gfx/camera/ICameraBehavior.h 2012-05-17 16:30:32 UTC (rev 2586) @@ -39,6 +39,7 @@ virtual void activate(const CameraManager::cameraContext_t &ctx) = 0; virtual void deactivate(const CameraManager::cameraContext_t &ctx) = 0; + virtual void reset(const CameraManager::cameraContext_t &ctx) = 0; virtual bool switchBehavior(const CameraManager::cameraContext_t &ctx) = 0; }; 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