2011-08-01 13:55:36 +00:00
|
|
|
#ifndef GAME_MWWORLD_PHYSICSSYSTEM_H
|
|
|
|
#define GAME_MWWORLD_PHYSICSSYSTEM_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <openengine/ogre/renderer.hpp>
|
|
|
|
#include <openengine/bullet/physic.hpp>
|
2011-11-11 19:37:42 +00:00
|
|
|
#include "ptr.hpp"
|
2012-03-20 00:03:48 +00:00
|
|
|
#include <openengine/bullet/pmove.h>
|
2011-08-01 13:55:36 +00:00
|
|
|
|
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
|
|
|
|
class PhysicsSystem
|
|
|
|
{
|
|
|
|
public:
|
2012-01-29 15:31:18 +00:00
|
|
|
PhysicsSystem (OEngine::Render::OgreRenderer &_rend);
|
2011-08-01 13:55:36 +00:00
|
|
|
~PhysicsSystem ();
|
2011-08-22 19:34:51 +00:00
|
|
|
|
2011-08-02 16:44:10 +00:00
|
|
|
std::vector< std::pair<std::string, Ogre::Vector3> > doPhysics (float duration,
|
2011-08-01 13:55:36 +00:00
|
|
|
const std::vector<std::pair<std::string, Ogre::Vector3> >& actors);
|
2011-08-22 19:34:51 +00:00
|
|
|
|
2011-08-01 13:55:36 +00:00
|
|
|
void addObject (const std::string& handle, const std::string& mesh,
|
|
|
|
const Ogre::Quaternion& rotation, float scale, const Ogre::Vector3& position);
|
2011-08-22 19:34:51 +00:00
|
|
|
|
2011-08-01 13:55:36 +00:00
|
|
|
void addActor (const std::string& handle, const std::string& mesh,
|
|
|
|
const Ogre::Vector3& position);
|
2011-08-22 19:34:51 +00:00
|
|
|
|
2011-08-01 13:55:36 +00:00
|
|
|
void removeObject (const std::string& handle);
|
2011-08-22 19:34:51 +00:00
|
|
|
|
2011-09-04 07:48:50 +00:00
|
|
|
void moveObject (const std::string& handle, const Ogre::Vector3& position);
|
2011-08-22 19:34:51 +00:00
|
|
|
|
2011-08-01 13:55:36 +00:00
|
|
|
void rotateObject (const std::string& handle, const Ogre::Quaternion& rotation);
|
2011-08-22 19:34:51 +00:00
|
|
|
|
2011-08-01 13:55:36 +00:00
|
|
|
void scaleObject (const std::string& handle, float scale);
|
2011-08-22 19:34:51 +00:00
|
|
|
|
2011-08-01 13:55:36 +00:00
|
|
|
bool toggleCollisionMode();
|
2012-02-24 15:12:43 +00:00
|
|
|
|
|
|
|
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
|
|
|
|
|
|
|
// cast ray, return true if it hit something
|
|
|
|
bool castRay(const Ogre::Vector3& from, const Ogre::Vector3& to);
|
2011-08-22 19:34:51 +00:00
|
|
|
|
2011-11-18 00:38:52 +00:00
|
|
|
void insertObjectPhysics(const MWWorld::Ptr& ptr, std::string model);
|
2011-11-09 23:06:55 +00:00
|
|
|
|
2012-02-24 15:12:43 +00:00
|
|
|
void insertActorPhysics(const MWWorld::Ptr&, std::string model);
|
2011-11-09 23:06:55 +00:00
|
|
|
|
2012-01-29 15:31:18 +00:00
|
|
|
OEngine::Physic::PhysicEngine* getEngine();
|
|
|
|
|
2011-08-01 13:55:36 +00:00
|
|
|
private:
|
|
|
|
OEngine::Render::OgreRenderer &mRender;
|
|
|
|
OEngine::Physic::PhysicEngine* mEngine;
|
|
|
|
bool mFreeFly;
|
2012-03-20 00:03:48 +00:00
|
|
|
playerMove* playerphysics;
|
2011-08-22 19:34:51 +00:00
|
|
|
|
|
|
|
PhysicsSystem (const PhysicsSystem&);
|
|
|
|
PhysicsSystem& operator= (const PhysicsSystem&);
|
2011-08-01 13:55:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|