1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 06:39:49 +00:00
OpenMW/apps/openmw/mwworld/physicssystem.hpp

77 lines
2.7 KiB
C++
Raw Normal View History

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:
PhysicsSystem (OEngine::Render::OgreRenderer &_rend);
2011-08-01 13:55:36 +00:00
~PhysicsSystem ();
2011-08-22 19:34:51 +00:00
void doPhysics(float duration, const std::vector<std::pair<std::string, Ogre::Vector3> >& actors);
///< do physics with dt - Usage: first call doPhysics with frame dt, then call doPhysicsFixed as often as time steps have passed
std::vector< std::pair<std::string, Ogre::Vector3> > doPhysicsFixed (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors);
///< do physics with fixed timestep - Usage: first call doPhysics with frame dt, then call doPhysicsFixed as often as time steps have passed
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
void addHeightField (float* heights,
int x, int y, float yoffset,
float triSize, float sqrtVerts);
void removeHeightField (int x, int y);
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();
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
2012-03-25 18:52:56 +00:00
btVector3 getRayPoint(float extent);
std::vector < std::pair <float, std::string> > getFacedObjects ();
// 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);
void insertActorPhysics(const MWWorld::Ptr&, std::string model);
OEngine::Physic::PhysicEngine* getEngine();
2012-04-18 04:13:38 +00:00
void setCurrentWater(bool hasWater, int waterHeight);
2011-08-01 13:55:36 +00:00
private:
OEngine::Render::OgreRenderer &mRender;
OEngine::Physic::PhysicEngine* mEngine;
bool mFreeFly;
2012-04-17 22:12:05 +00:00
playerMove* playerphysics;
2012-04-03 02:08:46 +00:00
2011-08-22 19:34:51 +00:00
PhysicsSystem (const PhysicsSystem&);
PhysicsSystem& operator= (const PhysicsSystem&);
2011-08-01 13:55:36 +00:00
};
}
#endif