Revision: 2610 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2610&view=rev Author: ulteq Date: 2012-05-20 14:17:50 +0000 (Sun, 20 May 2012) Log Message: ----------- -Codechange: CameraSystem WIP (nearly done) field of view changeable again
Modified Paths: -------------- trunk/source/main/gameplay/RoRFrameListener.cpp trunk/source/main/gfx/camera/CameraBehavior.cpp trunk/source/main/gfx/camera/CameraBehavior.h trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h trunk/source/main/gfx/camera/CameraManager.cpp trunk/source/main/gfx/camera/CameraManager.h Modified: trunk/source/main/gameplay/RoRFrameListener.cpp =================================================================== --- trunk/source/main/gameplay/RoRFrameListener.cpp 2012-05-20 03:11:29 UTC (rev 2609) +++ trunk/source/main/gameplay/RoRFrameListener.cpp 2012-05-20 14:17:50 UTC (rev 2610) @@ -2107,8 +2107,42 @@ } } + // camera FOV settings + if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_FOV_LESS) || INPUTENGINE.getEventBoolValueBounce(EV_COMMON_FOV_MORE)) + { + int fov = mCamera->getFOVy().valueDegrees(); + if (INPUTENGINE.getEventBoolValue(EV_COMMON_FOV_LESS)) + fov -= 2; + else + fov += 2; + if (fov >= 10 && fov <= 160) + { + 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 (CameraManager::singletonExists() && + CameraManager::getSingleton().hasActiveBehavior() && + CameraManager::getSingleton().getCameraBehavior() == CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM) + { + SETTINGS.setSetting("FOV Internal", TOSTRING(fov)); + } else + { + SETTINGS.setSetting("FOV External", TOSTRING(fov)); + } + } else + { +#ifdef USE_MYGUI + Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_NOTICE, _L("FOV: Limit reached"), "camera_edit.png", 2000); +#endif // USE_MYGUI + } + } + // full screen/windowed screen switching if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_FULLSCREEN_TOGGLE, 2.0f)) { Modified: trunk/source/main/gfx/camera/CameraBehavior.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehavior.cpp 2012-05-20 03:11:29 UTC (rev 2609) +++ trunk/source/main/gfx/camera/CameraBehavior.cpp 2012-05-20 14:17:50 UTC (rev 2610) @@ -140,3 +140,9 @@ return false; } + +void CameraBehavior::reset(const CameraManager::cameraContext_t &ctx) +{ + camRotX = 0.0f; + ctx.mCamera->setFOVy(ctx.fovExternal); +} Modified: trunk/source/main/gfx/camera/CameraBehavior.h =================================================================== --- trunk/source/main/gfx/camera/CameraBehavior.h 2012-05-20 03:11:29 UTC (rev 2609) +++ trunk/source/main/gfx/camera/CameraBehavior.h 2012-05-20 14:17:50 UTC (rev 2610) @@ -34,6 +34,7 @@ void activate(const CameraManager::cameraContext_t &ctx, bool reset = true) {}; void deactivate(const CameraManager::cameraContext_t &ctx) {}; + void reset(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; }; Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp 2012-05-20 03:11:29 UTC (rev 2609) +++ trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp 2012-05-20 14:17:50 UTC (rev 2610) @@ -77,7 +77,7 @@ void CameraBehaviorCharacter::reset(const CameraManager::cameraContext_t &ctx) { - camRotX = 0.0f; + CameraBehavior::reset(ctx); if ( camMode == CHARACTER_FIRST_PERSON ) { Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp 2012-05-20 03:11:29 UTC (rev 2609) +++ trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp 2012-05-20 14:17:50 UTC (rev 2610) @@ -69,7 +69,7 @@ void CameraBehaviorVehicle::reset(const CameraManager::cameraContext_t &ctx) { - camRotX = 0.0f; + CameraBehavior::reset(ctx); camRotY = 0.35f; camDist = ctx.mCurrTruck->getMinimalCameraRadius() * 3.0f + 2.0f; camDistMin = ctx.mCurrTruck->getMinimalCameraRadius() * 2.0f; Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp 2012-05-20 03:11:29 UTC (rev 2609) +++ trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp 2012-05-20 14:17:50 UTC (rev 2610) @@ -21,7 +21,6 @@ #include "Beam.h" #include "OverlayWrapper.h" -#include "Settings.h" using namespace Ogre; @@ -30,8 +29,6 @@ , currTruck(0) , lastCineCam(0) { - fovInternal = Degree(FSETTING("FOV Internal", 75.0f)); - fovExternal = Degree(FSETTING("FOV External", 60.0f)); } void CameraBehaviorVehicleCineCam::update(const CameraManager::cameraContext_t &ctx) @@ -75,7 +72,7 @@ currTruck = ctx.mCurrTruck; - ctx.mCamera->setFOVy(fovInternal); + ctx.mCamera->setFOVy(ctx.fovInternal); ctx.mCurrTruck->prepareInside(true); @@ -99,7 +96,7 @@ return; } - ctx.mCamera->setFOVy(fovExternal); + ctx.mCamera->setFOVy(ctx.fovExternal); currTruck->prepareInside(false); @@ -116,8 +113,9 @@ void CameraBehaviorVehicleCineCam::reset(const CameraManager::cameraContext_t &ctx) { - camRotX = 0.0f; + CameraBehavior::reset(ctx); camRotY = Degree(DEFAULT_INTERNAL_CAM_PITCH); + ctx.mCamera->setFOVy(ctx.fovInternal); } bool CameraBehaviorVehicleCineCam::switchBehavior(const CameraManager::cameraContext_t &ctx) Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h 2012-05-20 03:11:29 UTC (rev 2609) +++ trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.h 2012-05-20 14:17:50 UTC (rev 2610) @@ -42,7 +42,6 @@ Beam *currTruck; int lastCineCam; - Ogre::Radian fovInternal, fovExternal; static const int DEFAULT_INTERNAL_CAM_PITCH = -15; }; Modified: trunk/source/main/gfx/camera/CameraManager.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraManager.cpp 2012-05-20 03:11:29 UTC (rev 2609) +++ trunk/source/main/gfx/camera/CameraManager.cpp 2012-05-20 14:17:50 UTC (rev 2610) @@ -22,6 +22,7 @@ #include "BeamFactory.h" #include "InputEngine.h" #include "RoRFrameListener.h" +#include "Settings.h" #include "CameraBehavior.h" #include "CameraBehaviorCharacter.h" @@ -81,6 +82,8 @@ ctx.mHfinder = RoRFrameListener::hfinder; ctx.mRotScale = Degree(mRotScale); ctx.mTransScale = mTransScale; + ctx.fovInternal = Degree(FSETTING("FOV Internal", 75.0f)); + ctx.fovExternal = Degree(FSETTING("FOV External", 60.0f)); if ( currentBehaviorID < CAMERA_BEHAVIOR_END && INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_CHANGE) ) { Modified: trunk/source/main/gfx/camera/CameraManager.h =================================================================== --- trunk/source/main/gfx/camera/CameraManager.h 2012-05-20 03:11:29 UTC (rev 2609) +++ trunk/source/main/gfx/camera/CameraManager.h 2012-05-20 14:17:50 UTC (rev 2610) @@ -46,8 +46,10 @@ Ogre::SceneManager *mSceneMgr; OverlayWrapper *mOverlayWrapper; RoRFrameListener *mEfl; - float mDt; - float mTransScale; + Ogre::Real mDt; + Ogre::Real mTransScale; + Ogre::Radian fovInternal; + Ogre::Radian fovExternal; } cameraContext_t; enum CameraBehaviors { 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