2018-03-13 22:49:08 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
|
|
|
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
|
|
|
|
|
|
|
|
#include "recastmeshbuilder.hpp"
|
|
|
|
|
|
|
|
#include <LinearMath/btTransform.h>
|
|
|
|
|
2018-04-01 00:44:16 +00:00
|
|
|
#include <boost/optional.hpp>
|
|
|
|
|
2018-03-13 22:49:08 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
class btCollisionShape;
|
|
|
|
|
|
|
|
namespace DetourNavigator
|
|
|
|
{
|
|
|
|
class RecastMeshManager
|
|
|
|
{
|
|
|
|
public:
|
2018-04-01 00:44:16 +00:00
|
|
|
struct Object
|
|
|
|
{
|
|
|
|
const btCollisionShape* mShape;
|
|
|
|
btTransform mTransform;
|
|
|
|
};
|
|
|
|
|
2018-03-13 22:49:08 +00:00
|
|
|
RecastMeshManager(const Settings& settings);
|
|
|
|
|
|
|
|
bool addObject(std::size_t id, const btHeightfieldTerrainShape& shape, const btTransform& transform);
|
|
|
|
|
|
|
|
bool addObject(std::size_t id, const btConcaveShape& shape, const btTransform& transform);
|
|
|
|
|
2018-04-01 00:44:16 +00:00
|
|
|
boost::optional<Object> removeObject(std::size_t id);
|
2018-03-13 22:49:08 +00:00
|
|
|
|
|
|
|
std::shared_ptr<RecastMesh> getMesh();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool mShouldRebuild;
|
|
|
|
RecastMeshBuilder mMeshBuilder;
|
|
|
|
std::unordered_map<std::size_t, Object> mObjects;
|
|
|
|
|
|
|
|
void rebuild();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|