2018-03-13 22:49:08 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
|
|
|
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
|
|
|
|
|
|
|
|
#include "recastmeshbuilder.hpp"
|
2018-05-26 14:44:25 +00:00
|
|
|
#include "recastmeshobject.hpp"
|
2018-03-13 22:49:08 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
{
|
2018-05-26 14:44:25 +00:00
|
|
|
struct RemovedRecastMeshObject
|
|
|
|
{
|
|
|
|
std::reference_wrapper<const btCollisionShape> mShape;
|
|
|
|
btTransform mTransform;
|
|
|
|
};
|
|
|
|
|
2018-03-13 22:49:08 +00:00
|
|
|
class RecastMeshManager
|
|
|
|
{
|
|
|
|
public:
|
2018-04-15 22:07:18 +00:00
|
|
|
RecastMeshManager(const Settings& settings, const TileBounds& bounds);
|
2018-03-13 22:49:08 +00:00
|
|
|
|
2018-07-12 08:44:11 +00:00
|
|
|
bool addObject(std::size_t id, const btCollisionShape& shape, const btTransform& transform,
|
2018-07-18 19:09:50 +00:00
|
|
|
const AreaType areaType);
|
2018-03-13 22:49:08 +00:00
|
|
|
|
2018-07-18 19:09:50 +00:00
|
|
|
bool updateObject(std::size_t id, const btTransform& transform, const AreaType areaType);
|
2018-05-26 14:44:25 +00:00
|
|
|
|
|
|
|
boost::optional<RemovedRecastMeshObject> removeObject(std::size_t id);
|
2018-03-13 22:49:08 +00:00
|
|
|
|
|
|
|
std::shared_ptr<RecastMesh> getMesh();
|
|
|
|
|
2018-04-15 22:07:18 +00:00
|
|
|
bool isEmpty() const;
|
|
|
|
|
2018-03-13 22:49:08 +00:00
|
|
|
private:
|
|
|
|
bool mShouldRebuild;
|
|
|
|
RecastMeshBuilder mMeshBuilder;
|
2018-05-26 14:44:25 +00:00
|
|
|
std::unordered_map<std::size_t, RecastMeshObject> mObjects;
|
2018-03-13 22:49:08 +00:00
|
|
|
|
|
|
|
void rebuild();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|