// 从场景管理器读取环境设置 void EnvironmentObject::_getEnvironment() { SceneManager *mgr = m_scene->getOgreSceneManager(); // 天空盒设置 m_skyBoxEnabled = mgr->isSkyBoxEnabled(); // 是否开启天空盒 //m_skyBoxMaterialName; // 天空盒纹理 m_skyBoxRenderDistance = 50.0f; // 渲染距离 // 雾化设置 m_fogMode = mgr->getFogMode(); // 雾化方式 m_fogColor = mgr->getFogColour(); // 雾化颜色 m_fogDensity = mgr->getFogDensity(); // 雾化密度 m_fogStart = mgr->getFogStart(); // 雾化开始距离 m_fogEnd = mgr->getFogEnd(); // 雾化结束距离 // 光照设置 m_ambientLight = mgr->getAmbientLight(); // 环境光颜色 }
void ManipulatorEffect::Serialize( rapidxml::xml_document<>* doc, rapidxml::xml_node<>* XMLNode ) { using namespace Ogre; const Kratos::SEffectConfig& cfg = RenderManager.GetEffectConfig(); SceneManager* sm = RenderManager.m_pSceneMgr; const String strAmbient = StringConverter::toString(sm->getAmbientLight()); const String strShadowOn = StringConverter::toString(cfg.bShadow); //shadow param rapidxml::xml_node<>* shadowNode = doc->allocate_node(rapidxml::node_element, "shadow"); shadowNode->append_attribute(doc->allocate_attribute("AmbientLight", doc->allocate_string(strAmbient.c_str()))); shadowNode->append_attribute(doc->allocate_attribute("EnableShadow", doc->allocate_string(strShadowOn.c_str()))); Kratos::ShadowParams& shadowParams = RenderManager.GetShadowParams(); for(auto iter=shadowParams.begin(); iter!=shadowParams.end(); ++iter) shadowNode->append_attribute(doc->allocate_attribute(iter->first.c_str(), iter->second.c_str())); XMLNode->append_node(shadowNode); //ssao param const String strSsaoOn = StringConverter::toString(cfg.bSSAO); rapidxml::xml_node<>* ssaoNode = doc->allocate_node(rapidxml::node_element, "ssao"); ssaoNode->append_attribute(doc->allocate_attribute("EnableSSAO", doc->allocate_string(strSsaoOn.c_str()))); Kratos::SsaoParams& ssaoParams = RenderManager.GetSsaoParams(); for(auto iter=ssaoParams.begin(); iter!=ssaoParams.end(); ++iter) ssaoNode->append_attribute(doc->allocate_attribute(iter->first.c_str(), iter->second.c_str())); XMLNode->append_node(ssaoNode); //sharpen rapidxml::xml_node<>* sharpenNode = doc->allocate_node(rapidxml::node_element, "sharpen"); const String strSharpenEnable = StringConverter::toString(GetSharpenEnable()); sharpenNode->append_attribute(doc->allocate_attribute("EnableSharpen", doc->allocate_string(strSharpenEnable.c_str()))); XMLNode->append_node(sharpenNode); //fxaa rapidxml::xml_node<>* fxaaNode = doc->allocate_node(rapidxml::node_element, "fxaa"); const String strFXAAEnable = StringConverter::toString(GetFXAAEnable()); fxaaNode->append_attribute(doc->allocate_attribute("EnableFXAA", doc->allocate_string(strFXAAEnable.c_str()))); XMLNode->append_node(fxaaNode); ///保存所有单位的挂接特效信息 for (auto itTmpl=m_effectTemplates.begin(); itTmpl!=m_effectTemplates.end(); ++itTmpl) { Kratos::EffectController* pCtrl = itTmpl->second; const auto& effects = pCtrl->_GetEffects(); SUnitData* unitData = ManipulatorSystem.GetGameData().GetUnitData(itTmpl->first); unitData->m_effects.clear(); for (auto itAnim=effects.begin(); itAnim!=effects.end(); ++itAnim) { const auto& slots = itAnim->second; for (auto itEffect=slots.begin(); itEffect!=slots.end(); ++itEffect) { Kratos::AttachEffectBase* effect = *itEffect; const Ogre::ParameterList& attributes = effect->getParameters(); SEffectData data; SaveStringInterface(effect, data.params); unitData->m_effects[itAnim->first].push_back(data); } } } }