#ifndef CSV_WORLD_PHYSICSSYSTEM_H #define CSV_WORLD_PHYSICSSYSTEM_H #include #include #include namespace Ogre { class Vector3; class Quaternion; class SceneManager; class Camera; } namespace OEngine { namespace Physic { class PhysicEngine; } } namespace CSVRender { class SceneWidget; } namespace CSVWorld { class PhysicsSystem { static PhysicsSystem *mPhysicsSystemInstance; std::map mSceneNodeToRefId; std::map > mRefIdToSceneNode; std::map mSceneNodeToMesh; std::list mSceneManagers; // FIXME: change to list per OEngine std::list mSceneWidgets; // FIXME: change to list per OEngine OEngine::Physic::PhysicEngine* mEngine; public: PhysicsSystem(); ~PhysicsSystem(); static PhysicsSystem *instance(); void addSceneManager(Ogre::SceneManager *sceneMgr, CSVRender::SceneWidget * scene); void addObject(const std::string &mesh, const std::string &sceneNodeName, const std::string &referenceId, float scale, const Ogre::Vector3 &position, const Ogre::Quaternion &rotation, bool placeable=false); void removeObject(const std::string &sceneNodeName); void moveObject(const std::string &sceneNodeName, const Ogre::Vector3 &position, const Ogre::Quaternion &rotation); void addHeightField(float* heights, int x, int y, float yoffset, float triSize, float sqrtVerts); void removeHeightField(int x, int y); void toggleDebugRendering(Ogre::SceneManager *sceneMgr); // return the object's SceneNode name and position for the given SceneManager std::pair castRay(float mouseX, float mouseY, Ogre::SceneManager *sceneMgr, Ogre::Camera *camera); std::string sceneNodeToRefId(std::string sceneNodeName); std::string sceneNodeToMesh(std::string sceneNodeName); std::list sceneWidgets(); private: void updateSelectionHighlight(std::string sceneNode, const Ogre::Vector3 &position); std::string refIdToSceneNode(std::string referenceId, Ogre::SceneManager *sceneMgr); }; } #endif // CSV_WORLD_PHYSICSSYSTEM_H