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

48 lines
1.1 KiB
C++

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