From ff85006e7159aa808c23bd02f9fb83d24b277da0 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 30 Mar 2012 18:38:33 +0200 Subject: [PATCH 01/12] added untested interface --- components/CMakeLists.txt | 4 ++ components/settings/settings.cpp | 64 ++++++++++++++++++++++++++++++++ components/settings/settings.hpp | 35 +++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 components/settings/settings.cpp create mode 100644 components/settings/settings.hpp diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index c95efb37d..b48c50640 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -2,6 +2,10 @@ project (Components) # source files +add_component_dir (settings + settings + ) + add_component_dir (bsa bsa_archive bsa_file ) diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp new file mode 100644 index 000000000..157de0b4d --- /dev/null +++ b/components/settings/settings.cpp @@ -0,0 +1,64 @@ +#include "settings.hpp" + +#include + +#include +#include + +using namespace Settings; + +Ogre::ConfigFile Manager::mFile = Ogre::ConfigFile(); +Ogre::ConfigFile Manager::mDefaultFile = Ogre::ConfigFile(); + +void Manager::load(const std::string& file) +{ + mFile.load(file); +} + +void Manager::loadDefault(const std::string& file) +{ + mDefaultFile.load(file); +} + +void Manager::save(const std::string& file) +{ + std::fstream fout(file.c_str(), std::ios::out); + + Ogre::ConfigFile::SectionIterator seci = mFile.getSectionIterator(); + + while (seci.hasMoreElements()) + { + Ogre::String sectionName = seci.peekNextKey(); + + if (sectionName.length() > 0) + fout << '\n' << '[' << seci.peekNextKey() << ']' << '\n'; + + Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); + Ogre::ConfigFile::SettingsMultiMap::iterator i; + for (i = settings->begin(); i != settings->end(); ++i) + { + fout << i->first.c_str() << '=' << i->second.c_str() << '\n'; + } + } +} + +const std::string Manager::getString (const std::string& setting, const std::string& category) +{ + std::string defaultval = mDefaultFile.getSetting(setting, category); + return mFile.getSetting(setting, category, defaultval); +} + +const float Manager::getFloat (const std::string& setting, const std::string& category) +{ + return Ogre::StringConverter::parseReal( getString(setting, category) ); +} + +const int Manager::getInt (const std::string& setting, const std::string& category) +{ + return Ogre::StringConverter::parseInt( getString(setting, category) ); +} + +const bool Manager::getBool (const std::string& setting, const std::string& category) +{ + return Ogre::StringConverter::parseBool( getString(setting, category) ); +} diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp new file mode 100644 index 000000000..ae6f1a9de --- /dev/null +++ b/components/settings/settings.hpp @@ -0,0 +1,35 @@ +#ifndef _COMPONENTS_SETTINGS_H +#define _COMPONENTS_SETTINGS_H + +#include + +namespace Settings +{ + + /// + /// \brief Settings management (can change during runtime) + /// + class Manager + { + public: + static Ogre::ConfigFile mFile; + static Ogre::ConfigFile mDefaultFile; + + void loadDefault (const std::string& file); + ///< load file as the default settings (can be overridden by user settings) + + void load (const std::string& file); + ///< load file as user settings + + void save (const std::string& file); + ///< save to file + + static const int getInt (const std::string& setting, const std::string& category); + static const float getFloat (const std::string& setting, const std::string& category); + static const std::string getString (const std::string& setting, const std::string& category); + static const bool getBool (const std::string& setting, const std::string& category); + }; + +} + +#endif // _COMPONENTS_SETTINGS_H From 82429d69316ae8c12c6633d414aadbfec2e694f4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 31 Mar 2012 13:35:40 +0200 Subject: [PATCH 02/12] finished interface --- components/settings/settings.cpp | 42 +++++++++++++++++++++++++++++--- components/settings/settings.hpp | 14 ++++++++--- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index 157de0b4d..500d3c6e6 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -10,17 +10,22 @@ using namespace Settings; Ogre::ConfigFile Manager::mFile = Ogre::ConfigFile(); Ogre::ConfigFile Manager::mDefaultFile = Ogre::ConfigFile(); -void Manager::load(const std::string& file) +void Manager::loadUser (const std::string& file) { mFile.load(file); } -void Manager::loadDefault(const std::string& file) +void Manager::loadDefault (const std::string& file) { mDefaultFile.load(file); } -void Manager::save(const std::string& file) +void Manager::copyDefaultToUserSettings () +{ + mFile = mDefaultFile; +} + +void Manager::saveUser(const std::string& file) { std::fstream fout(file.c_str(), std::ios::out); @@ -39,6 +44,8 @@ void Manager::save(const std::string& file) { fout << i->first.c_str() << '=' << i->second.c_str() << '\n'; } + + seci.getNext(); } } @@ -62,3 +69,32 @@ const bool Manager::getBool (const std::string& setting, const std::string& cate { return Ogre::StringConverter::parseBool( getString(setting, category) ); } + +void Manager::setString (const std::string& setting, const std::string& category, const std::string& value) +{ + Ogre::ConfigFile::SettingsIterator it = mFile.getSettingsIterator(category); + while (it.hasMoreElements()) + { + Ogre::ConfigFile::SettingsMultiMap::iterator i = it.current(); + + if ((*i).first == setting) + (*i).second = value; + + it.getNext(); + } +} + +void Manager::setInt (const std::string& setting, const std::string& category, const int value) +{ + setString(setting, category, Ogre::StringConverter::toString(value)); +} + +void Manager::setFloat (const std::string& setting, const std::string& category, const float value) +{ + setString(setting, category, Ogre::StringConverter::toString(value)); +} + +void Manager::setBool (const std::string& setting, const std::string& category, const bool value) +{ + setString(setting, category, Ogre::StringConverter::toString(value)); +} diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp index ae6f1a9de..46f8139c4 100644 --- a/components/settings/settings.hpp +++ b/components/settings/settings.hpp @@ -18,16 +18,24 @@ namespace Settings void loadDefault (const std::string& file); ///< load file as the default settings (can be overridden by user settings) - void load (const std::string& file); + void copyDefaultToUserSettings (); + ///< copy the default settings to the user settings (useful when there are no user settings yet) + + void loadUser (const std::string& file); ///< load file as user settings - void save (const std::string& file); - ///< save to file + void saveUser (const std::string& file); + ///< save user settings to file static const int getInt (const std::string& setting, const std::string& category); static const float getFloat (const std::string& setting, const std::string& category); static const std::string getString (const std::string& setting, const std::string& category); static const bool getBool (const std::string& setting, const std::string& category); + + static void setInt (const std::string& setting, const std::string& category, const int value); + static void setFloat (const std::string& setting, const std::string& category, const float value); + static void setString (const std::string& setting, const std::string& category, const std::string& value); + static void setBool (const std::string& setting, const std::string& category, const bool value); }; } From 308df7caa8806f344a7e32f02b9b1114b433b791 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 1 Apr 2012 16:26:42 +0200 Subject: [PATCH 03/12] add method for keeping track of settings that changed --- components/settings/settings.cpp | 13 ++++++++++++- components/settings/settings.hpp | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index 500d3c6e6..463230bc7 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -9,6 +9,7 @@ using namespace Settings; Ogre::ConfigFile Manager::mFile = Ogre::ConfigFile(); Ogre::ConfigFile Manager::mDefaultFile = Ogre::ConfigFile(); +SettingCategoryVector Manager::mChangedSettings = SettingCategoryVector(); void Manager::loadUser (const std::string& file) { @@ -77,8 +78,11 @@ void Manager::setString (const std::string& setting, const std::string& category { Ogre::ConfigFile::SettingsMultiMap::iterator i = it.current(); - if ((*i).first == setting) + if ((*i).first == setting && (*i).second != value) + { + mChangedSettings.push_back(std::make_pair(setting, category)); (*i).second = value; + } it.getNext(); } @@ -98,3 +102,10 @@ void Manager::setBool (const std::string& setting, const std::string& category, { setString(setting, category, Ogre::StringConverter::toString(value)); } + +const SettingCategoryVector Manager::apply() +{ + SettingCategoryVector vec = mChangedSettings; + mChangedSettings.clear(); + return vec; +} diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp index 46f8139c4..98fad605e 100644 --- a/components/settings/settings.hpp +++ b/components/settings/settings.hpp @@ -5,6 +5,7 @@ namespace Settings { + typedef std::vector< std::pair > SettingCategoryVector; /// /// \brief Settings management (can change during runtime) @@ -12,9 +13,13 @@ namespace Settings class Manager { public: + static Ogre::ConfigFile mFile; static Ogre::ConfigFile mDefaultFile; + static SettingCategoryVector mChangedSettings; + ///< tracks all the settings that were changed since the last apply() call + void loadDefault (const std::string& file); ///< load file as the default settings (can be overridden by user settings) @@ -27,6 +32,9 @@ namespace Settings void saveUser (const std::string& file); ///< save user settings to file + const SettingCategoryVector apply(); + ///< returns the list of changed settings and then clears it + static const int getInt (const std::string& setting, const std::string& category); static const float getFloat (const std::string& setting, const std::string& category); static const std::string getString (const std::string& setting, const std::string& category); From 6091a0504db624f10e605a1bf3a22345c9399fe6 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 1 Apr 2012 16:59:35 +0200 Subject: [PATCH 04/12] first settings test (config file has to be created manually) --- apps/openmw/engine.cpp | 12 ++ components/nifogre/ogre_nif_loader.cpp | 241 ++++++++++++------------- components/settings/settings.cpp | 3 + components/settings/settings.hpp | 1 - 4 files changed, 135 insertions(+), 122 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 38050e53b..294fcf492 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -313,6 +314,17 @@ void OMW::Engine::go() { boost::filesystem::create_directories(configPath); } + + Settings::Manager settings; + + //settings.loadDefault(defaultsettingspath); + + const std::string settingspath = mCfgMgr.getUserPath().string() + "/settings.cfg"; + if (boost::filesystem::exists(settingspath)) + settings.loadUser(settingspath); + else + settings.copyDefaultToUserSettings(); + mOgre->configure(!boost::filesystem::is_regular_file(mCfgMgr.getOgreConfigPath()), mCfgMgr.getOgreConfigPath().string(), mCfgMgr.getLogPath().string(), diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 2ab6ae621..7fa45815f 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -25,6 +25,7 @@ #include "ogre_nif_loader.hpp" +#include typedef unsigned char ubyte; @@ -299,138 +300,136 @@ void NIFLoader::createMaterial(const String &name, material->setSelfIllumination(emissive.array[0], emissive.array[1], emissive.array[2]); material->setShininess(glossiness); - // Create shader for the material - // vertex - HighLevelGpuProgramManager& mgr = HighLevelGpuProgramManager::getSingleton(); - - HighLevelGpuProgramPtr vertex; - if (mgr.getByName("main_vp").isNull()) + if (Settings::Manager::getBool("shaders", "Objects")) { - vertex = mgr.createProgram("main_vp", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - "cg", GPT_VERTEX_PROGRAM); - vertex->setParameter("profiles", "vs_4_0 vs_2_x vp40 arbvp1"); - vertex->setParameter("entry_point", "main_vp"); - StringUtil::StrStreamType outStream; - outStream << - "void main_vp( \n" - " float4 position : POSITION, \n" - " float4 normal : NORMAL, \n" - " float4 colour : COLOR, \n" - " in float2 uv : TEXCOORD0, \n" - " out float2 oUV : TEXCOORD0, \n" - " out float4 oPosition : POSITION, \n" - " out float4 oPositionObjSpace : TEXCOORD1, \n" - " out float4 oNormal : TEXCOORD2, \n" - " out float oFogValue : TEXCOORD3, \n" - " out float4 oVertexColour : TEXCOORD4, \n" - " uniform float4 fogParams, \n" - " uniform float4x4 worldViewProj \n" - ") \n" - "{ \n" - " oVertexColour = colour; \n" - " oUV = uv; \n" - " oNormal = normal; \n" - " oPosition = mul( worldViewProj, position ); \n" - " oFogValue = saturate((oPosition.z - fogParams.y) * fogParams.w); \n" - " oPositionObjSpace = position; \n" - "}"; - vertex->setSource(outStream.str()); - vertex->load(); - vertex->getDefaultParameters()->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX); - vertex->getDefaultParameters()->setNamedAutoConstant("fogParams", GpuProgramParameters::ACT_FOG_PARAMS); - } - else - vertex = mgr.getByName("main_vp"); - material->getTechnique(0)->getPass(0)->setVertexProgram(vertex->getName()); - - // the number of lights to support. - // when rendering an object, OGRE automatically picks the lights that are - // closest to the object being rendered. unfortunately this mechanism does - // not work perfectly for objects batched together (they will all use the same - // lights). to work around this, we are simply pushing the maximum number - // of lights here in order to minimize disappearing lights. - float num_lights; - if (GpuProgramManager::getSingleton().isSyntaxSupported("fp40") || - GpuProgramManager::getSingleton().isSyntaxSupported("ps_4_0")) - num_lights = 8 /* 32 */; - else - num_lights = 8; + // Create shader for the material + // vertex + HighLevelGpuProgramManager& mgr = HighLevelGpuProgramManager::getSingleton(); - // fragment - HighLevelGpuProgramPtr fragment; - if (mgr.getByName("main_fp").isNull()) - { - fragment = mgr.createProgram("main_fp", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - "cg", GPT_FRAGMENT_PROGRAM); - fragment->setParameter("profiles", "ps_4_0 ps_2_x fp40 arbfp1"); - fragment->setParameter("entry_point", "main_fp"); - StringUtil::StrStreamType outStream; - outStream << - "void main_fp( \n" - " in float2 uv : TEXCOORD0, \n" - " out float4 oColor : COLOR, \n" - " uniform sampler2D texture : TEXUNIT0, \n" - " float4 positionObjSpace : TEXCOORD1, \n" - " float4 normal : TEXCOORD2, \n" - " float fogValue : TEXCOORD3, \n" - " float4 vertexColour : TEXCOORD4, \n" - " uniform float4 fogColour, \n"; - - for (int i=0; isetParameter("profiles", "vs_4_0 vs_2_x vp40 arbvp1"); + vertex->setParameter("entry_point", "main_vp"); + StringUtil::StrStreamType outStream; outStream << - " uniform float4 lightDiffuse"<setSource(outStream.str()); + vertex->load(); + vertex->getDefaultParameters()->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX); + vertex->getDefaultParameters()->setNamedAutoConstant("fogParams", GpuProgramParameters::ACT_FOG_PARAMS); } - outStream << - " uniform float4 lightAmbient, \n" - " uniform float4 ambient, \n" - " uniform float4 diffuse, \n" - " uniform float4 emissive \n" - ") \n" - "{ \n" - " float4 tex = tex2D(texture, uv); \n" - " float d; \n" - " float attn; \n" - " float3 lightColour = float3(0, 0, 0); \n"; - - for (int i=0; igetTechnique(0)->getPass(0)->setVertexProgram(vertex->getName()); + + // the number of lights to support. + // when rendering an object, OGRE automatically picks the lights that are + // closest to the object being rendered. unfortunately this mechanism does + // not work perfectly for objects batched together (they will all use the same + // lights). to work around this, we are simply pushing the maximum number + // of lights here in order to minimize disappearing lights. + int num_lights = Settings::Manager::getInt("num lights", "Objects"); + + // fragment + HighLevelGpuProgramPtr fragment; + if (mgr.getByName("main_fp").isNull()) { + fragment = mgr.createProgram("main_fp", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, + "cg", GPT_FRAGMENT_PROGRAM); + fragment->setParameter("profiles", "ps_4_0 ps_2_x fp40 arbfp1"); + fragment->setParameter("entry_point", "main_fp"); + StringUtil::StrStreamType outStream; + outStream << + "void main_fp( \n" + " in float2 uv : TEXCOORD0, \n" + " out float4 oColor : COLOR, \n" + " uniform sampler2D texture : TEXUNIT0, \n" + " float4 positionObjSpace : TEXCOORD1, \n" + " float4 normal : TEXCOORD2, \n" + " float fogValue : TEXCOORD3, \n" + " float4 vertexColour : TEXCOORD4, \n" + " uniform float4 fogColour, \n"; + + for (int i=0; isetSource(outStream.str()); - fragment->load(); - - for (int i=0; igetDefaultParameters()->setNamedAutoConstant("lightPositionObjSpace"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_POSITION_OBJECT_SPACE, i); - fragment->getDefaultParameters()->setNamedAutoConstant("lightDiffuse"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_DIFFUSE_COLOUR, i); - fragment->getDefaultParameters()->setNamedAutoConstant("lightAttenuation"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_ATTENUATION, i); + " lightColour.xyz += lit(dot(normalize(lightDir"<setSource(outStream.str()); + fragment->load(); + + for (int i=0; igetDefaultParameters()->setNamedAutoConstant("lightPositionObjSpace"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_POSITION_OBJECT_SPACE, i); + fragment->getDefaultParameters()->setNamedAutoConstant("lightDiffuse"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_DIFFUSE_COLOUR, i); + fragment->getDefaultParameters()->setNamedAutoConstant("lightAttenuation"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_ATTENUATION, i); + } + fragment->getDefaultParameters()->setNamedAutoConstant("emissive", GpuProgramParameters::ACT_SURFACE_EMISSIVE_COLOUR); + fragment->getDefaultParameters()->setNamedAutoConstant("diffuse", GpuProgramParameters::ACT_SURFACE_DIFFUSE_COLOUR); + fragment->getDefaultParameters()->setNamedAutoConstant("ambient", GpuProgramParameters::ACT_SURFACE_AMBIENT_COLOUR); + fragment->getDefaultParameters()->setNamedAutoConstant("lightAmbient", GpuProgramParameters::ACT_AMBIENT_LIGHT_COLOUR); + fragment->getDefaultParameters()->setNamedAutoConstant("fogColour", GpuProgramParameters::ACT_FOG_COLOUR); } - fragment->getDefaultParameters()->setNamedAutoConstant("emissive", GpuProgramParameters::ACT_SURFACE_EMISSIVE_COLOUR); - fragment->getDefaultParameters()->setNamedAutoConstant("diffuse", GpuProgramParameters::ACT_SURFACE_DIFFUSE_COLOUR); - fragment->getDefaultParameters()->setNamedAutoConstant("ambient", GpuProgramParameters::ACT_SURFACE_AMBIENT_COLOUR); - fragment->getDefaultParameters()->setNamedAutoConstant("lightAmbient", GpuProgramParameters::ACT_AMBIENT_LIGHT_COLOUR); - fragment->getDefaultParameters()->setNamedAutoConstant("fogColour", GpuProgramParameters::ACT_FOG_COLOUR); + else + fragment = mgr.getByName("main_fp"); + material->getTechnique(0)->getPass(0)->setFragmentProgram(fragment->getName()); } - else - fragment = mgr.getByName("main_fp"); - material->getTechnique(0)->getPass(0)->setFragmentProgram(fragment->getName()); } // Takes a name and adds a unique part to it. This is just used to diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index 463230bc7..f2b7823e3 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -73,6 +73,7 @@ const bool Manager::getBool (const std::string& setting, const std::string& cate void Manager::setString (const std::string& setting, const std::string& category, const std::string& value) { + bool found=false; Ogre::ConfigFile::SettingsIterator it = mFile.getSettingsIterator(category); while (it.hasMoreElements()) { @@ -82,10 +83,12 @@ void Manager::setString (const std::string& setting, const std::string& category { mChangedSettings.push_back(std::make_pair(setting, category)); (*i).second = value; + found = true; } it.getNext(); } + assert(found && "Attempting to change a non-existing setting"); } void Manager::setInt (const std::string& setting, const std::string& category, const int value) diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp index 98fad605e..368b5e692 100644 --- a/components/settings/settings.hpp +++ b/components/settings/settings.hpp @@ -13,7 +13,6 @@ namespace Settings class Manager { public: - static Ogre::ConfigFile mFile; static Ogre::ConfigFile mDefaultFile; From f4bbcb48a6de3a5d505004571c627a68b8b28d71 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 1 Apr 2012 17:14:49 +0200 Subject: [PATCH 05/12] settings-default.cfg --- CMakeLists.txt | 4 ++++ apps/openmw/engine.cpp | 11 +++++++++-- files/settings-default.cfg | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 files/settings-default.cfg diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f007dbcc..9c2f5a29a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,6 +214,9 @@ endif (APPLE) # Other files +configure_file(${OpenMW_SOURCE_DIR}/files/settings-default.cfg + "${OpenMW_BINARY_DIR}/settings-default.cfg") + configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg.local "${OpenMW_BINARY_DIR}/openmw.cfg") configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg @@ -288,6 +291,7 @@ if(DPKG_PROGRAM) INSTALL(FILES "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.png" DESTINATION "share/pixmaps/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") #Install global configuration files + INSTALL(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "../etc/openmw/" RENAME "openmw.cfg" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") INSTALL(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 294fcf492..166c9c16b 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -315,9 +315,16 @@ void OMW::Engine::go() boost::filesystem::create_directories(configPath); } + // Create the settings manager and load default and user settings file Settings::Manager settings; - - //settings.loadDefault(defaultsettingspath); + const std::string localdefault = mCfgMgr.getLocalPath().string() + "/settings-default.cfg"; + const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/settings-default.cfg"; + + // prefer local + if (boost::filesystem::exists(localdefault)) + settings.loadDefault(localdefault); + else if (boost::filesystem::exists(globaldefault)) + settings.loadDefault(globaldefault); const std::string settingspath = mCfgMgr.getUserPath().string() + "/settings.cfg"; if (boost::filesystem::exists(settingspath)) diff --git a/files/settings-default.cfg b/files/settings-default.cfg new file mode 100644 index 000000000..7a35b7102 --- /dev/null +++ b/files/settings-default.cfg @@ -0,0 +1,3 @@ +[Objects] +shaders = true +num lights = 8 From 7b3adb27a3eb88752681f47fc4622d80f191fd4f Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 1 Apr 2012 18:48:37 +0200 Subject: [PATCH 06/12] backend changes, terrain num lights setting --- apps/openmw/engine.cpp | 3 + apps/openmw/mwrender/terrainmaterial.cpp | 40 ++++-------- components/settings/settings.cpp | 79 +++++++++++++++++++----- components/settings/settings.hpp | 11 +++- files/settings-default.cfg | 3 + 5 files changed, 91 insertions(+), 45 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 166c9c16b..849ccbe2e 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -426,6 +426,9 @@ void OMW::Engine::go() // Start the main rendering loop mOgre->start(); + // Save user settings + settings.saveUser(settingspath); + std::cout << "Quitting peacefully.\n"; } diff --git a/apps/openmw/mwrender/terrainmaterial.cpp b/apps/openmw/mwrender/terrainmaterial.cpp index 67ebf45af..922ea2280 100644 --- a/apps/openmw/mwrender/terrainmaterial.cpp +++ b/apps/openmw/mwrender/terrainmaterial.cpp @@ -36,7 +36,7 @@ THE SOFTWARE. #include "OgreHardwarePixelBuffer.h" #include "OgreShadowCameraSetupPSSM.h" -#define POINTLIGHTS +#include namespace Ogre { @@ -220,22 +220,10 @@ namespace Ogre } - int TerrainMaterialGeneratorB::SM2Profile::getNumberOfLightsSupported() const - { - #ifndef POINTLIGHTS - return 1; - #else - // number of supported lights depends on the number of available constant registers, - // which in turn depends on the shader profile used - if (GpuProgramManager::getSingleton().isSyntaxSupported("ps_3_0") - || GpuProgramManager::getSingleton().isSyntaxSupported("ps_4_0") - || GpuProgramManager::getSingleton().isSyntaxSupported("fp40") - ) - return 32; - else - return 8; - #endif - } + int TerrainMaterialGeneratorB::SM2Profile::getNumberOfLightsSupported() const + { + return Settings::Manager::getInt("num lights", "Terrain"); + } //--------------------------------------------------------------------- MaterialPtr TerrainMaterialGeneratorB::SM2Profile::generate(const Terrain* terrain) { @@ -565,7 +553,8 @@ namespace Ogre { params->setNamedAutoConstant("lightPosObjSpace"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_POSITION_OBJECT_SPACE, i); params->setNamedAutoConstant("lightDiffuseColour"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_DIFFUSE_COLOUR, i); - params->setNamedAutoConstant("lightAttenuation"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_ATTENUATION, i); + if (prof->getNumberOfLightsSupported() > 1) + params->setNamedAutoConstant("lightAttenuation"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_ATTENUATION, i); //params->setNamedAutoConstant("lightSpecularColour"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_SPECULAR_COLOUR, i); } @@ -980,10 +969,9 @@ namespace Ogre //"uniform float3 lightSpecularColour"<getNumberOfLightsSupported() > 1) + outStream << + "uniform float4 lightAttenuation"<getNumberOfLightsSupported() > 1) + outStream << "float d; \n" "float attn; \n"; - #endif outStream << " eyeDir = normalize(eyeDir); \n"; @@ -1144,13 +1131,12 @@ namespace Ogre outStream << " float3 halfAngle"<getNumberOfLightsSupported() > 1) outStream << // pre-multiply light color with attenuation factor "d = length( lightDir"<begin(); i != settings->end(); ++i) { - fout << i->first.c_str() << '=' << i->second.c_str() << '\n'; + fout << i->first.c_str() << " = " << i->second.c_str() << '\n'; } - seci.getNext(); + CategorySettingValueMap::iterator it = mNewSettings.begin(); + while (it != mNewSettings.end()) + { + if (it->first.first == sectionName) + { + fout << it->first.second << " = " << it->second << '\n'; + mNewSettings.erase(it++); + } + else + ++it; + } + } + + std::string category = ""; + for (CategorySettingValueMap::iterator it = mNewSettings.begin(); + it != mNewSettings.end(); ++it) + { + if (category != it->first.first) + { + category = it->first.first; + fout << '\n' << '[' << category << ']' << '\n'; + } + fout << it->first.second << " = " << it->second << '\n'; } } const std::string Manager::getString (const std::string& setting, const std::string& category) { + if (mNewSettings.find(std::make_pair(category, setting)) != mNewSettings.end()) + return mNewSettings[std::make_pair(category, setting)]; + std::string defaultval = mDefaultFile.getSetting(setting, category); return mFile.getSetting(setting, category, defaultval); } @@ -73,22 +99,45 @@ const bool Manager::getBool (const std::string& setting, const std::string& cate void Manager::setString (const std::string& setting, const std::string& category, const std::string& value) { + CategorySetting s = std::make_pair(category, setting); + bool found=false; - Ogre::ConfigFile::SettingsIterator it = mFile.getSettingsIterator(category); - while (it.hasMoreElements()) + try { - Ogre::ConfigFile::SettingsMultiMap::iterator i = it.current(); - - if ((*i).first == setting && (*i).second != value) + Ogre::ConfigFile::SettingsIterator it = mFile.getSettingsIterator(category); + while (it.hasMoreElements()) { - mChangedSettings.push_back(std::make_pair(setting, category)); - (*i).second = value; - found = true; + Ogre::ConfigFile::SettingsMultiMap::iterator i = it.current(); + + if ((*i).first == setting) + { + if ((*i).second != value) + { + mChangedSettings.push_back(std::make_pair(category, setting)); + (*i).second = value; + } + found = true; + } + + it.getNext(); } + } + catch (Ogre::Exception&) + {} - it.getNext(); + if (!found) + { + if (mNewSettings.find(s) != mNewSettings.end()) + { + if (mNewSettings[s] != value) + { + mChangedSettings.push_back(std::make_pair(category, setting)); + mNewSettings[s] = value; + } + } + else + mNewSettings[s] = value; } - assert(found && "Attempting to change a non-existing setting"); } void Manager::setInt (const std::string& setting, const std::string& category, const int value) @@ -106,9 +155,9 @@ void Manager::setBool (const std::string& setting, const std::string& category, setString(setting, category, Ogre::StringConverter::toString(value)); } -const SettingCategoryVector Manager::apply() +const CategorySettingVector Manager::apply() { - SettingCategoryVector vec = mChangedSettings; + CategorySettingVector vec = mChangedSettings; mChangedSettings.clear(); return vec; } diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp index 368b5e692..f670ea1dd 100644 --- a/components/settings/settings.hpp +++ b/components/settings/settings.hpp @@ -5,7 +5,9 @@ namespace Settings { - typedef std::vector< std::pair > SettingCategoryVector; + typedef std::pair < std::string, std::string > CategorySetting; + typedef std::vector< std::pair > CategorySettingVector; + typedef std::map < CategorySetting, std::string > CategorySettingValueMap; /// /// \brief Settings management (can change during runtime) @@ -16,9 +18,12 @@ namespace Settings static Ogre::ConfigFile mFile; static Ogre::ConfigFile mDefaultFile; - static SettingCategoryVector mChangedSettings; + static CategorySettingVector mChangedSettings; ///< tracks all the settings that were changed since the last apply() call + static CategorySettingValueMap mNewSettings; + ///< tracks all the settings that are in the default file, but not in user file yet + void loadDefault (const std::string& file); ///< load file as the default settings (can be overridden by user settings) @@ -31,7 +36,7 @@ namespace Settings void saveUser (const std::string& file); ///< save user settings to file - const SettingCategoryVector apply(); + static const CategorySettingVector apply(); ///< returns the list of changed settings and then clears it static const int getInt (const std::string& setting, const std::string& category); diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 7a35b7102..1a6b9b328 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -1,3 +1,6 @@ [Objects] shaders = true num lights = 8 + +[Terrain] +num lights = 8 From 5accca385ce148bb56545e0d9fbb0037665be3b3 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 2 Apr 2012 13:47:25 +0200 Subject: [PATCH 07/12] fix crash on exit when no user settings exist --- apps/openmw/engine.cpp | 9 ++++++--- components/settings/settings.cpp | 5 ----- components/settings/settings.hpp | 3 --- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 849ccbe2e..25c0c60bd 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -315,7 +315,7 @@ void OMW::Engine::go() boost::filesystem::create_directories(configPath); } - // Create the settings manager and load default and user settings file + // Create the settings manager and load default settings file Settings::Manager settings; const std::string localdefault = mCfgMgr.getLocalPath().string() + "/settings-default.cfg"; const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/settings-default.cfg"; @@ -326,11 +326,14 @@ void OMW::Engine::go() else if (boost::filesystem::exists(globaldefault)) settings.loadDefault(globaldefault); + // load user settings if they exist, otherwise just load the default settings as user settings const std::string settingspath = mCfgMgr.getUserPath().string() + "/settings.cfg"; if (boost::filesystem::exists(settingspath)) settings.loadUser(settingspath); - else - settings.copyDefaultToUserSettings(); + else if (boost::filesystem::exists(localdefault)) + settings.loadUser(localdefault); + else if (boost::filesystem::exists(globaldefault)) + settings.loadUser(globaldefault); mOgre->configure(!boost::filesystem::is_regular_file(mCfgMgr.getOgreConfigPath()), mCfgMgr.getOgreConfigPath().string(), diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index d94e06678..28201eda2 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -22,11 +22,6 @@ void Manager::loadDefault (const std::string& file) mDefaultFile.load(file); } -void Manager::copyDefaultToUserSettings () -{ - mFile = mDefaultFile; -} - void Manager::saveUser(const std::string& file) { std::fstream fout(file.c_str(), std::ios::out); diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp index f670ea1dd..e9858eb94 100644 --- a/components/settings/settings.hpp +++ b/components/settings/settings.hpp @@ -27,9 +27,6 @@ namespace Settings void loadDefault (const std::string& file); ///< load file as the default settings (can be overridden by user settings) - void copyDefaultToUserSettings (); - ///< copy the default settings to the user settings (useful when there are no user settings yet) - void loadUser (const std::string& file); ///< load file as user settings From 1445ae992db1b4fde52330b0a498a2b616836c41 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 2 Apr 2012 14:24:16 +0200 Subject: [PATCH 08/12] adding a setting to disable static geometry --- apps/openmw/mwrender/objects.cpp | 3 ++- files/settings-default.cfg | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index 94ccb6e97..eb79581aa 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -3,6 +3,7 @@ #include #include +#include using namespace MWRender; @@ -113,7 +114,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) bounds.scale(insert->getScale()); mBounds[ptr.getCell()].merge(bounds); - if(!mIsStatic) + if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects")) { insert->attachObject(ent); diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 1a6b9b328..bf471e111 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -1,6 +1,7 @@ [Objects] shaders = true num lights = 8 +use static geometry = true [Terrain] num lights = 8 From e5cc9adbb02938809938f3ea8a0fe222372d82af Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 2 Apr 2012 15:30:29 +0200 Subject: [PATCH 09/12] added settings for rendering distance of small objects --- apps/openmw/mwrender/objects.cpp | 12 +++++------- files/settings-default.cfg | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index eb79581aa..dd211f8e9 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -89,18 +89,16 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) NifOgre::NIFLoader::load(mesh); Ogre::Entity *ent = mRenderer.getScene()->createEntity(mesh); -/* + Ogre::Vector3 extents = ent->getBoundingBox().getSize(); extents *= insert->getScale(); -// float size = std::max(std::max(extents.x, extents.y), extents.z); + float size = std::max(std::max(extents.x, extents.y), extents.z); - bool small = (size < 250); /// \todo config value + bool small = (size < Settings::Manager::getInt("small object size", "Objects")) && Settings::Manager::getBool("limit small object distance", "Objects"); // do not fade out doors. that will cause holes and look stupid if (ptr.getTypeName().find("Door") != std::string::npos) small = false; -*/ - const bool small = false; if (mBounds.find(ptr.getCell()) == mBounds.end()) mBounds[ptr.getCell()] = Ogre::AxisAlignedBox::BOX_NULL; @@ -118,7 +116,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) { insert->attachObject(ent); - ent->setRenderingDistance(small ? 2500 : 0); /// \todo config value + ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Objects") : 0); /// \todo config value } else { @@ -132,7 +130,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID)); mStaticGeometrySmall[ptr.getCell()] = sg; - sg->setRenderingDistance(2500); /// \todo config value + sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Objects")); /// \todo config value } else sg = mStaticGeometrySmall[ptr.getCell()]; diff --git a/files/settings-default.cfg b/files/settings-default.cfg index bf471e111..1e8be450e 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -1,7 +1,24 @@ [Objects] + shaders = true + +# Max. number of lights that affect objects. Setting to 1 will only reflect sunlight +# Note: has no effect when shaders are turned off num lights = 8 + +# Use static geometry for static objects. Improves rendering speed. use static geometry = true +# Limit the rendering distance of small objects +limit small object distance = false + +# Size below which an object is considered as small +small object size = 250 + +# Rendering distance for small objects +small object distance = 3500 + [Terrain] + +# Max. number of lights that affect the terrain. Setting to 1 will only reflect sunlight num lights = 8 From fd662f937a7b6fe2d5db70eb6a2fa5bc5a929728 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 2 Apr 2012 15:51:48 +0200 Subject: [PATCH 10/12] add settings for viewing distance and fog --- apps/openmw/mwrender/objects.cpp | 6 +++--- apps/openmw/mwrender/renderingmanager.cpp | 13 +++++-------- files/settings-default.cfg | 11 +++++++++++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index dd211f8e9..bf83e5c83 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -94,7 +94,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) extents *= insert->getScale(); float size = std::max(std::max(extents.x, extents.y), extents.z); - bool small = (size < Settings::Manager::getInt("small object size", "Objects")) && Settings::Manager::getBool("limit small object distance", "Objects"); + bool small = (size < Settings::Manager::getInt("small object size", "View distance")) && Settings::Manager::getBool("limit small object distance", "Objects"); // do not fade out doors. that will cause holes and look stupid if (ptr.getTypeName().find("Door") != std::string::npos) @@ -116,7 +116,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) { insert->attachObject(ent); - ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Objects") : 0); /// \todo config value + ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "View distance") : 0); /// \todo config value } else { @@ -130,7 +130,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID)); mStaticGeometrySmall[ptr.getCell()] = sg; - sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Objects")); /// \todo config value + sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "View distance")); /// \todo config value } else sg = mStaticGeometrySmall[ptr.getCell()]; diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 688b97a2e..7f4b1ec39 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -12,6 +12,7 @@ #include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone #include "../mwworld/ptr.hpp" #include +#include using namespace MWRender; @@ -273,18 +274,14 @@ void RenderingManager::configureFog(ESMS::CellStore &mCell) void RenderingManager::configureFog(const float density, const Ogre::ColourValue& colour) { - /// \todo make the viewing distance and fog start/end configurable + float max = Settings::Manager::getFloat("max viewing distance", "Viewing distance"); - // right now we load 3x3 cells, so the maximum viewing distance we - // can allow (to prevent objects suddenly popping up) equals: - // 8192 * 0.69 - // ^ cell size ^ minimum density value used (clear weather) - float low = 5652.48 / density / 2.f; - float high = 5652.48 / density; + float low = max / (density) * Settings::Manager::getFloat("fog start factor", "Viewing distance"); + float high = max / (density) * Settings::Manager::getFloat("fog end factor", "Viewing distance"); mRendering.getScene()->setFog (FOG_LINEAR, colour, 0, low, high); - mRendering.getCamera()->setFarClipDistance ( high ); + mRendering.getCamera()->setFarClipDistance ( max / density ); mRendering.getViewport()->setBackgroundColour (colour); } diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 1e8be450e..345977922 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -9,6 +9,8 @@ num lights = 8 # Use static geometry for static objects. Improves rendering speed. use static geometry = true +[Viewing distance] + # Limit the rendering distance of small objects limit small object distance = false @@ -18,6 +20,15 @@ small object size = 250 # Rendering distance for small objects small object distance = 3500 +# Max viewing distance at clear weather conditions +max viewing distance = 5600 + +# Distance at which fog starts (proportional to viewing distance) +fog start factor = 0.5 + +# Distance at which fog ends (proportional to viewing distance) +fog end factor = 1.0 + [Terrain] # Max. number of lights that affect the terrain. Setting to 1 will only reflect sunlight From 00cc45c5371913d2d4965ffc065e43c10c74042e Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 2 Apr 2012 16:10:54 +0200 Subject: [PATCH 11/12] FPS is now a setting instead of commandline option --- apps/openmw/engine.cpp | 2 ++ apps/openmw/main.cpp | 4 ---- files/settings-default.cfg | 8 ++++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 1722be675..cfcf9f76b 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -343,6 +343,8 @@ void OMW::Engine::go() else if (boost::filesystem::exists(globaldefault)) settings.loadUser(globaldefault); + mFpsLevel = settings.getInt("fps", "HUD"); + mOgre->configure(!boost::filesystem::is_regular_file(mCfgMgr.getOgreConfigPath()), mCfgMgr.getOgreConfigPath().string(), mCfgMgr.getLogPath().string(), diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index cd1e0e26e..a5e5c99e6 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -92,9 +92,6 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat ("plugin", bpo::value()->default_value(StringsVector(), "") ->multitoken(), "plugin file(s)") - ("fps", boost::program_options::value()->implicit_value(1) - ->default_value(0), "fps counter detail (0 = off, 1 = fps counter, 2 = full detail)") - ("anim-verbose", boost::program_options::value()->implicit_value(true) ->default_value(false), "output animation indices files") @@ -225,7 +222,6 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat engine.setNewGame(variables["new-game"].as()); // other settings - engine.showFPS(variables["fps"].as()); engine.setDebugMode(variables["debug"].as()); engine.setSoundUsage(!variables["nosound"].as()); engine.setScriptsVerbosity(variables["script-verbose"].as()); diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 345977922..6372a31c1 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -1,3 +1,11 @@ +[HUD] + +# FPS counter +# 0: not visible +# 1: basic FPS display +# 2: advanced FPS display (batches, triangles) +fps = 0 + [Objects] shaders = true From 5f2a674d939f326a41ae9ee6c71f32cdc8136077 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 2 Apr 2012 16:14:39 +0200 Subject: [PATCH 12/12] fixed a typo --- apps/openmw/mwrender/objects.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index bf83e5c83..f52953692 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -94,7 +94,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) extents *= insert->getScale(); float size = std::max(std::max(extents.x, extents.y), extents.z); - bool small = (size < Settings::Manager::getInt("small object size", "View distance")) && Settings::Manager::getBool("limit small object distance", "Objects"); + bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) && Settings::Manager::getBool("limit small object distance", "Objects"); // do not fade out doors. that will cause holes and look stupid if (ptr.getTypeName().find("Door") != std::string::npos) @@ -116,7 +116,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) { insert->attachObject(ent); - ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "View distance") : 0); /// \todo config value + ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0); /// \todo config value } else { @@ -130,7 +130,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID)); mStaticGeometrySmall[ptr.getCell()] = sg; - sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "View distance")); /// \todo config value + sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Viewing distance")); /// \todo config value } else sg = mStaticGeometrySmall[ptr.getCell()];