From 6d4fa9274e2df9d931ad492125aa949da8e8bd53 Mon Sep 17 00:00:00 2001 From: Cris Mihalache Date: Sun, 29 Jan 2012 17:31:18 +0200 Subject: [PATCH 1/2] Moved OpenEngine systems into their appropriate classes --- apps/esmtool/Makefile | 192 +++++++++++++++++++++- apps/openmw/engine.cpp | 25 +-- apps/openmw/engine.hpp | 4 +- apps/openmw/mwgui/window_manager.cpp | 11 +- apps/openmw/mwgui/window_manager.hpp | 7 +- apps/openmw/mwworld/physicssystem.cpp | 17 +- apps/openmw/mwworld/physicssystem.hpp | 4 +- apps/openmw/mwworld/world.cpp | 2 +- extern/caelum/include/CaelumPrecompiled.h | 2 +- extern/caelum/src/InternalUtilities.cpp | 2 +- 10 files changed, 230 insertions(+), 36 deletions(-) diff --git a/apps/esmtool/Makefile b/apps/esmtool/Makefile index ee92cf4c8..42ef5e88c 100644 --- a/apps/esmtool/Makefile +++ b/apps/esmtool/Makefile @@ -1,5 +1,191 @@ -esmtool_cmd.c: esmtool.ggo - gengetopt < esmtool.ggo +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.8 +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/cmake-gui + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/cris/projects/openmw + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/cris/projects/openmw + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." + /usr/bin/cmake-gui -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# The main all target +all: cmake_check_build_system + cd /home/cris/projects/openmw && $(CMAKE_COMMAND) -E cmake_progress_start /home/cris/projects/openmw/CMakeFiles /home/cris/projects/openmw/apps/esmtool/CMakeFiles/progress.marks + cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/cris/projects/openmw/CMakeFiles 0 +.PHONY : all + +# The main clean target clean: - rm esmtool_cmd.c esmtool_cmd.h + cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/cris/projects/openmw && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +apps/esmtool/CMakeFiles/esmtool.dir/rule: + cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/CMakeFiles/esmtool.dir/rule +.PHONY : apps/esmtool/CMakeFiles/esmtool.dir/rule + +# Convenience name for target. +esmtool: apps/esmtool/CMakeFiles/esmtool.dir/rule +.PHONY : esmtool + +# fast build rule for target. +esmtool/fast: + cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/build +.PHONY : esmtool/fast + +esmtool.o: esmtool.cpp.o +.PHONY : esmtool.o + +# target to build an object file +esmtool.cpp.o: + cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool.cpp.o +.PHONY : esmtool.cpp.o + +esmtool.i: esmtool.cpp.i +.PHONY : esmtool.i + +# target to preprocess a source file +esmtool.cpp.i: + cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool.cpp.i +.PHONY : esmtool.cpp.i + +esmtool.s: esmtool.cpp.s +.PHONY : esmtool.s + +# target to generate assembly for a file +esmtool.cpp.s: + cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool.cpp.s +.PHONY : esmtool.cpp.s + +esmtool_cmd.o: esmtool_cmd.c.o +.PHONY : esmtool_cmd.o + +# target to build an object file +esmtool_cmd.c.o: + cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool_cmd.c.o +.PHONY : esmtool_cmd.c.o + +esmtool_cmd.i: esmtool_cmd.c.i +.PHONY : esmtool_cmd.i + +# target to preprocess a source file +esmtool_cmd.c.i: + cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool_cmd.c.i +.PHONY : esmtool_cmd.c.i + +esmtool_cmd.s: esmtool_cmd.c.s +.PHONY : esmtool_cmd.s + +# target to generate assembly for a file +esmtool_cmd.c.s: + cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool_cmd.c.s +.PHONY : esmtool_cmd.c.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... esmtool" + @echo "... rebuild_cache" + @echo "... esmtool.o" + @echo "... esmtool.i" + @echo "... esmtool.s" + @echo "... esmtool_cmd.o" + @echo "... esmtool_cmd.i" + @echo "... esmtool_cmd.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/cris/projects/openmw && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index ee3a6181a..8a0efd5ed 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -35,8 +35,6 @@ #include "mwsound/soundmanager.hpp" #include "mwworld/world.hpp" -#include "mwworld/ptr.hpp" -#include "mwworld/environment.hpp" #include "mwworld/class.hpp" #include "mwworld/player.hpp" @@ -175,7 +173,6 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt) OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager) : mOgre (0) - , mPhysicEngine (0) , mFpsLevel(0) , mDebug (false) , mVerboseScripts (false) @@ -186,7 +183,6 @@ OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager) , mFocusTDiff (0) , mScriptManager (0) , mScriptContext (0) - , mGuiManager (0) , mFSStrict (false) , mCfgMgr(configurationManager) { @@ -196,7 +192,6 @@ OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager) OMW::Engine::~Engine() { - delete mGuiManager; delete mEnvironment.mWorld; delete mEnvironment.mSoundManager; delete mEnvironment.mGlobalScripts; @@ -205,7 +200,6 @@ OMW::Engine::~Engine() delete mEnvironment.mJournal; delete mScriptManager; delete mScriptContext; - delete mPhysicEngine; delete mOgre; } @@ -332,27 +326,20 @@ void OMW::Engine::go() mOgre->createWindow("OpenMW"); loadBSA(); - - /// \todo move this into the physics manager - // Create physics. shapeLoader is deleted by the physic engine - NifBullet::ManualBulletShapeLoader* shapeLoader = new NifBullet::ManualBulletShapeLoader(); - mPhysicEngine = new OEngine::Physic::PhysicEngine(shapeLoader); + + // Create the physics system + mPhysicsSystem = new MWWorld::PhysicsSystem(*mOgre); + mPhysicEngine = mPhysicsSystem->getEngine(); // Create the world mEnvironment.mWorld = new MWWorld::World (*mOgre, mPhysicEngine, mFileCollections, mMaster, mResDir, mNewGame, mEnvironment, mEncoding); - /// \todo move this into the GUI manager (a.k.a WindowManager) - // Set up the GUI system - mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false, - mCfgMgr.getLogPath().string() + std::string("/")); - - // Create window manager - this manages all the MW-specific GUI windows MWScript::registerExtensions (mExtensions); - mEnvironment.mWindowManager = new MWGui::WindowManager(mGuiManager->getGui(), mEnvironment, - mExtensions, mFpsLevel, mNewGame); + mEnvironment.mWindowManager = new MWGui::WindowManager(mEnvironment, + mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/")); // Create sound system mEnvironment.mSoundManager = new MWSound::SoundManager(mOgre->getRoot(), diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index 02d108f0a..553bf7efa 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -14,6 +14,7 @@ #include #include "mwworld/environment.hpp" +#include "mwworld/physicssystem.hpp" #include "mwworld/ptr.hpp" namespace Compiler @@ -77,10 +78,11 @@ namespace OMW std::string mFocusName; MWWorld::Environment mEnvironment; + MWWorld::PhysicsSystem *mPhysicsSystem; MWScript::ScriptManager *mScriptManager; Compiler::Extensions mExtensions; Compiler::Context *mScriptContext; - OEngine::GUI::MyGUIManager *mGuiManager; + Files::Collections mFileCollections; bool mFSStrict; diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index d16611794..fc17bece5 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -22,12 +22,13 @@ using namespace MWGui; -WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment, - const Compiler::Extensions& extensions, int fpsLevel, bool newGame) +WindowManager::WindowManager(MWWorld::Environment& environment, + const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath) : environment(environment) , nameDialog(nullptr) , raceDialog(nullptr) , dialogueWindow(nullptr) + , mGuiManager (0) , classChoiceDialog(nullptr) , generateClassQuestionDialog(nullptr) , generateClassResultDialog(nullptr) @@ -35,7 +36,6 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment , createClassDialog(nullptr) , birthSignDialog(nullptr) , reviewDialog(nullptr) - , gui(_gui) , mode(GM_Game) , nextMode(GM_Game) , needModeChange(false) @@ -46,6 +46,10 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment creationStage = NotStarted; + // Set up the GUI system + mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false, logpath); + gui = mGuiManager->getGui(); + //Register own widgets with MyGUI MyGUI::FactoryManager::getInstance().registerFactory("Widget"); @@ -91,6 +95,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment WindowManager::~WindowManager() { + delete mGuiManager; delete console; delete mMessageBoxManager; delete hud; diff --git a/apps/openmw/mwgui/window_manager.hpp b/apps/openmw/mwgui/window_manager.hpp index a47e53fed..b3e81c7f0 100644 --- a/apps/openmw/mwgui/window_manager.hpp +++ b/apps/openmw/mwgui/window_manager.hpp @@ -15,6 +15,8 @@ #include #include +#include +#include #include "../mwmechanics/stat.hpp" #include "mode.hpp" @@ -81,6 +83,7 @@ namespace MWGui typedef std::vector SkillList; private: + OEngine::GUI::MyGUIManager *mGuiManager; MWWorld::Environment& environment; HUD *hud; MapWindow *map; @@ -165,8 +168,8 @@ namespace MWGui public: /// The constructor needs the main Gui object - WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment, - const Compiler::Extensions& extensions, int fpsLevel, bool newGame); + WindowManager(MWWorld::Environment& environment, + const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath); virtual ~WindowManager(); /** diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index e74e201f5..f32cf9703 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -3,6 +3,7 @@ #include "physicssystem.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/world.hpp" // FIXME +#include #include "OgreRoot.h" #include "OgreRenderWindow.h" @@ -16,16 +17,24 @@ using namespace Ogre; namespace MWWorld { - PhysicsSystem::PhysicsSystem(OEngine::Render::OgreRenderer &_rend , OEngine::Physic::PhysicEngine* physEng) : - mRender(_rend), mEngine(physEng), mFreeFly (true) + PhysicsSystem::PhysicsSystem(OEngine::Render::OgreRenderer &_rend) : + mRender(_rend), mEngine(0), mFreeFly (true) { - + // Create physics. shapeLoader is deleted by the physic engine + NifBullet::ManualBulletShapeLoader* shapeLoader = new NifBullet::ManualBulletShapeLoader(); + mEngine = new OEngine::Physic::PhysicEngine(shapeLoader); } PhysicsSystem::~PhysicsSystem() { - + delete mEngine; + + } + OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine() + { + return mEngine; } + std::pair PhysicsSystem::getFacedHandle (MWWorld::World& world) { std::string handle = ""; diff --git a/apps/openmw/mwworld/physicssystem.hpp b/apps/openmw/mwworld/physicssystem.hpp index a447d7bc1..e534ee208 100644 --- a/apps/openmw/mwworld/physicssystem.hpp +++ b/apps/openmw/mwworld/physicssystem.hpp @@ -12,7 +12,7 @@ namespace MWWorld class PhysicsSystem { public: - PhysicsSystem (OEngine::Render::OgreRenderer &_rend , OEngine::Physic::PhysicEngine* physEng); + PhysicsSystem (OEngine::Render::OgreRenderer &_rend); ~PhysicsSystem (); std::vector< std::pair > doPhysics (float duration, @@ -39,6 +39,8 @@ namespace MWWorld void insertActorPhysics(const MWWorld::Ptr&, std::string model); + OEngine::Physic::PhysicEngine* getEngine(); + private: OEngine::Render::OgreRenderer &mRender; OEngine::Physic::PhysicEngine* mEngine; diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index e66dc01dc..51b66f939 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -152,7 +152,7 @@ namespace MWWorld { mPhysEngine = physEng; - mPhysics = new PhysicsSystem(renderer, physEng); + mPhysics = new PhysicsSystem(renderer); boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master)); diff --git a/extern/caelum/include/CaelumPrecompiled.h b/extern/caelum/include/CaelumPrecompiled.h index e93bd8404..c7d9d4ca4 100644 --- a/extern/caelum/include/CaelumPrecompiled.h +++ b/extern/caelum/include/CaelumPrecompiled.h @@ -19,7 +19,7 @@ along with Caelum. If not, see . */ #ifdef __APPLE__ -#include "Ogre/Ogre.h" +#include "OGRE/Ogre.h" #else #include "Ogre.h" #endif diff --git a/extern/caelum/src/InternalUtilities.cpp b/extern/caelum/src/InternalUtilities.cpp index f70b0f267..a308fcb7f 100644 --- a/extern/caelum/src/InternalUtilities.cpp +++ b/extern/caelum/src/InternalUtilities.cpp @@ -75,7 +75,7 @@ namespace Caelum stream.unsetf(std::ios::dec); stream.setf(std::ios::hex); stream.setf(std::ios::uppercase); - stream << reinterpret_cast(pointer); + stream << reinterpret_cast(pointer); return stream.str(); } From daa8fb15ce76a68a11e186efa34ded2b1dd82535 Mon Sep 17 00:00:00 2001 From: Cris Mihalache Date: Sun, 29 Jan 2012 20:51:20 +0200 Subject: [PATCH 2/2] Removed all physics-related code from Engine --- .gitignore | 3 + apps/esmtool/Makefile | 191 ---------------------- apps/openmw/engine.cpp | 6 +- apps/openmw/engine.hpp | 5 - apps/openmw/mwrender/renderingmanager.cpp | 2 - apps/openmw/mwworld/world.cpp | 47 +++--- apps/openmw/mwworld/world.hpp | 4 +- 7 files changed, 29 insertions(+), 229 deletions(-) delete mode 100644 apps/esmtool/Makefile diff --git a/.gitignore b/.gitignore index ada874bb2..6b5892c6b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ Docs/mainpage.hpp CMakeFiles */CMakeFiles CMakeCache.txt +Makefile +makefile + diff --git a/apps/esmtool/Makefile b/apps/esmtool/Makefile deleted file mode 100644 index 42ef5e88c..000000000 --- a/apps/esmtool/Makefile +++ /dev/null @@ -1,191 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# Default target executed when no arguments are given to make. -default_target: all -.PHONY : default_target - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# The program to use to edit the cache. -CMAKE_EDIT_COMMAND = /usr/bin/cmake-gui - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/cris/projects/openmw - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/cris/projects/openmw - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." - /usr/bin/cmake-gui -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache -.PHONY : edit_cache/fast - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache -.PHONY : rebuild_cache/fast - -# The main all target -all: cmake_check_build_system - cd /home/cris/projects/openmw && $(CMAKE_COMMAND) -E cmake_progress_start /home/cris/projects/openmw/CMakeFiles /home/cris/projects/openmw/apps/esmtool/CMakeFiles/progress.marks - cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/all - $(CMAKE_COMMAND) -E cmake_progress_start /home/cris/projects/openmw/CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/clean -.PHONY : clean - -# The main clean target -clean/fast: clean -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - cd /home/cris/projects/openmw && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 -.PHONY : depend - -# Convenience name for target. -apps/esmtool/CMakeFiles/esmtool.dir/rule: - cd /home/cris/projects/openmw && $(MAKE) -f CMakeFiles/Makefile2 apps/esmtool/CMakeFiles/esmtool.dir/rule -.PHONY : apps/esmtool/CMakeFiles/esmtool.dir/rule - -# Convenience name for target. -esmtool: apps/esmtool/CMakeFiles/esmtool.dir/rule -.PHONY : esmtool - -# fast build rule for target. -esmtool/fast: - cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/build -.PHONY : esmtool/fast - -esmtool.o: esmtool.cpp.o -.PHONY : esmtool.o - -# target to build an object file -esmtool.cpp.o: - cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool.cpp.o -.PHONY : esmtool.cpp.o - -esmtool.i: esmtool.cpp.i -.PHONY : esmtool.i - -# target to preprocess a source file -esmtool.cpp.i: - cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool.cpp.i -.PHONY : esmtool.cpp.i - -esmtool.s: esmtool.cpp.s -.PHONY : esmtool.s - -# target to generate assembly for a file -esmtool.cpp.s: - cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool.cpp.s -.PHONY : esmtool.cpp.s - -esmtool_cmd.o: esmtool_cmd.c.o -.PHONY : esmtool_cmd.o - -# target to build an object file -esmtool_cmd.c.o: - cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool_cmd.c.o -.PHONY : esmtool_cmd.c.o - -esmtool_cmd.i: esmtool_cmd.c.i -.PHONY : esmtool_cmd.i - -# target to preprocess a source file -esmtool_cmd.c.i: - cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool_cmd.c.i -.PHONY : esmtool_cmd.c.i - -esmtool_cmd.s: esmtool_cmd.c.s -.PHONY : esmtool_cmd.s - -# target to generate assembly for a file -esmtool_cmd.c.s: - cd /home/cris/projects/openmw && $(MAKE) -f apps/esmtool/CMakeFiles/esmtool.dir/build.make apps/esmtool/CMakeFiles/esmtool.dir/esmtool_cmd.c.s -.PHONY : esmtool_cmd.c.s - -# Help Target -help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... clean" - @echo "... depend" - @echo "... edit_cache" - @echo "... esmtool" - @echo "... rebuild_cache" - @echo "... esmtool.o" - @echo "... esmtool.i" - @echo "... esmtool.s" - @echo "... esmtool_cmd.o" - @echo "... esmtool_cmd.i" - @echo "... esmtool_cmd.s" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - cd /home/cris/projects/openmw && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system - diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 8a0efd5ed..c8dca2d3a 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -326,13 +326,9 @@ void OMW::Engine::go() mOgre->createWindow("OpenMW"); loadBSA(); - - // Create the physics system - mPhysicsSystem = new MWWorld::PhysicsSystem(*mOgre); - mPhysicEngine = mPhysicsSystem->getEngine(); // Create the world - mEnvironment.mWorld = new MWWorld::World (*mOgre, mPhysicEngine, mFileCollections, mMaster, + mEnvironment.mWorld = new MWWorld::World (*mOgre, mFileCollections, mMaster, mResDir, mNewGame, mEnvironment, mEncoding); // Create window manager - this manages all the MW-specific GUI windows diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index 553bf7efa..b224df7d1 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -7,14 +7,11 @@ #include -#include - #include #include #include #include "mwworld/environment.hpp" -#include "mwworld/physicssystem.hpp" #include "mwworld/ptr.hpp" namespace Compiler @@ -64,7 +61,6 @@ namespace OMW boost::filesystem::path mDataDir; boost::filesystem::path mResDir; OEngine::Render::OgreRenderer *mOgre; - OEngine::Physic::PhysicEngine* mPhysicEngine; std::string mCellName; std::string mMaster; int mFpsLevel; @@ -78,7 +74,6 @@ namespace OMW std::string mFocusName; MWWorld::Environment mEnvironment; - MWWorld::PhysicsSystem *mPhysicsSystem; MWScript::ScriptManager *mScriptManager; Compiler::Extensions mExtensions; Compiler::Context *mScriptContext; diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index c5cf8be5d..3b495dd3c 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -19,8 +19,6 @@ using namespace Ogre; namespace MWRender { - - RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment) :mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mDebugging(engine) { diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index 51b66f939..17c227953 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -143,16 +143,17 @@ namespace MWWorld } } - World::World (OEngine::Render::OgreRenderer& renderer, OEngine::Physic::PhysicEngine* physEng, + World::World (OEngine::Render::OgreRenderer& renderer, const Files::Collections& fileCollections, const std::string& master, const boost::filesystem::path& resDir, bool newGame, Environment& environment, const std::string& encoding) - : mRendering (renderer,resDir, physEng, environment),mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), + : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this) { - mPhysEngine = physEng; - mPhysics = new PhysicsSystem(renderer); + mPhysEngine = mPhysics->getEngine(); + + mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment); boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master)); @@ -163,7 +164,7 @@ namespace MWWorld mEsm.open (masterPath.string()); mStore.load (mEsm); - MWRender::Player* play = &(mRendering.getPlayer()); + MWRender::Player* play = &(mRendering->getPlayer()); mPlayer = new MWWorld::Player (play, mStore.npcs.find ("player"), *this); mPhysics->addActor (mPlayer->getPlayer().getRefData().getHandle(), "", Ogre::Vector3 (0, 0, 0)); @@ -176,9 +177,7 @@ namespace MWWorld mGlobalVariables->setInt ("chargenstate", 1); } - mPhysEngine = physEng; - - mWorldScene = new Scene(environment, this, mRendering, mPhysics); + mWorldScene = new Scene(environment, this, *mRendering, mPhysics); } @@ -186,7 +185,7 @@ namespace MWWorld { delete mWorldScene; delete mGlobalVariables; - + delete mRendering; delete mPhysics; delete mPlayer; @@ -368,7 +367,7 @@ namespace MWWorld mGlobalVariables->setFloat ("gamehour", hour); - mRendering.skySetHour (hour); + mRendering->skySetHour (hour); if (days>0) setDay (days + mGlobalVariables->getInt ("day")); @@ -403,7 +402,7 @@ namespace MWWorld mGlobalVariables->setInt ("day", day); mGlobalVariables->setInt ("month", month); - mRendering.skySetDate (day, month); + mRendering->skySetDate (day, month); } void World::setMonth (int month) @@ -424,7 +423,7 @@ namespace MWWorld if (years>0) mGlobalVariables->setInt ("year", years+mGlobalVariables->getInt ("year")); - mRendering.skySetDate (mGlobalVariables->getInt ("day"), month); + mRendering->skySetDate (mGlobalVariables->getInt ("day"), month); } bool World::toggleSky() @@ -432,34 +431,34 @@ namespace MWWorld if (mSky) { mSky = false; - mRendering.skyDisable(); + mRendering->skyDisable(); return false; } else { mSky = true; // TODO check for extorior or interior with sky. - mRendering.skySetHour (mGlobalVariables->getFloat ("gamehour")); - mRendering.skySetDate (mGlobalVariables->getInt ("day"), + mRendering->skySetHour (mGlobalVariables->getFloat ("gamehour")); + mRendering->skySetDate (mGlobalVariables->getInt ("day"), mGlobalVariables->getInt ("month")); - mRendering.skyEnable(); + mRendering->skyEnable(); return true; } } int World::getMasserPhase() const { - return mRendering.skyGetMasserPhase(); + return mRendering->skyGetMasserPhase(); } int World::getSecundaPhase() const { - return mRendering.skyGetSecundaPhase(); + return mRendering->skyGetSecundaPhase(); } void World::setMoonColour (bool red) { - mRendering.skySetMoonColour (red); + mRendering->skySetMoonColour (red); } float World::getTimeScaleFactor() const @@ -505,7 +504,7 @@ namespace MWWorld mEnvironment.mSoundManager->stopSound3D (ptr); mPhysics->removeObject (ptr.getRefData().getHandle()); - mRendering.removeObject(ptr); + mRendering->removeObject(ptr); mLocalScripts.remove (ptr); } @@ -542,7 +541,7 @@ namespace MWWorld /// \todo cell change for non-player ref - mRendering.moveObject (ptr, Ogre::Vector3 (x, y, z)); + mRendering->moveObject (ptr, Ogre::Vector3 (x, y, z)); } void World::moveObject (Ptr ptr, float x, float y, float z) @@ -616,7 +615,7 @@ namespace MWWorld bool World::toggleRenderMode (RenderMode mode) { - return mRendering.toggleRenderMode (mode); + return mRendering->toggleRenderMode (mode); } std::pair World::createRecord (const ESM::Potion& record) @@ -677,12 +676,12 @@ namespace MWWorld void World::playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number) { - mRendering.playAnimationGroup (ptr, groupName, mode, number); + mRendering->playAnimationGroup (ptr, groupName, mode, number); } void World::skipAnimation (const MWWorld::Ptr& ptr) { - mRendering.skipAnimation (ptr); + mRendering->skipAnimation (ptr); } void World::update (float duration) diff --git a/apps/openmw/mwworld/world.hpp b/apps/openmw/mwworld/world.hpp index 13e06cc39..893980456 100644 --- a/apps/openmw/mwworld/world.hpp +++ b/apps/openmw/mwworld/world.hpp @@ -65,7 +65,7 @@ namespace MWWorld private: - MWRender::RenderingManager mRendering; + MWRender::RenderingManager* mRendering; MWWorld::Scene *mWorldScene; MWWorld::Player *mPlayer; @@ -95,7 +95,7 @@ namespace MWWorld public: - World (OEngine::Render::OgreRenderer& renderer, OEngine::Physic::PhysicEngine* physEng, + World (OEngine::Render::OgreRenderer& renderer, const Files::Collections& fileCollections, const std::string& master, const boost::filesystem::path& resDir, bool newGame, Environment& environment, const std::string& encoding);