From daa8fb15ce76a68a11e186efa34ded2b1dd82535 Mon Sep 17 00:00:00 2001 From: Cris Mihalache Date: Sun, 29 Jan 2012 20:51:20 +0200 Subject: [PATCH] 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);