From 798d367d54a6c6379ad355bd8345fa40e31e7fe9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 6 Sep 2008 18:24:57 -0500 Subject: Second Life viewer sources 1.21.0-RC --- linden/indra/newview/llwlparammanager.cpp | 50 ++++++++++++++++--------------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'linden/indra/newview/llwlparammanager.cpp') diff --git a/linden/indra/newview/llwlparammanager.cpp b/linden/indra/newview/llwlparammanager.cpp index 9f23b37..1707fe9 100644 --- a/linden/indra/newview/llwlparammanager.cpp +++ b/linden/indra/newview/llwlparammanager.cpp @@ -104,16 +104,16 @@ LLWLParamManager::~LLWLParamManager() { } -void LLWLParamManager::loadPresets(const LLString& file_name) +void LLWLParamManager::loadPresets(const std::string& file_name) { // if fileName exists, use legacy loading form the big file, otherwise, search the sky // directory, and add the list if(file_name != "") { - LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", file_name)); + std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", file_name)); LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL; - llifstream presetsXML(path_name.c_str()); + llifstream presetsXML(path_name); if (presetsXML) { @@ -136,7 +136,7 @@ void LLWLParamManager::loadPresets(const LLString& file_name) // otherwise, search the sky directory and find things there else { - LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); + std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL; //mParamList.clear(); @@ -161,10 +161,10 @@ void LLWLParamManager::loadPresets(const LLString& file_name) // not much error checking here since we're getting rid of this std::string sky_name = unescaped_name.substr(0, unescaped_name.size() - 4); - LLString cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", name)); + std::string cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", name)); LL_DEBUGS2("AppInit", "Shaders") << "Loading sky from " << cur_path << LL_ENDL; - std::ifstream sky_xml(cur_path.c_str()); + llifstream sky_xml(cur_path); if (sky_xml) { LLSD sky_data(LLSD::emptyMap()); @@ -172,17 +172,18 @@ void LLWLParamManager::loadPresets(const LLString& file_name) parser->parse(sky_xml, sky_data, LLSDSerialize::SIZE_UNLIMITED); addParamSet(sky_name, sky_data); + sky_xml.close(); } } } } } -void LLWLParamManager::savePresets(const LLString & fileName) +void LLWLParamManager::savePresets(const std::string & fileName) { LLSD paramsData(LLSD::emptyMap()); - LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", fileName)); + std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", fileName)); for(std::map::iterator mIt = mParamList.begin(); mIt != mParamList.end(); @@ -191,7 +192,7 @@ void LLWLParamManager::savePresets(const LLString & fileName) paramsData[mIt->first] = mIt->second.getAll(); } - std::ofstream presetsXML(pathName.c_str()); + llofstream presetsXML(pathName); LLPointer formatter = new LLSDXMLFormatter(); @@ -200,7 +201,7 @@ void LLWLParamManager::savePresets(const LLString & fileName) presetsXML.close(); } -void LLWLParamManager::loadPreset(const LLString & name) +void LLWLParamManager::loadPreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); @@ -213,7 +214,7 @@ void LLWLParamManager::loadPreset(const LLString & name) std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); llinfos << "Loading WindLight sky setting from " << pathName << llendl; - std::ifstream presetsXML(pathName.c_str()); + llifstream presetsXML(pathName); if (presetsXML) { @@ -232,6 +233,7 @@ void LLWLParamManager::loadPreset(const LLString & name) { setParamSet(name, paramsData); } + presetsXML.close(); } else { @@ -244,7 +246,7 @@ void LLWLParamManager::loadPreset(const LLString & name) propagateParameters(); } -void LLWLParamManager::savePreset(const LLString & name) +void LLWLParamManager::savePreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); @@ -262,7 +264,7 @@ void LLWLParamManager::savePreset(const LLString & name) paramsData = mParamList[name].getAll(); // write to file - std::ofstream presetsXML(pathName.c_str()); + llofstream presetsXML(pathName); LLPointer formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); @@ -279,13 +281,13 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) { - shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV); + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV); shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV); } else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) { - shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, mClampedLightDir.mV); + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mClampedLightDir.mV); } shader->uniform1f("scene_light_strength", mSceneLightStrength); @@ -343,9 +345,9 @@ void LLWLParamManager::propagateParameters(void) mCurParams.set("lightnorm", mLightDir); // bind the variables for all shaders only if we're using WindLight - LLShaderMgr::shader_iter shaders_iter, end_shaders; - end_shaders = LLShaderMgr::endShaders(); - for(shaders_iter = LLShaderMgr::beginShaders(); shaders_iter != end_shaders; ++shaders_iter) + LLViewerShaderMgr::shader_iter shaders_iter, end_shaders; + end_shaders = LLViewerShaderMgr::instance()->endShaders(); + for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter) { if (shaders_iter->mProgramObject != 0 && (gPipeline.canUseWindLightShaders() @@ -406,9 +408,9 @@ void LLWLParamManager::update(LLViewerCamera * cam) lightNorm3 *= LLQuaternion(-(camYaw + camYawDelta), LLVector3(0.f, 1.f, 0.f)); mRotatedLightDir = LLVector4(lightNorm3, 0.f); - LLShaderMgr::shader_iter shaders_iter, end_shaders; - end_shaders = LLShaderMgr::endShaders(); - for(shaders_iter = LLShaderMgr::beginShaders(); shaders_iter != end_shaders; ++shaders_iter) + LLViewerShaderMgr::shader_iter shaders_iter, end_shaders; + end_shaders = LLViewerShaderMgr::instance()->endShaders(); + for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter) { if (shaders_iter->mProgramObject != 0 && (gPipeline.canUseWindLightShaders() @@ -531,7 +533,7 @@ bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_ if(delete_from_disk) { - LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); + std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); // use full curl escaped name char * curl_str = curl_escape(name.c_str(), name.size()); @@ -553,10 +555,10 @@ LLWLParamManager * LLWLParamManager::instance() { sInstance = new LLWLParamManager(); - sInstance->loadPresets(""); + sInstance->loadPresets(LLStringUtil::null); // load the day - sInstance->mDay.loadDayCycle("Default.xml"); + sInstance->mDay.loadDayCycle(std::string("Default.xml")); // *HACK - sets cloud scrolling to what we want... fix this better in the future sInstance->getParamSet("Default", sInstance->mCurParams); -- cgit v1.1