forked from teamnwah/openmw-tes3coop
first settings test (config file has to be created manually)
This commit is contained in:
parent
308df7caa8
commit
6091a0504d
4 changed files with 135 additions and 122 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <components/esm/esm_reader.hpp>
|
#include <components/esm/esm_reader.hpp>
|
||||||
#include <components/files/fixedpath.hpp>
|
#include <components/files/fixedpath.hpp>
|
||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
#include <components/nifbullet/bullet_nif_loader.hpp>
|
#include <components/nifbullet/bullet_nif_loader.hpp>
|
||||||
#include <components/nifogre/ogre_nif_loader.hpp>
|
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||||
|
@ -313,6 +314,17 @@ void OMW::Engine::go()
|
||||||
{
|
{
|
||||||
boost::filesystem::create_directories(configPath);
|
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()),
|
mOgre->configure(!boost::filesystem::is_regular_file(mCfgMgr.getOgreConfigPath()),
|
||||||
mCfgMgr.getOgreConfigPath().string(),
|
mCfgMgr.getOgreConfigPath().string(),
|
||||||
mCfgMgr.getLogPath().string(),
|
mCfgMgr.getLogPath().string(),
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "ogre_nif_loader.hpp"
|
#include "ogre_nif_loader.hpp"
|
||||||
|
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
typedef unsigned char ubyte;
|
typedef unsigned char ubyte;
|
||||||
|
|
||||||
|
@ -299,6 +300,8 @@ void NIFLoader::createMaterial(const String &name,
|
||||||
material->setSelfIllumination(emissive.array[0], emissive.array[1], emissive.array[2]);
|
material->setSelfIllumination(emissive.array[0], emissive.array[1], emissive.array[2]);
|
||||||
material->setShininess(glossiness);
|
material->setShininess(glossiness);
|
||||||
|
|
||||||
|
if (Settings::Manager::getBool("shaders", "Objects"))
|
||||||
|
{
|
||||||
// Create shader for the material
|
// Create shader for the material
|
||||||
// vertex
|
// vertex
|
||||||
HighLevelGpuProgramManager& mgr = HighLevelGpuProgramManager::getSingleton();
|
HighLevelGpuProgramManager& mgr = HighLevelGpuProgramManager::getSingleton();
|
||||||
|
@ -349,12 +352,7 @@ void NIFLoader::createMaterial(const String &name,
|
||||||
// not work perfectly for objects batched together (they will all use the same
|
// 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
|
// lights). to work around this, we are simply pushing the maximum number
|
||||||
// of lights here in order to minimize disappearing lights.
|
// of lights here in order to minimize disappearing lights.
|
||||||
float num_lights;
|
int num_lights = Settings::Manager::getInt("num lights", "Objects");
|
||||||
if (GpuProgramManager::getSingleton().isSyntaxSupported("fp40") ||
|
|
||||||
GpuProgramManager::getSingleton().isSyntaxSupported("ps_4_0"))
|
|
||||||
num_lights = 8 /* 32 */;
|
|
||||||
else
|
|
||||||
num_lights = 8;
|
|
||||||
|
|
||||||
// fragment
|
// fragment
|
||||||
HighLevelGpuProgramPtr fragment;
|
HighLevelGpuProgramPtr fragment;
|
||||||
|
@ -432,6 +430,7 @@ void NIFLoader::createMaterial(const String &name,
|
||||||
fragment = mgr.getByName("main_fp");
|
fragment = mgr.getByName("main_fp");
|
||||||
material->getTechnique(0)->getPass(0)->setFragmentProgram(fragment->getName());
|
material->getTechnique(0)->getPass(0)->setFragmentProgram(fragment->getName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Takes a name and adds a unique part to it. This is just used to
|
// Takes a name and adds a unique part to it. This is just used to
|
||||||
// make sure that all materials are given unique names.
|
// make sure that all materials are given unique names.
|
||||||
|
|
|
@ -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)
|
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);
|
Ogre::ConfigFile::SettingsIterator it = mFile.getSettingsIterator(category);
|
||||||
while (it.hasMoreElements())
|
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));
|
mChangedSettings.push_back(std::make_pair(setting, category));
|
||||||
(*i).second = value;
|
(*i).second = value;
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
it.getNext();
|
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)
|
void Manager::setInt (const std::string& setting, const std::string& category, const int value)
|
||||||
|
|
|
@ -13,7 +13,6 @@ namespace Settings
|
||||||
class Manager
|
class Manager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static Ogre::ConfigFile mFile;
|
static Ogre::ConfigFile mFile;
|
||||||
static Ogre::ConfigFile mDefaultFile;
|
static Ogre::ConfigFile mDefaultFile;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue