1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 23:53:56 +00:00
openmw-tes3mp/components/detournavigator/recastmeshmanager.hpp

48 lines
1.1 KiB
C++
Raw Normal View History

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>
#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-04-02 21:04:19 +00:00
bool addObject(std::size_t id, const btCollisionShape& shape, const btTransform& transform);
2018-03-13 22:49:08 +00:00
2018-05-26 14:44:25 +00:00
bool updateObject(std::size_t id, const btTransform& transform);
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