Revision: 2649 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2649&view=rev Author: rorthomas Date: 2012-05-24 15:38:37 +0000 (Thu, 24 May 2012) Log Message: ----------- moved terrain optimizations to config file
Modified Paths: -------------- trunk/source/main/gameplay/TerrainManager.cpp Modified: trunk/source/main/gameplay/TerrainManager.cpp =================================================================== --- trunk/source/main/gameplay/TerrainManager.cpp 2012-05-24 14:30:25 UTC (rev 2648) +++ trunk/source/main/gameplay/TerrainManager.cpp 2012-05-24 15:38:37 UTC (rev 2649) @@ -157,55 +157,21 @@ if (!terrainConfig.getSetting("maxBatchSize").empty()) defaultimp.maxBatchSize = PARSEINT(terrainConfig.getSetting("maxBatchSize")); - /* - // testing composite map + // optimizations + TerrainMaterialGeneratorA::SM2Profile* matProfile = static_cast<TerrainMaterialGeneratorA::SM2Profile*>(terrainOptions->getDefaultMaterialGenerator()->getActiveProfile()); + matProfile->setLightmapEnabled(StringConverter::parseBool(terrainConfig.getSetting("LightmapEnabled"))); + matProfile->setLayerNormalMappingEnabled(StringConverter::parseBool(terrainConfig.getSetting("NormalMappingEnabled"))); + matProfile->setLayerSpecularMappingEnabled(StringConverter::parseBool(terrainConfig.getSetting("SpecularMappingEnabled"))); + matProfile->setLayerParallaxMappingEnabled(StringConverter::parseBool(terrainConfig.getSetting("ParallaxMappingEnabled"))); + matProfile->setGlobalColourMapEnabled(StringConverter::parseBool(terrainConfig.getSetting("GlobalColourMapEnabled"))); + matProfile->setReceiveDynamicShadowsDepth(StringConverter::parseBool(terrainConfig.getSetting("ReceiveDynamicShadowsDepth"))); + terrainOptions->setCompositeMapSize(PARSEINT(terrainConfig.getSetting("CompositeMapSize"))); + terrainOptions->setCompositeMapDistance(PARSEINT(terrainConfig.getSetting("CompositeMapDistance"))); + terrainOptions->setSkirtSize(PARSEINT(terrainConfig.getSetting("SkirtSize"))); + terrainOptions->setLightMapSize(PARSEINT(terrainConfig.getSetting("LightMapSize"))); + terrainOptions->setCastsDynamicShadows(PARSEINT(terrainConfig.getSetting("CastsDynamicShadows"))); - - - // Configure default import settings for if we use imported image - Terrain::ImportData& defaultimp = mTerrainGroup->getDefaultImportSettings(); - defaultimp.terrainSize = pageSize; - defaultimp.worldSize = mapsizex; - - //TerrainGlobalOptions::getSingleton().setDefaultGlobalColourMapSize(pageSize); - - if (mCamera->getFarClipDistance() == 0) - TerrainGlobalOptions::getSingleton().setCompositeMapDistance(1000.0f); - else - TerrainGlobalOptions::getSingleton().setCompositeMapDistance(std::min(1000.0f, mCamera->getFarClipDistance())); - - //terrainOptions->setUseRayBoxDistanceCalculation(true); - - // adds strange colours for debug purposes - //TerrainGlobalOptions::getSingleton().getDefaultMaterialGenerator()->setDebugLevel(1); - - // TBD: optimizations - TerrainMaterialGeneratorA::SM2Profile* matProfile = static_cast<TerrainMaterialGeneratorA::SM2Profile*>(TerrainGlobalOptions::getSingleton().getDefaultMaterialGenerator()->getActiveProfile()); - matProfile->setLightmapEnabled(true); - //matProfile->setLayerNormalMappingEnabled(false); - //matProfile->setLayerSpecularMappingEnabled(false); - //matProfile->setLayerParallaxMappingEnabled(false); - - matProfile->setGlobalColourMapEnabled(false); - matProfile->setReceiveDynamicShadowsDepth(true); - - - TerrainGlobalOptions::getSingleton().setCompositeMapSize(1024); - //TerrainGlobalOptions::getSingleton().setCompositeMapDistance(100); - TerrainGlobalOptions::getSingleton().setSkirtSize(1); - TerrainGlobalOptions::getSingleton().setLightMapSize(256); - TerrainGlobalOptions::getSingleton().setCastsDynamicShadows(true); - - // Important to set these so that the terrain knows what to use for derived (non-realtime) data - Light *mainLight = SkyManager::getSingleton().getMainLight(); - if (mainLight) TerrainGlobalOptions::getSingleton().setLightMapDirection(mainLight->getDerivedDirection()); - TerrainGlobalOptions::getSingleton().setCompositeMapAmbient(mSceneMgr->getAmbientLight()); - //terrainOptions->setCompositeMapAmbient(ColourValue::Red); - if (mainLight) TerrainGlobalOptions::getSingleton().setCompositeMapDiffuse(mainLight->getDiffuseColour()); - */ - - // load the textures and blendmaps into our data structures blendMaps.clear(); blendMode.clear(); 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