void OgreSetup::Config_ogreLogChanged(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_string()) { auto string = variable.as_string(); if (string == "low") { Ogre::LogManager::getSingleton().getDefaultLog()->setLogDetail(Ogre::LL_LOW); } else if (string == "normal") { Ogre::LogManager::getSingleton().getDefaultLog()->setLogDetail(Ogre::LL_NORMAL); } else if (string == "boreme") { Ogre::LogManager::getSingleton().getDefaultLog()->setLogDetail(Ogre::LL_BOREME); } } }
void LodLevelManager::Config_LodBias(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_double()) { Ogre::Real lodBias = static_cast<double>(variable); setLodBiasAll(lodBias / 100.0f); } }
void FoliageDetailManager::Config_FoliageDensity(const std::string&, const std::string&, varconf::Variable& variable) { if (variable.is_double()) { float density = static_cast<double>(variable); setFoliageDensity(density / 100); } }
void FoliageDetailManager::Config_FoliageFarDistance(const std::string&, const std::string&, varconf::Variable& variable) { if (variable.is_double()) { float distanceFactor = static_cast<double>(variable); setFoliageDistance(distanceFactor / 100); } }
void AutomaticGraphicsLevelManager::Config_Enabled(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_bool() && static_cast<bool>(variable)) { setEnabled(true); } else { setEnabled(false); } }
void AuthoringManager::config_AuthoringVisualizations(const std::string& section, const std::string&, varconf::Variable& variable) { if (variable.is_bool()) { if (static_cast<bool> (variable)) { displayAuthoringVisualization(); } else { hideAuthoringVisualization(); } } }
void CaelumSky::Config_CloudSpeed(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_string() && mCaelumSystem->getCloudSystem()) { Ogre::Vector2 vector; Tokeniser tokeniser(variable); vector.x = atof(tokeniser.nextToken().c_str()); vector.y = atof(tokeniser.nextToken().c_str()); mCaelumSystem->getCloudSystem()->getLayer(0)->setCloudSpeed(vector); } }
void MainCamera::Config_Compositors(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_string()) { const std::vector<std::string> tokens = Tokeniser::split(variable.as_string(), ","); for (std::vector<std::string>::const_iterator I = tokens.begin(); I != tokens.end(); ++I) { enableCompositor(*I, true); } std::vector<std::string> compositorsToDisable; for (CompositorNameStore::const_iterator I = mLoadedCompositors.begin(); I != mLoadedCompositors.end(); ++I) { if (std::find(tokens.begin(), tokens.end(), *I) == tokens.end()) { compositorsToDisable.push_back(*I); } } for (std::vector<std::string>::const_iterator I = compositorsToDisable.begin(); I != compositorsToDisable.end(); ++I) { enableCompositor(*I, false); } } }
void ShadowCameraSetup::Config_ShadowSplitPadding(const std::string& section, const std::string& key, varconf::Variable& variable) { try { if (variable.is_double()) { S_LOG_VERBOSE("Setting shadow split padding: " << static_cast<double>(variable)); mPssmSetup->setSplitPadding(static_cast<double>(variable)); } } catch (const std::exception& ex) { S_LOG_FAILURE("Error when setting shadow split padding." << ex); } }
void ShadowCameraSetup::Config_ShadowUseAggressiveFocusRegion(const std::string& section, const std::string& key, varconf::Variable& variable) { try { if (variable.is_bool()) { S_LOG_VERBOSE("Setting shadow use aggressive focus region: " << static_cast<bool>(variable)); mPssmSetup->setUseAggressiveFocusRegion(static_cast<bool>(variable)); } } catch (const std::exception& ex) { S_LOG_FAILURE("Error when setting shadow use aggressive focus region." << ex); } }
void ShadowCameraSetup::Config_ShadowFarDistance(const std::string& section, const std::string& key, varconf::Variable& variable) { try { if (variable.is_double()) { S_LOG_VERBOSE("Setting shadow far distance: " << static_cast<double>(variable)); mSceneMgr.setShadowFarDistance(static_cast<double>(variable)); } } catch (const std::exception& ex) { S_LOG_FAILURE("Error when setting shadow far distance." << ex); } }
void ShadowCameraSetup::Config_ShadowTextureSize(const std::string& section, const std::string& key, varconf::Variable& variable) { try { if (variable.is_int()) { S_LOG_VERBOSE("Setting shadow texture size: " << static_cast<int>(variable)); mSceneMgr.setShadowTextureSize(static_cast<int>(variable)); } } catch (const std::exception& ex) { S_LOG_FAILURE("Error when setting shadow texture size." << ex); } }
void AutomaticGraphicsLevelManager::Config_DefaultFps(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_double()) { int fps = static_cast<double>(variable); //If set to 0, the fps the manager tries to achieve is 60 if (fps == 0.0f) { fps = 60.0f; } mDefaultFps = fps; } }
bool CaelumSun::parse(varconf::Variable& variable, Ogre::ColourValue& colour) { if (variable.is_string()) { Tokeniser tokeniser(variable); colour.r = atof(tokeniser.nextToken().c_str()); colour.g = atof(tokeniser.nextToken().c_str()); colour.b = atof(tokeniser.nextToken().c_str()); colour.a = atof(tokeniser.nextToken().c_str()); return true; } return false; }
void ShadowCameraSetup::Config_ShadowRenderBackfaces(const std::string& section, const std::string& key, varconf::Variable& variable) { try { if (variable.is_bool()) { S_LOG_VERBOSE("Setting shadow render back faces: " << static_cast<bool>(variable)); mSceneMgr.setShadowCasterRenderBackFaces(static_cast<bool>(variable)); } } catch (const std::exception& ex) { S_LOG_FAILURE("Error when setting shadow render back faces." << ex); } }
void Config_DesiredFps(const std::string& section, const std::string& key, varconf::Variable& variable) { //Check for double, but cast to int. That way we'll catch all numbers. if (variable.is_double()) { mDesiredFps = static_cast<int>(variable); if (mDesiredFps != 0) { mMicrosecondsPerFrame = 1000000L / mDesiredFps; } else { mMicrosecondsPerFrame = 0; } } }
void ShadowCameraSetup::Config_ShadowOptimalAdjustFactors(const std::string& section, const std::string& key, varconf::Variable& variable) { try { if (variable.is_string()) { S_LOG_VERBOSE("Setting shadow optimal adjust factor: " << static_cast<std::string>(variable)); Tokeniser tokeniser(variable); mPssmSetup->setOptimalAdjustFactor(0, atof(tokeniser.nextToken().c_str())); mPssmSetup->setOptimalAdjustFactor(1, atof(tokeniser.nextToken().c_str())); mPssmSetup->setOptimalAdjustFactor(2, atof(tokeniser.nextToken().c_str())); } } catch (const std::exception& ex) { S_LOG_FAILURE("Error when setting shadow optimal adjust factors." << ex); } }
void Input::Config_CatchMouse(const std::string& section, const std::string& key, varconf::Variable& variable) { try { if (variable.is_bool()) { bool enabled = static_cast<bool> (variable); if (enabled) { mMouseGrabbingRequested = true; } else { setMouseGrab(false); } } } catch (const std::exception& ex) { S_LOG_FAILURE("Error when changing mouse grabbing." << ex); } }
void ShadowCameraSetup::Config_ShadowSplitPoints(const std::string& section, const std::string& key, varconf::Variable& variable) { try { if (variable.is_string()) { Ogre::PSSMShadowCameraSetup::SplitPointList splitPointList = mPssmSetup->getSplitPoints(); Tokeniser tokeniser(variable); splitPointList[0] = atof(tokeniser.nextToken().c_str()); splitPointList[1] = atof(tokeniser.nextToken().c_str()); splitPointList[2] = atof(tokeniser.nextToken().c_str()); splitPointList[3] = atof(tokeniser.nextToken().c_str()); S_LOG_VERBOSE("Setting shadow split points: " << splitPointList[0] << " " << splitPointList[1] << " " << splitPointList[2] << " " << splitPointList[3]); mPssmSetup->setSplitPoints(splitPointList); } } catch (const std::exception& ex) { S_LOG_FAILURE("Error when setting shadow split points." << ex); } }
void World::Config_Foliage(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_bool() && static_cast<bool>(variable)) { if (!mFoliage) { //create the foliage mFoliage = new Environment::Foliage(*mTerrainManager); EventFoliageCreated.emit(); mFoliageInitializer = new DelayedFoliageInitializer(*mFoliage, mView, 1000, 15000); } } else { delete mFoliage; mFoliage = 0; delete mFoliageInitializer; mFoliageInitializer = 0; } }
void World::Config_Foliage(const std::string& section, const std::string& key, varconf::Variable& variable, GraphicalChangeAdapter& graphicalChangeAdapter) { if (variable.is_bool() && static_cast<bool>(variable)) { if (!mFoliage) { //create the foliage mFoliage = new Environment::Foliage(*mTerrainManager); EventFoliageCreated.emit(); mFoliageInitializer = new DelayedFoliageInitializer(sigc::bind(sigc::mem_fun(*this, &World::initializeFoliage), sigc::ref(graphicalChangeAdapter)), mView, 1000, 15000); } } else { delete mFoliageDetailManager; mFoliageDetailManager = 0; delete mFoliageInitializer; mFoliageInitializer = 0; delete mFoliage; mFoliage = 0; } }
void MainCamera::Config_ClipDistances(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_string()) { Tokeniser tokeniser(variable); float nearDistance = atof(tokeniser.nextToken().c_str()); float farDistance = atof(tokeniser.nextToken().c_str()); S_LOG_INFO("Setting main camera clip distances to near: " << nearDistance << " far: " << farDistance); mCamera.setNearClipDistance(nearDistance); //set the far clip distance high to make sure that the sky is completely shown if (Ogre::Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_INFINITE_FAR_PLANE)) { /* //NOTE: this won't currently work with the sky mCamera.setFarClipDistance(0);*/ mCamera.setFarClipDistance(farDistance); } else { mCamera.setFarClipDistance(farDistance); } } }
void CameraSettings::Config_DegreesPerMouseUnit(const std::string& /*section*/, const std::string& /*key*/, varconf::Variable& variable) { if (variable.is_double()) { mDegreesPerMouseUnit = static_cast<double>(variable); } }
void CaelumSky::Config_CloudCover(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_double() && mCaelumSystem->getCloudSystem()) { mCaelumSystem->getCloudSystem()->getLayer(0)->setCloudCover(static_cast<double>(variable)); } }
void AvatarTerrainCursor::Config_TerrainCheckInterval(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_int()) { mUpdatePositionThreshold = static_cast<unsigned int>(static_cast<int>(variable)); } }
void ShaderManager::Config_Level(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_string()) { setGraphicsLevel (getLevelByName(std::string (variable)));} }
void CursorWorldListener::Config_ClickThreshold(const std::string& section, const std::string& key, varconf::Variable& variable) { if (variable.is_int()) { mClickThresholdMilliseconds = static_cast<int>(variable); } }
void CameraSettings::Config_InvertCamera(const std::string& /*section*/, const std::string& /*key*/, varconf::Variable& variable) { if (variable.is_bool()) { mInvertCamera = static_cast<bool>(variable); } }