1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/apps/openmw/mwworld/physicssystem.hpp

88 lines
3.2 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 <openengine/ogre/renderer.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
void addObject (const MWWorld::Ptr& ptr);
2011-08-22 19:34:51 +00:00
void addActor (const MWWorld::Ptr& ptr);
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);
// have to keep this as handle for now as unloadcell only knows scenenode names
2011-08-01 13:55:36 +00:00
void removeObject (const std::string& handle);
2011-08-22 19:34:51 +00:00
void moveObject (const MWWorld::Ptr& ptr);
2011-08-22 19:34:51 +00:00
void rotateObject (const MWWorld::Ptr& ptr);
2011-08-22 19:34:51 +00:00
void scaleObject (const MWWorld::Ptr& ptr);
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);
btVector3 getRayPoint(float extent, float mouseX, float mouseY);
2012-03-25 18:52:56 +00:00
std::vector < std::pair <float, std::string> > getFacedObjects ();
std::vector < std::pair <float, std::string> > getFacedObjects (float mouseX, float mouseY);
// 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
2012-07-25 16:25:53 +00:00
std::pair<bool, Ogre::Vector3>
castRay(const Ogre::Vector3 &orig, const Ogre::Vector3 &dir, float len);
std::pair<bool, Ogre::Vector3> castRay(float mouseX, float mouseY);
///< cast ray from the mouse, return true if it hit something and the first result (in OGRE coordinates)
OEngine::Physic::PhysicEngine* getEngine();
2012-04-18 04:13:38 +00:00
void setCurrentWater(bool hasWater, int waterHeight);
bool getObjectAABB(const MWWorld::Ptr &ptr, Ogre::Vector3 &min, Ogre::Vector3 &max);
void updatePlayerData(Ogre::Vector3 &eyepos, float pitch, float yaw);
2011-08-01 13:55:36 +00:00
private:
struct {
Ogre::Vector3 eyepos;
float pitch, yaw;
} mPlayerData;
2011-08-01 13:55:36 +00:00
OEngine::Render::OgreRenderer &mRender;
OEngine::Physic::PhysicEngine* mEngine;
bool mFreeFly;
2012-04-17 22:12:05 +00:00
playerMove* playerphysics;
2012-06-18 00:56:10 +00:00
std::map<std::string, std::string> handleToMesh;
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