1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00
OpenMW/components/detournavigator/recastmeshmanager.hpp
2018-10-13 22:16:30 +03:00

45 lines
982 B
C++

#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
#include "recastmeshbuilder.hpp"
#include <LinearMath/btTransform.h>
#include <boost/optional.hpp>
#include <unordered_map>
class btCollisionShape;
namespace DetourNavigator
{
class RecastMeshManager
{
public:
struct Object
{
const btCollisionShape* mShape;
btTransform mTransform;
};
RecastMeshManager(const Settings& settings, const TileBounds& bounds);
bool addObject(std::size_t id, const btCollisionShape& shape, const btTransform& transform);
boost::optional<Object> removeObject(std::size_t id);
std::shared_ptr<RecastMesh> getMesh();
bool isEmpty() const;
private:
bool mShouldRebuild;
RecastMeshBuilder mMeshBuilder;
std::unordered_map<std::size_t, Object> mObjects;
void rebuild();
};
}
#endif