|
|
|
@ -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
|
|
|
|
@ -84,46 +83,30 @@ bool OgreRenderer::configure(bool showConfig,
|
|
|
|
|
// Disable logging
|
|
|
|
|
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, "");
|
|
|
|
|
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX)
|
|
|
|
|
mRoot = new Root("", "", "");
|
|
|
|
|
loadPlugins();
|
|
|
|
|
#else
|
|
|
|
|
mRoot = new Root(pluginCfg, cfgPath, "");
|
|
|
|
|
#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();
|
|
|
|
|
#else
|
|
|
|
|
mRoot = new Root(pluginCfg, "", "");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
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, ¶ms);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OgreRenderer::createScene(const std::string camName, float fov, float nearClip)
|
|
|
|
|