integrated video settings in the settings file, the launcher is now useless

actorid
scrawl 13 years ago
parent 7938566004
commit 343bbaf0fd

@ -268,15 +268,6 @@ void OMW::Engine::go()
mOgre = new OEngine::Render::OgreRenderer;
//we need to ensure the path to the configuration exists before creating an
//instance of ogre root so that Ogre doesn't raise an exception when trying to
//access it
const boost::filesystem::path configPath = mCfgMgr.getOgreConfigPath().parent_path();
if ( !boost::filesystem::exists(configPath) )
{
boost::filesystem::create_directories(configPath);
}
// Create the settings manager and load default settings file
Settings::Manager settings;
const std::string localdefault = mCfgMgr.getLocalPath().string() + "/settings-default.cfg";
@ -308,10 +299,20 @@ void OMW::Engine::go()
else if (boost::filesystem::exists(mCfgMgr.getGlobalPath().string() + "/transparency-overrides.cfg"))
nifOverrides.loadTransparencyOverrides(mCfgMgr.getGlobalPath().string() + "/transparency-overrides.cfg");
mOgre->configure(!boost::filesystem::is_regular_file(mCfgMgr.getOgreConfigPath()),
mCfgMgr.getOgreConfigPath().string(),
std::string renderSystem = settings.getString("render system", "Video");
if (renderSystem == "")
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
renderSystem = "Direct3D9 Rendering Subsystem";
#else
renderSystem = "OpenGL Rendering Subsystem";
#endif
}
mOgre->configure(
mCfgMgr.getLogPath().string(),
mCfgMgr.getPluginsConfigPath().string(), false);
mCfgMgr.getPluginsConfigPath().string(),
renderSystem,
false);
// This has to be added BEFORE MyGUI is initialized, as it needs
// to find core.xml here.
@ -325,7 +326,14 @@ void OMW::Engine::go()
addZipResource(mResDir / "mygui" / "Obliviontt.zip");
// Create the window
mOgre->createWindow("OpenMW");
OEngine::Render::WindowSettings windowSettings;
windowSettings.fullscreen = settings.getBool("fullscreen", "Video");
windowSettings.window_x = settings.getInt("resolution x", "Video");
windowSettings.window_y = settings.getInt("resolution y", "Video");
windowSettings.vsync = settings.getBool("vsync", "Video");
std::string aa = settings.getString("antialiasing", "Video");
windowSettings.fsaa = (aa.substr(0, 4) == "MSAA") ? aa.substr(5, aa.size()-5) : "0";
mOgre->createWindow("OpenMW", windowSettings);
loadBSA();

@ -15,7 +15,6 @@ namespace Files
{
static const char* const openmwCfgFile = "openmw.cfg";
static const char* const ogreCfgFile = "ogre.cfg";
static const char* const pluginsCfgFile = "plugins.cfg";
const char* const mwToken = "?mw?";
@ -39,7 +38,6 @@ ConfigurationManager::ConfigurationManager()
}
}
mOgreCfgPath = mFixedPath.getUserPath() / ogreCfgFile;
mLogPath = mFixedPath.getUserPath();
}
@ -164,11 +162,6 @@ const boost::filesystem::path& ConfigurationManager::getInstallPath() const
return mFixedPath.getInstallPath();
}
const boost::filesystem::path& ConfigurationManager::getOgreConfigPath() const
{
return mOgreCfgPath;
}
const boost::filesystem::path& ConfigurationManager::getPluginsConfigPath() const
{
return mPluginsCfgPath;

@ -41,7 +41,6 @@ struct ConfigurationManager
const boost::filesystem::path& getLocalDataPath() const;
const boost::filesystem::path& getInstallPath() const;
const boost::filesystem::path& getOgreConfigPath() const;
const boost::filesystem::path& getPluginsConfigPath() const;
const boost::filesystem::path& getLogPath() const;
@ -59,7 +58,6 @@ struct ConfigurationManager
FixedPathType mFixedPath;
boost::filesystem::path mOgreCfgPath;
boost::filesystem::path mPluginsCfgPath;
boost::filesystem::path mLogPath;

@ -1,6 +1,29 @@
# WARNING: Editing this file might have no effect, as these
# settings are overwritten by your user settings file.
[Video]
resolution x = 800
resolution y = 600
fullscreen = false
# Render system
# blank means default
# Valid values:
# OpenGL Rendering Subsystem
# Direct3D9 Rendering Subsystem
render system =
# Valid values:
# none
# MSAA 2
# MSAA 4
# MSAA 8
# MSAA 16
antialiasing = none
vsync = false
[General]
# Camera field of view
field of view = 55

@ -66,10 +66,9 @@ float OgreRenderer::getFPS()
return mWindow->getLastFPS();
}
bool OgreRenderer::configure(bool showConfig,
const std::string &cfgPath,
const std::string &logPath,
void OgreRenderer::configure(const std::string &logPath,
const std::string &pluginCfg,
const std::string& renderSystem,
bool _logging)
{
// Set up logging first
@ -85,45 +84,29 @@ bool OgreRenderer::configure(bool showConfig,
log->setDebugOutputEnabled(false);
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX)
mRoot = new Root("", cfgPath, "");
mRoot = new Root("", "", "");
loadPlugins();
#else
mRoot = new Root(pluginCfg, cfgPath, "");
mRoot = new Root(pluginCfg, "", "");
#endif
// Show the configuration dialog and initialise the system, if the
// showConfig parameter is specified. The settings are stored in
// ogre.cfg. If showConfig is false, the settings are assumed to
// already exist in ogre.cfg.
int result;
if(showConfig)
result = mRoot->showConfigDialog();
else
result = mRoot->restoreConfig();
return !result;
RenderSystem* rs = mRoot->getRenderSystemByName(renderSystem);
if (rs == 0)
throw std::runtime_error ("RenderSystem with name " + renderSystem + " not found, make sure the plugins are loaded");
mRoot->setRenderSystem(rs);
}
bool OgreRenderer::configure(bool showConfig,
const std::string &cfgPath,
const std::string &pluginCfg,
bool _logging)
void OgreRenderer::createWindow(const std::string &title, const WindowSettings& settings)
{
return configure(showConfig, cfgPath, cfgPath, pluginCfg, _logging);
}
assert(mRoot);
mRoot->initialise(false);
bool OgreRenderer::configure(bool showConfig,
const std::string &pluginCfg,
bool _logging)
{
return configure(showConfig, "", pluginCfg, _logging);
}
NameValuePairList params;
params.insert(std::make_pair("title", title));
params.insert(std::make_pair("FSAA", settings.fsaa));
params.insert(std::make_pair("vsync", settings.vsync ? "true" : "false"));
void OgreRenderer::createWindow(const std::string &title)
{
assert(mRoot);
// Initialize OGRE window
mWindow = mRoot->initialise(true, title, "");
mWindow = mRoot->createRenderWindow(title, settings.window_x, settings.window_y, settings.fullscreen, &params);
}
void OgreRenderer::createScene(const std::string camName, float fov, float nearClip)

@ -33,9 +33,18 @@ namespace Ogre
class Viewport;
}
namespace OEngine {
namespace OEngine
{
namespace Render
{
struct WindowSettings
{
bool vsync;
bool fullscreen;
int window_x, window_y;
std::string fsaa;
};
class Fader;
class OgreRenderer
{
@ -93,25 +102,14 @@ namespace Render
/** Configure the renderer. This will load configuration files and
set up the Root and logging classes. */
bool configure(bool showConfig, // Show config dialog box?
const std::string &cfgPath, // Path to directory where to store config files
void configure(
const std::string &logPath, // Path to directory where to store log files
const std::string &pluginCfg, // plugin.cfg file
bool _logging); // Enable or disable logging
bool configure(bool showConfig, // Show config dialog box?
const std::string &cfgPath, // Path to directory where to store config files
const std::string &pluginCfg, // plugin.cfg file
bool _logging); // Enable or disable logging
/** Configure the renderer. This will load configuration files and
set up the Root and logging classes. */
bool configure(bool showConfig, // Show config dialog box?
const std::string &pluginCfg, // plugin.cfg file
const std::string &renderSystem,
bool _logging); // Enable or disable logging
/// Create a window with the given title
void createWindow(const std::string &title);
void createWindow(const std::string &title, const WindowSettings& settings);
/// Set up the scene manager, camera and viewport
void createScene(const std::string camName="Camera",// Camera name
@ -152,5 +150,6 @@ namespace Render
/// Viewport
Ogre::Viewport *getViewport() { return mView; }
};
}}
}
}
#endif

Loading…
Cancel
Save