1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-10 12:39:53 +00:00
OpenMW/components/detournavigator/recastmeshmanager.hpp

48 lines
1.1 KiB
C++
Raw Normal View History

2018-03-14 01:49:08 +03:00
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
#include "recastmeshbuilder.hpp"
2018-05-26 17:44:25 +03:00
#include "recastmeshobject.hpp"
2018-03-14 01:49:08 +03:00
#include <LinearMath/btTransform.h>
#include <boost/optional.hpp>
2018-03-14 01:49:08 +03:00
#include <unordered_map>
class btCollisionShape;
namespace DetourNavigator
{
2018-05-26 17:44:25 +03:00
struct RemovedRecastMeshObject
{
std::reference_wrapper<const btCollisionShape> mShape;
btTransform mTransform;
};
2018-03-14 01:49:08 +03:00
class RecastMeshManager
{
public:
2018-04-16 01:07:18 +03:00
RecastMeshManager(const Settings& settings, const TileBounds& bounds);
2018-03-14 01:49:08 +03:00
2018-04-03 00:04:19 +03:00
bool addObject(std::size_t id, const btCollisionShape& shape, const btTransform& transform);
2018-03-14 01:49:08 +03:00
2018-05-26 17:44:25 +03:00
bool updateObject(std::size_t id, const btTransform& transform);
boost::optional<RemovedRecastMeshObject> removeObject(std::size_t id);
2018-03-14 01:49:08 +03:00
std::shared_ptr<RecastMesh> getMesh();
2018-04-16 01:07:18 +03:00
bool isEmpty() const;
2018-03-14 01:49:08 +03:00
private:
bool mShouldRebuild;
RecastMeshBuilder mMeshBuilder;
2018-05-26 17:44:25 +03:00
std::unordered_map<std::size_t, RecastMeshObject> mObjects;
2018-03-14 01:49:08 +03:00
void rebuild();
};
}
#endif