mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Removed a workaround from Renderer, some cleanup
This commit is contained in:
parent
c2bbbef637
commit
4f35fd8184
8 changed files with 11 additions and 77 deletions
|
@ -503,7 +503,8 @@ void OMW::Engine::go()
|
|||
MWBase::Environment::get().getWindowManager()->executeInConsole (mStartupScript);
|
||||
|
||||
// Start the main rendering loop
|
||||
mOgre->start();
|
||||
while (!mEnvironment.getRequestExit())
|
||||
Ogre::Root::getSingleton().renderOneFrame();
|
||||
|
||||
// Save user settings
|
||||
settings.saveUser(settingspath);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "windowmanager.hpp"
|
||||
|
||||
MWBase::Environment *MWBase::Environment::sThis = 0;
|
||||
bool MWBase::Environment::sExit = false;
|
||||
|
||||
MWBase::Environment::Environment()
|
||||
: mWorld (0), mSoundManager (0), mScriptManager (0), mWindowManager (0),
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace MWBase
|
|||
InputManager *mInputManager;
|
||||
float mFrameDuration;
|
||||
|
||||
static bool sExit;
|
||||
|
||||
Environment (const Environment&);
|
||||
///< not implemented
|
||||
|
||||
|
@ -44,6 +46,9 @@ namespace MWBase
|
|||
|
||||
~Environment();
|
||||
|
||||
static void setRequestExit () { sExit = true; }
|
||||
static bool getRequestExit () { return sExit; }
|
||||
|
||||
void setWorld (World *world);
|
||||
|
||||
void setSoundManager (SoundManager *soundManager);
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace MWGui
|
|||
else if (sender == mButtons["options"])
|
||||
MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings);
|
||||
else if (sender == mButtons["exitgame"])
|
||||
Ogre::Root::getSingleton ().queueEndRendering ();
|
||||
MWBase::Environment::get().setRequestExit();
|
||||
else if (sender == mButtons["newgame"])
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->startNewGame();
|
||||
|
|
|
@ -182,9 +182,6 @@ namespace MWInput
|
|||
case A_GameMenu:
|
||||
toggleMainMenu ();
|
||||
break;
|
||||
case A_Quit:
|
||||
exitNow();
|
||||
break;
|
||||
case A_Screenshot:
|
||||
screenshot();
|
||||
break;
|
||||
|
@ -814,13 +811,6 @@ namespace MWInput
|
|||
mAlwaysRunActive = !mAlwaysRunActive;
|
||||
}
|
||||
|
||||
// Exit program now button (which is disabled in GUI mode)
|
||||
void InputManager::exitNow()
|
||||
{
|
||||
if(!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||
Ogre::Root::getSingleton().queueEndRendering ();
|
||||
}
|
||||
|
||||
void InputManager::resetIdleTime()
|
||||
{
|
||||
if (mTimeIdle < 0)
|
||||
|
|
|
@ -177,7 +177,6 @@ namespace MWInput
|
|||
void activate();
|
||||
void toggleWalking();
|
||||
void toggleAutoMove();
|
||||
void exitNow();
|
||||
void rest();
|
||||
|
||||
void quickKey (int index);
|
||||
|
@ -194,7 +193,7 @@ namespace MWInput
|
|||
|
||||
A_GameMenu,
|
||||
|
||||
A_Quit, // Exit the program
|
||||
A_Unused,
|
||||
|
||||
A_Screenshot, // Take a screenshot
|
||||
|
||||
|
|
|
@ -28,21 +28,6 @@ using namespace Ogre;
|
|||
using namespace OEngine::Render;
|
||||
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
|
||||
CustomRoot::CustomRoot(const Ogre::String& pluginFileName,
|
||||
const Ogre::String& configFileName,
|
||||
const Ogre::String& logFileName)
|
||||
: Ogre::Root(pluginFileName, configFileName, logFileName)
|
||||
{}
|
||||
|
||||
bool CustomRoot::isQueuedEnd() const
|
||||
{
|
||||
return mQueuedEnd;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void OgreRenderer::cleanup()
|
||||
{
|
||||
delete mFader;
|
||||
|
@ -60,23 +45,6 @@ void OgreRenderer::cleanup()
|
|||
unloadPlugins();
|
||||
}
|
||||
|
||||
void OgreRenderer::start()
|
||||
{
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
// we need this custom main loop because otherwise Ogre's Carbon message pump will
|
||||
// steal input events even from our Cocoa window
|
||||
// There's no way to disable Ogre's message pump other that comment pump code in Ogre's source
|
||||
do {
|
||||
if (!mRoot->renderOneFrame()) {
|
||||
break;
|
||||
}
|
||||
|
||||
} while (!mRoot->isQueuedEnd());
|
||||
#else
|
||||
mRoot->startRendering();
|
||||
#endif
|
||||
}
|
||||
|
||||
void OgreRenderer::loadPlugins()
|
||||
{
|
||||
#ifdef ENABLE_PLUGIN_GL
|
||||
|
@ -158,20 +126,15 @@ void OgreRenderer::configure(const std::string &logPath,
|
|||
// Set up logging first
|
||||
new LogManager;
|
||||
Log *log = LogManager::getSingleton().createLog(logPath + std::string("Ogre.log"));
|
||||
logging = _logging;
|
||||
|
||||
if(logging)
|
||||
if(_logging)
|
||||
// Full log detail
|
||||
log->setLogDetail(LL_BOREME);
|
||||
else
|
||||
// Disable logging
|
||||
log->setDebugOutputEnabled(false);
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
mRoot = new CustomRoot("", "", "");
|
||||
#else
|
||||
mRoot = new Root("", "", "");
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX)
|
||||
loadPlugins();
|
||||
|
|
|
@ -27,18 +27,13 @@
|
|||
#include "OgreTexture.h"
|
||||
#include <OgreWindowEventUtilities.h>
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
#include <OgreRoot.h>
|
||||
#endif
|
||||
|
||||
struct SDL_Window;
|
||||
struct SDL_Surface;
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
#if OGRE_PLATFORM != OGRE_PLATFORM_APPLE
|
||||
class Root;
|
||||
#endif
|
||||
class RenderWindow;
|
||||
class SceneManager;
|
||||
class Camera;
|
||||
|
@ -61,17 +56,6 @@ namespace OEngine
|
|||
std::string icon;
|
||||
};
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
class CustomRoot : public Ogre::Root {
|
||||
public:
|
||||
bool isQueuedEnd() const;
|
||||
|
||||
CustomRoot(const Ogre::String& pluginFileName = "plugins.cfg",
|
||||
const Ogre::String& configFileName = "ogre.cfg",
|
||||
const Ogre::String& logFileName = "Ogre.log");
|
||||
};
|
||||
#endif
|
||||
|
||||
class Fader;
|
||||
|
||||
class WindowSizeListener
|
||||
|
@ -82,11 +66,7 @@ namespace OEngine
|
|||
|
||||
class OgreRenderer
|
||||
{
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
CustomRoot *mRoot;
|
||||
#else
|
||||
Ogre::Root *mRoot;
|
||||
#endif
|
||||
Ogre::RenderWindow *mWindow;
|
||||
SDL_Window *mSDLWindow;
|
||||
Ogre::SceneManager *mScene;
|
||||
|
@ -110,7 +90,6 @@ namespace OEngine
|
|||
Fader* mFader;
|
||||
std::vector<Ogre::ParticleEmitterFactory*> mEmitterFactories;
|
||||
std::vector<Ogre::ParticleAffectorFactory*> mAffectorFactories;
|
||||
bool logging;
|
||||
|
||||
WindowSizeListener* mWindowListener;
|
||||
|
||||
|
@ -139,7 +118,6 @@ namespace OEngine
|
|||
, mD3D9Plugin(NULL)
|
||||
#endif
|
||||
, mFader(NULL)
|
||||
, logging(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -167,9 +145,6 @@ namespace OEngine
|
|||
/// Kill the renderer.
|
||||
void cleanup();
|
||||
|
||||
/// Start the main rendering loop
|
||||
void start();
|
||||
|
||||
void loadPlugins();
|
||||
|
||||
void unloadPlugins();
|
||||
|
|
Loading…
Reference in a new issue