mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 09:23:52 +00:00
add physic
This commit is contained in:
parent
ee0d73e142
commit
ff941b5963
4 changed files with 17 additions and 5 deletions
|
@ -205,6 +205,7 @@ OMW::Engine::Engine()
|
||||||
, mGuiManager (0)
|
, mGuiManager (0)
|
||||||
{
|
{
|
||||||
MWClass::registerClasses();
|
MWClass::registerClasses();
|
||||||
|
mPhysicEngine = new OEngine::Physic::PhysicEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
OMW::Engine::~Engine()
|
OMW::Engine::~Engine()
|
||||||
|
@ -339,7 +340,7 @@ void OMW::Engine::go()
|
||||||
loadBSA();
|
loadBSA();
|
||||||
|
|
||||||
// Create the world
|
// Create the world
|
||||||
mEnvironment.mWorld = new MWWorld::World (mOgre, mDataDir, mMaster, mResDir, mNewGame, mEnvironment);
|
mEnvironment.mWorld = new MWWorld::World (mOgre, mPhysicEngine, mDataDir, mMaster, mResDir, mNewGame, mEnvironment);
|
||||||
|
|
||||||
// Set up the GUI system
|
// Set up the GUI system
|
||||||
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre.getWindow(), mOgre.getScene(), false, cfgDir);
|
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre.getWindow(), mOgre.getScene(), false, cfgDir);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <OgreFrameListener.h>
|
#include <OgreFrameListener.h>
|
||||||
|
|
||||||
#include <openengine/ogre/renderer.hpp>
|
#include <openengine/ogre/renderer.hpp>
|
||||||
|
#include <openengine/bullet/physic.hpp>
|
||||||
#include <components/compiler/extensions.hpp>
|
#include <components/compiler/extensions.hpp>
|
||||||
|
|
||||||
#include "mwworld/environment.hpp"
|
#include "mwworld/environment.hpp"
|
||||||
|
@ -59,6 +60,7 @@ namespace OMW
|
||||||
boost::filesystem::path mDataDir;
|
boost::filesystem::path mDataDir;
|
||||||
boost::filesystem::path mResDir;
|
boost::filesystem::path mResDir;
|
||||||
OEngine::Render::OgreRenderer mOgre;
|
OEngine::Render::OgreRenderer mOgre;
|
||||||
|
OEngine::Physic::PhysicEngine* mPhysicEngine;
|
||||||
std::string mCellName;
|
std::string mCellName;
|
||||||
std::string mMaster;
|
std::string mMaster;
|
||||||
bool mDebug;
|
bool mDebug;
|
||||||
|
|
|
@ -273,7 +273,7 @@ namespace MWWorld
|
||||||
void World::unloadCell (CellRenderCollection::iterator iter)
|
void World::unloadCell (CellRenderCollection::iterator iter)
|
||||||
{
|
{
|
||||||
ListHandles functor;
|
ListHandles functor;
|
||||||
iter->first->forEach (functor);
|
iter->first->forEach<ListHandles>(functor);
|
||||||
|
|
||||||
{ // silence annoying g++ warning
|
{ // silence annoying g++ warning
|
||||||
for (std::vector<std::string>::const_iterator iter (functor.mHandles.begin());
|
for (std::vector<std::string>::const_iterator iter (functor.mHandles.begin());
|
||||||
|
@ -407,12 +407,13 @@ namespace MWWorld
|
||||||
mCellChanged = true;
|
mCellChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
World::World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& dataDir,
|
World::World (OEngine::Render::OgreRenderer& renderer, OEngine::Physic::PhysicEngine* physEng, const boost::filesystem::path& dataDir,
|
||||||
const std::string& master, const boost::filesystem::path& resDir,
|
const std::string& master, const boost::filesystem::path& resDir,
|
||||||
bool newGame, Environment& environment)
|
bool newGame, Environment& environment)
|
||||||
: mSkyManager (0), mScene (renderer), mPlayer (0), mCurrentCell (0), mGlobalVariables (0),
|
: mSkyManager (0), mScene (renderer,physEng), mPlayer (0), mCurrentCell (0), mGlobalVariables (0),
|
||||||
mSky (false), mCellChanged (false), mEnvironment (environment)
|
mSky (false), mCellChanged (false), mEnvironment (environment)
|
||||||
{
|
{
|
||||||
|
mPhysEngine = physEng;
|
||||||
boost::filesystem::path masterPath (dataDir);
|
boost::filesystem::path masterPath (dataDir);
|
||||||
masterPath /= master;
|
masterPath /= master;
|
||||||
|
|
||||||
|
@ -436,6 +437,8 @@ namespace MWWorld
|
||||||
|
|
||||||
mSkyManager =
|
mSkyManager =
|
||||||
MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera(), resDir);
|
MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera(), resDir);
|
||||||
|
|
||||||
|
mPhysEngine = new OEngine::Physic::PhysicEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
World::~World()
|
World::~World()
|
||||||
|
@ -451,6 +454,8 @@ namespace MWWorld
|
||||||
delete mPlayer;
|
delete mPlayer;
|
||||||
delete mSkyManager;
|
delete mSkyManager;
|
||||||
delete mGlobalVariables;
|
delete mGlobalVariables;
|
||||||
|
|
||||||
|
delete mPhysEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Player& World::getPlayer()
|
MWWorld::Player& World::getPlayer()
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "ptr.hpp"
|
#include "ptr.hpp"
|
||||||
#include "globals.hpp"
|
#include "globals.hpp"
|
||||||
|
|
||||||
|
#include "openengine\bullet\physic.hpp"
|
||||||
|
|
||||||
namespace Ogre
|
namespace Ogre
|
||||||
{
|
{
|
||||||
class Vector3;
|
class Vector3;
|
||||||
|
@ -68,6 +70,8 @@ namespace MWWorld
|
||||||
bool mCellChanged;
|
bool mCellChanged;
|
||||||
Environment& mEnvironment;
|
Environment& mEnvironment;
|
||||||
|
|
||||||
|
OEngine::Physic::PhysicEngine* mPhysEngine;
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
World (const World&);
|
World (const World&);
|
||||||
World& operator= (const World&);
|
World& operator= (const World&);
|
||||||
|
@ -98,7 +102,7 @@ namespace MWWorld
|
||||||
/// interior cell.
|
/// interior cell.
|
||||||
public:
|
public:
|
||||||
|
|
||||||
World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& dataDir,
|
World (OEngine::Render::OgreRenderer& renderer, OEngine::Physic::PhysicEngine* physEng, const boost::filesystem::path& dataDir,
|
||||||
const std::string& master, const boost::filesystem::path& resDir, bool newGame,
|
const std::string& master, const boost::filesystem::path& resDir, bool newGame,
|
||||||
Environment& environment);
|
Environment& environment);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue