Revision: 2746
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2746&view=rev
Author:   ulteq
Date:     2012-05-28 20:01:26 +0000 (Mon, 28 May 2012)
Log Message:
-----------
added checks for gEnv->terrainManager being 0
made dof focus mode transparent for the behaviors
added upper bound of ~50 units for minCamDist

Modified Paths:
--------------
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/gfx/camera/CameraBehavior.cpp
    trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp
    trunk/source/main/gfx/camera/CameraBehaviorFree.cpp
    trunk/source/main/gfx/camera/CameraBehaviorIsometric.cpp
    trunk/source/main/gfx/camera/CameraBehaviorStatic.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp
    trunk/source/main/gfx/camera/CameraManager.cpp

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-28 19:34:58 UTC 
(rev 2745)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-28 20:01:26 UTC 
(rev 2746)
@@ -2762,7 +2762,7 @@
 #endif //OIS_G27
 
        LOG(" ** Shutdown final");
-       if (gEnv->terrainManager->getWater()) 
gEnv->terrainManager->getWater()->prepareShutdown();
+       if (gEnv->terrainManager && gEnv->terrainManager->getWater()) 
gEnv->terrainManager->getWater()->prepareShutdown();
        if (dashboard) dashboard->prepareShutdown();
        if (gEnv->terrainManager->getEnvmap()) 
gEnv->terrainManager->getEnvmap()->prepareShutdown();
        if (heathaze) heathaze->prepareShutdown();

Modified: trunk/source/main/gfx/camera/CameraBehavior.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehavior.cpp     2012-05-28 19:34:58 UTC 
(rev 2745)
+++ trunk/source/main/gfx/camera/CameraBehavior.cpp     2012-05-28 20:01:26 UTC 
(rev 2746)
@@ -107,7 +107,7 @@
                        , cos(targetDirection.valueRadians() + 
camRotX.valueRadians()) * cos(targetPitch.valueRadians() + 
camRotY.valueRadians())
                        );
 
-       if ( gEnv->terrainManager->getHeightFinder() )
+       if ( gEnv->terrainManager && gEnv->terrainManager->getHeightFinder() )
        {
                float h = 
gEnv->terrainManager->getHeightFinder()->getHeightAt(desiredPosition.x, 
desiredPosition.z) + 1.0f;
 

Modified: trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp        2012-05-28 
19:34:58 UTC (rev 2745)
+++ trunk/source/main/gfx/camera/CameraBehaviorFixed.cpp        2012-05-28 
20:01:26 UTC (rev 2746)
@@ -20,17 +20,12 @@
 #include "CameraBehaviorFixed.h"
 
 #include "Console.h"
-#include "DepthOfFieldEffect.h"
-#include "Language.h"
+#include "language.h"
 
 using namespace Ogre;
 
 void CameraBehaviorFixed::activate(const CameraManager::cameraContext_t &ctx, 
bool reset /* = true */)
 {
-       if ( ctx.mDof )
-       {
-               ctx.mDof->setFocusMode(DOFManager::Auto);
-       }
 #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

Modified: trunk/source/main/gfx/camera/CameraBehaviorFree.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-05-28 19:34:58 UTC 
(rev 2745)
+++ trunk/source/main/gfx/camera/CameraBehaviorFree.cpp 2012-05-28 20:01:26 UTC 
(rev 2746)
@@ -20,7 +20,6 @@
 #include "CameraBehaviorFree.h"
 
 #include "Console.h"
-#include "DepthOfFieldEffect.h"
 #include "IHeightFinder.h"
 #include "InputEngine.h"
 #include "Language.h"
@@ -101,7 +100,7 @@
 
        Vector3 camPosition = gEnv->mainCamera->getPosition() + 
gEnv->mainCamera->getOrientation() * mTrans.normalisedCopy() * mTransScale;
 
-       if ( gEnv->terrainManager->getHeightFinder() )
+       if ( gEnv->terrainManager && gEnv->terrainManager->getHeightFinder() )
        {
                float h = 
gEnv->terrainManager->getHeightFinder()->getHeightAt(camPosition.x, 
camPosition.z) + 1.0f;
 
@@ -127,10 +126,6 @@
 
 void CameraBehaviorFree::activate(const CameraManager::cameraContext_t &ctx, 
bool reset /* = true */)
 {
-       if ( ctx.mDof )
-       {
-               ctx.mDof->setFocusMode(DOFManager::Auto);
-       }
 #ifdef USE_MYGUI
        Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("free camera"), "camera_go.png", 3000);
 #endif // USE_MYGUI

Modified: trunk/source/main/gfx/camera/CameraBehaviorIsometric.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorIsometric.cpp    2012-05-28 
19:34:58 UTC (rev 2745)
+++ trunk/source/main/gfx/camera/CameraBehaviorIsometric.cpp    2012-05-28 
20:01:26 UTC (rev 2746)
@@ -20,17 +20,12 @@
 #include "CameraBehaviorIsometric.h"
 
 #include "Console.h"
-#include "DepthOfFieldEffect.h"
 #include "Language.h"
 
 using namespace Ogre;
 
 void CameraBehaviorIsometric::activate(const CameraManager::cameraContext_t 
&ctx, bool reset /* = true */)
 {
-       if ( ctx.mDof )
-       {
-               ctx.mDof->setFocusMode(DOFManager::Auto);
-       }
 #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

Modified: trunk/source/main/gfx/camera/CameraBehaviorStatic.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorStatic.cpp       2012-05-28 
19:34:58 UTC (rev 2745)
+++ trunk/source/main/gfx/camera/CameraBehaviorStatic.cpp       2012-05-28 
20:01:26 UTC (rev 2746)
@@ -45,7 +45,7 @@
        camPosition.z = ((int)(lookAt.z) / 100) * 100 + 50;
        camPosition.y =        lookAt.y;
 
-       if ( gEnv->terrainManager->getHeightFinder() )
+       if ( gEnv->terrainManager && gEnv->terrainManager->getHeightFinder() )
        {
                float h = 
gEnv->terrainManager->getHeightFinder()->getHeightAt(camPosition.x, 
camPosition.z);
 
@@ -63,7 +63,6 @@
 
        if ( ctx.mDof )
        {
-               ctx.mDof->setFocusMode(DOFManager::Manual);
                ctx.mDof->setFocus(camDist);
                ctx.mDof->setLensFOV(Radian(fov));
        }
@@ -72,6 +71,11 @@
 void CameraBehaviorStatic::activate(const CameraManager::cameraContext_t &ctx, 
bool reset /* = true */)
 {
        fovPreviously = gEnv->mainCamera->getFOVy();
+
+       if ( ctx.mDof )
+       {
+               ctx.mDof->setFocusMode(DOFManager::Manual);
+       }
 }
 
 void CameraBehaviorStatic::deactivate(const CameraManager::cameraContext_t 
&ctx)

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp      2012-05-28 
19:34:58 UTC (rev 2745)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp      2012-05-28 
20:01:26 UTC (rev 2746)
@@ -49,7 +49,7 @@
 
        camRatio = 1.0f / (ctx.mCurrTruck->tdt * 4.0f);
 
-       camDistMin = ctx.mCurrTruck->getMinimalCameraRadius() * 2.0f;
+       camDistMin = std::min(ctx.mCurrTruck->getMinimalCameraRadius() * 2.0f, 
33.0f);
 
        camLookAt = ctx.mCurrTruck->getPosition();
 
@@ -72,6 +72,6 @@
 {
        CameraBehaviorOrbit::reset(ctx);
        camRotY = 0.35f;
-       camDist = ctx.mCurrTruck->getMinimalCameraRadius() * 3.0f + 2.0f;
-       camDistMin = ctx.mCurrTruck->getMinimalCameraRadius() * 2.0f;
+       camDistMin = std::min(ctx.mCurrTruck->getMinimalCameraRadius() * 2.0f, 
33.0f);
+       camDist = ctx.mCurrTruck->getMinimalCameraRadius() * 1.5f + 2.0f;
 }

Modified: trunk/source/main/gfx/camera/CameraManager.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-28 19:34:58 UTC 
(rev 2745)
+++ trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-28 20:01:26 UTC 
(rev 2746)
@@ -20,6 +20,7 @@
 #include "CameraManager.h"
 
 #include "BeamFactory.h"
+#include "DepthOfFieldEffect.h"
 #include "InputEngine.h"
 #include "RoRFrameListener.h"
 #include "Settings.h"
@@ -55,6 +56,11 @@
        ctx.mCurrTruck = 0;
        ctx.mDof = dof;
        ctx.mOverlayWrapper = ow;
+
+       if ( ctx.mDof )
+       {
+               ctx.mDof->setFocusMode(DOFManager::Auto);
+       }
 }
 
 CameraManager::~CameraManager()

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to