add physic

actorid
gugus 14 years ago
parent ee0d73e142
commit ff941b5963

@ -205,6 +205,7 @@ OMW::Engine::Engine()
, mGuiManager (0)
{
MWClass::registerClasses();
mPhysicEngine = new OEngine::Physic::PhysicEngine();
}
OMW::Engine::~Engine()
@ -339,7 +340,7 @@ void OMW::Engine::go()
loadBSA();
// 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
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre.getWindow(), mOgre.getScene(), false, cfgDir);

@ -8,6 +8,7 @@
#include <OgreFrameListener.h>
#include <openengine/ogre/renderer.hpp>
#include <openengine/bullet/physic.hpp>
#include <components/compiler/extensions.hpp>
#include "mwworld/environment.hpp"
@ -59,6 +60,7 @@ namespace OMW
boost::filesystem::path mDataDir;
boost::filesystem::path mResDir;
OEngine::Render::OgreRenderer mOgre;
OEngine::Physic::PhysicEngine* mPhysicEngine;
std::string mCellName;
std::string mMaster;
bool mDebug;

@ -273,7 +273,7 @@ namespace MWWorld
void World::unloadCell (CellRenderCollection::iterator iter)
{
ListHandles functor;
iter->first->forEach (functor);
iter->first->forEach<ListHandles>(functor);
{ // silence annoying g++ warning
for (std::vector<std::string>::const_iterator iter (functor.mHandles.begin());
@ -407,12 +407,13 @@ namespace MWWorld
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,
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)
{
mPhysEngine = physEng;
boost::filesystem::path masterPath (dataDir);
masterPath /= master;
@ -436,6 +437,8 @@ namespace MWWorld
mSkyManager =
MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera(), resDir);
mPhysEngine = new OEngine::Physic::PhysicEngine();
}
World::~World()
@ -451,6 +454,8 @@ namespace MWWorld
delete mPlayer;
delete mSkyManager;
delete mGlobalVariables;
delete mPhysEngine;
}
MWWorld::Player& World::getPlayer()

@ -14,6 +14,8 @@
#include "ptr.hpp"
#include "globals.hpp"
#include "openengine\bullet\physic.hpp"
namespace Ogre
{
class Vector3;
@ -68,6 +70,8 @@ namespace MWWorld
bool mCellChanged;
Environment& mEnvironment;
OEngine::Physic::PhysicEngine* mPhysEngine;
// not implemented
World (const World&);
World& operator= (const World&);
@ -98,7 +102,7 @@ namespace MWWorld
/// interior cell.
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,
Environment& environment);

Loading…
Cancel
Save