Revision: 1444
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1444&view=rev
Author:   rorthomas
Date:     2010-07-13 22:42:00 +0000 (Tue, 13 Jul 2010)

Log Message:
-----------
improved "mainlight" problem in linux

Modified Paths:
--------------
    trunk/source/main/RoRFrameListener.cpp

Modified: trunk/source/main/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/RoRFrameListener.cpp      2010-07-13 22:29:56 UTC (rev 
1443)
+++ trunk/source/main/RoRFrameListener.cpp      2010-07-13 22:42:00 UTC (rev 
1444)
@@ -4801,7 +4801,18 @@
 
        float fogstart = 0;
 
+
+       Light *mainLight = 0;
 #ifdef USE_CAELUM
+       if(!useCaelum)
+               mainLight = mSceneMgr->getLight("MainLight");
+       else
+               mainLight = SkyManager::getSingleton().getMainLight();
+#else // USE_CAELUM
+       mainLight = mSceneMgr->getLight("MainLight");
+#endif // USE_CAELUM
+
+#ifdef USE_CAELUM
        //Caelum skies
        bool useCaelum = SETTINGS.getSetting("Sky effects")=="Caelum (best 
looking, slower)";
        if (useCaelum)
@@ -4822,24 +4833,14 @@
 //                     fogstart = 
StringConverter::parseLong(SETTINGS.getSetting("Sandstorm Fog Start"));
 
                // Create a light
-               Light* l = 0;
-
-#ifdef USE_CAELUM
-               if(!useCaelum)
-                       l = mSceneMgr->getLight("MainLight");
-               else
-                       l = SkyManager::getSingleton().getMainLight();
-#else // USE_CAELUM
-               l = mSceneMgr->getLight("MainLight");
-#endif // USE_CAELUM
-               if(l)
+               if(mainLight)
                {
                        //directional light for shadow
-                       l->setType(Light::LT_DIRECTIONAL);
-                       l->setDirection(0.785, -0.423, 0.453);
+                       mainLight->setType(Light::LT_DIRECTIONAL);
+                       mainLight->setDirection(0.785, -0.423, 0.453);
 
-                       l->setDiffuseColour(fadeColour);
-                       l->setSpecularColour(fadeColour);
+                       mainLight->setDiffuseColour(fadeColour);
+                       mainLight->setSpecularColour(fadeColour);
                }
 
                mCamera->setFarClipDistance( farclip*1.733 );
@@ -4918,17 +4919,7 @@
                        bool mTerrainsImported=false;
                        TerrainPaging* mTerrainPaging=0;
                        PageManager* mPageManager=0;
-                       Light* l = 0;
 
-#ifdef USE_CAELUM
-                       if(!useCaelum)
-                               l = mSceneMgr->getLight("MainLight");
-                       else
-                               l = SkyManager::getSingleton().getMainLight();
-#else // USE_CAELUM
-                       l = mSceneMgr->getLight("MainLight");
-#endif // USE_CAELUM
-
                        Vector3 mTerrainPos(0,0,0);
                        mTerrainGroup = OGRE_NEW TerrainGroup(mSceneMgr, 
Terrain::ALIGN_X_Z, TERRAIN_SIZE, TERRAIN_WORLD_SIZE);
                        
mTerrainGroup->setFilenameConvention(TERRAIN_FILE_PREFIX, TERRAIN_FILE_SUFFIX);
@@ -4945,10 +4936,10 @@
 
                        //matProfile->setLightmapEnabled(false);
                        // Important to set these so that the terrain knows 
what to use for derived (non-realtime) data
-                       if(l) 
TerrainGlobalOptions::getSingleton().setLightMapDirection(l->getDerivedDirection());
+                       if(mainLight) 
TerrainGlobalOptions::getSingleton().setLightMapDirection(mainLight->getDerivedDirection());
                        
TerrainGlobalOptions::getSingleton().setCompositeMapAmbient(mSceneMgr->getAmbientLight());
                        
//mTerrainGlobals->setCompositeMapAmbient(ColourValue::Red);
-                       if(l) 
TerrainGlobalOptions::getSingleton().setCompositeMapDiffuse(l->getDiffuseColour());
+                       if(mainLight) 
TerrainGlobalOptions::getSingleton().setCompositeMapDiffuse(mainLight->getDiffuseColour());
 
                        // Configure default import settings for if we use 
imported image
                        Terrain::ImportData& defaultimp = 
mTerrainGroup->getDefaultImportSettings();


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to